core: link user session keyring to session keyring#6286
core: link user session keyring to session keyring#6286eworm-de wants to merge 1 commit intosystemd:masterfrom
Conversation
|
Arch Linux downstream bug report where eCryptfs breaks: |
|
This (and your previous commit) creates huge security hole - now all users logged via the same top-level service (xDM, sshd) have access to each other keys. See https://bugzilla.novell.com/show_bug.cgi?id=1045886#c20 The whole kernel keyring handling should be removed and discussed with someone who actually understands how it works. |
Commit 74dd6b5 (core: run each system service with a fresh session keyring) broke adding keys to default keyrings. Added keys could not be accessed with error message: keyctl_read_alloc: Permission denied Commit 437a851 (core: link user keyring to session keyring (systemd#6275)) fixed this for the user keyring. Link the user session keyring as well.
Isnt that commit broken ? it defeats the whole purpose of commit 74dd6b5: session keyring for system services should not be linked up to the user keyring. @eworm-de , are you sure that your setup is not missing pam_keyinit.so ? |
|
My setup breaks at a point where no pam is involved at all. But you are right, all commits dealing with kernel keyring are broken: Read the bug report linked by @arvidjaar for details. |
Hmm if PAM is not used by your setup at all, 74dd6b5 might be incomplete indeed. |
|
Hmpf. Sorry for the forth and back, after reading this again I think the current code is actually the way it should be for the general case, except for the specific disk keyrin case here. That's because we "misuse" the kernel UID=0 keyring as kind of a "system-wide" keyring (which is a suggestion by the keyring kernel folks) for this specific purpose. I kinda hoped we wouldn#t need a config option for the keyring but I figure we do after all... Hence I think we should add a new option for unit files: KeyringMode=private|shared If "private" which would be the default, we'd not link up the service keyring with the user keyring. But if "shared" we'd link them up. Then we'd use that for the disk agents, so that the logic can work. Later on we might want to add more modes to this, for example KeyringMode=off for disabling the keyring for a service altogether (using seccomp), or KeyringMode=locked to make changes impossible (also using seccomp). But that of course can happen in a later commit. @eworm-de can i convince you to rework your current patch to make the behaviour conditional based on such a setting? |
This reverts commit 437a851. The outcome of this isn't that clear, let's revert this for now, see discussion on systemd#6286.
|
I posted a temporary revert for the other patch now in #6342. I still think some patch like that one should go in after all, but conditionalized through some service option, as discussed. But we shouldn#t change behaviour on this one again before we settle on an even different longer term fix... I hope that makes sense. @eworm-de if you rework your patch, can you include both link invocations under the condition? |
I'm not sure to follow here... what is the "specific disk keyring case" ? Currently I think the problem is for distros that don't integrate pam_keyinit in their PAM setup. In this case
In my understanding, commit 437a851 tried to address 1. by linking up the session keyring to the user keyring but because of 2. all users logged via the same "login" service will share their user keyring. pam_keyinit.so is supposed to fix that but some distros haven't integrate it yet... |
|
I will try to find some time to prepare this. |
|
I am running into this problem I believe on gentoo.. tried systemd 233-r4, 234-r2, and the current git head (-9999 in portage terms)... still persists. |
|
So, today someone pinged me on IRC because that they heard that GDM uses the cryptsetup password for autologin when it can, but it wasn't working for them. We debugged a bit and determined pam_gdm running as root doesn't have permission to read the cryptsetup password from root's user keyring. I did a bit of googling and found this pull request and the related ones, so here I am to chime in. Some of this keyctl stuff is a little obscure, so, let me just summarize my understanding of the situation (probably getting some of the details wrong):
it shows my user keyring, named
(note the
So I wanted to write more, but I gotta run now. In my mind there are two fixes we need,
|
Interesting. we've already been doing this upstream, since the end of last year, but it never made it into the fedora package (which ships its own pam config) |
…yring We want that cryptsetup can cache keys between multiple invocations, and it does so via the root user's user keyring, hence let's share it among services. Replaces: systemd#6286
…yring We want that cryptsetup can cache keys between multiple invocations, and it does so via the root user's user keyring, hence let's share it among services. Replaces: systemd#6286
…yring We want that cryptsetup can cache keys between multiple invocations, and it does so via the root user's user keyring, hence let's share it among services. Replaces: systemd#6286
It seems that this stuff needs more thoughts... See also: systemd/systemd#6286 [fbui: fixes bnc#1045886]
Until PAM module "pam_keyinit" is not integrated in the SUSE PAM stack, this feature has to be disabled. The integration of pam_keyinit is tracked here: https://bugzilla.opensuse.org/show_bug.cgi?id=1081947 See also: systemd/systemd#6286 [fbui: fixes boo#1045886]
Until PAM module "pam_keyinit" is not integrated in the SUSE PAM stack, this feature has to be disabled. The integration of pam_keyinit is tracked here: https://bugzilla.opensuse.org/show_bug.cgi?id=1081947 See also: systemd/systemd#6286 [fbui: fixes boo#1045886]
Until PAM module "pam_keyinit" is fully integrated in SUSE's PAM stack, this feature has to be disabled. openSUSE is still not ready for enabling the keyring stuff (see bsc#1081947). Some services got fixed (sshd, getty@.service) but some still haven't (xdm, login, ...) So leave it disabled again otherwise different users might end up using the same session keyring - the one created for the service used for logging in (sshd, getty@.service, xdm, etc...) The integration of pam_keyinit is tracked here: https://bugzilla.opensuse.org/show_bug.cgi?id=1081947 See also: systemd/systemd#6286 [fbui: fixes boo#1045886]
Until PAM module "pam_keyinit" is fully integrated in SUSE's PAM stack, this feature has to be disabled. openSUSE is still not ready for enabling the keyring stuff (see bsc#1081947). Some services got fixed (sshd, getty@.service) but some still haven't (xdm, login, ...) So leave it disabled again otherwise different users might end up using the same session keyring - the one created for the service used for logging in (sshd, getty@.service, xdm, etc...) The integration of pam_keyinit is tracked here: https://bugzilla.opensuse.org/show_bug.cgi?id=1081947 See also: systemd/systemd#6286 [fbui: fixes boo#1045886]
Until PAM module "pam_keyinit" is fully integrated in SUSE's PAM stack, this feature has to be disabled. openSUSE is still not ready for enabling the keyring stuff (see bsc#1081947). Some services got fixed (sshd, getty@.service) but some still haven't (xdm, login, ...) So leave it disabled again otherwise different users might end up using the same session keyring - the one created for the service used for logging in (sshd, getty@.service, xdm, etc...) The integration of pam_keyinit is tracked here: https://bugzilla.opensuse.org/show_bug.cgi?id=1081947 See also: systemd/systemd#6286 [fbui: fixes boo#1045886]
Until PAM module "pam_keyinit" is fully integrated in SUSE's PAM stack, this feature has to be disabled. openSUSE is still not ready for enabling the keyring stuff (see bsc#1081947). Some services got fixed (sshd, getty@.service) but some still haven't (xdm, login, ...) So leave it disabled again otherwise different users might end up using the same session keyring - the one created for the service used for logging in (sshd, getty@.service, xdm, etc...) The integration of pam_keyinit is tracked here: https://bugzilla.opensuse.org/show_bug.cgi?id=1081947 See also: systemd/systemd#6286 [fbui: fixes boo#1045886]
Until PAM module "pam_keyinit" is fully integrated in SUSE's PAM stack, this feature has to be disabled. openSUSE is still not ready for enabling the keyring stuff (see bsc#1081947). Some services got fixed (sshd, getty@.service) but some still haven't (xdm, login, ...) So leave it disabled again otherwise different users might end up using the same session keyring - the one created for the service used for logging in (sshd, getty@.service, xdm, etc...) The integration of pam_keyinit is tracked here: https://bugzilla.opensuse.org/show_bug.cgi?id=1081947 See also: systemd/systemd#6286 [fbui: fixes boo#1045886]
Until PAM module "pam_keyinit" is fully integrated in SUSE's PAM stack, this feature has to be disabled. openSUSE is still not ready for enabling the keyring stuff (see bsc#1081947). Some services got fixed (sshd, getty@.service) but some still haven't (xdm, login, ...) So leave it disabled again otherwise different users might end up using the same session keyring - the one created for the service used for logging in (sshd, getty@.service, xdm, etc...) The integration of pam_keyinit is tracked here: https://bugzilla.opensuse.org/show_bug.cgi?id=1081947 See also: systemd/systemd#6286 [fbui: fixes boo#1045886]
Until PAM module "pam_keyinit" is fully integrated in SUSE's PAM stack, this feature has to be disabled. openSUSE is still not ready for enabling the keyring stuff (see bsc#1081947). Some services got fixed (sshd, getty@.service) but some still haven't (xdm, login, ...) So leave it disabled again otherwise different users might end up using the same session keyring - the one created for the service used for logging in (sshd, getty@.service, xdm, etc...) The integration of pam_keyinit is tracked here: https://bugzilla.opensuse.org/show_bug.cgi?id=1081947 See also: systemd/systemd#6286 [fbui: fixes boo#1045886]
Until PAM module "pam_keyinit" is fully integrated in SUSE's PAM stack, this feature has to be disabled. openSUSE is still not ready for enabling the keyring stuff (see bsc#1081947). Some services got fixed (sshd, getty@.service) but some still haven't (xdm, login, ...) So leave it disabled again otherwise different users might end up using the same session keyring - the one created for the service used for logging in (sshd, getty@.service, xdm, etc...) The integration of pam_keyinit is tracked here: https://bugzilla.opensuse.org/show_bug.cgi?id=1081947 See also: systemd/systemd#6286 [fbui: fixes boo#1045886]
Until PAM module "pam_keyinit" is fully integrated in SUSE's PAM stack, this feature has to be disabled. openSUSE is still not ready for enabling the keyring stuff (see bsc#1081947). Some services got fixed (sshd, getty@.service) but some still haven't (xdm, login, ...) So leave it disabled again otherwise different users might end up using the same session keyring - the one created for the service used for logging in (sshd, getty@.service, xdm, etc...) The integration of pam_keyinit is tracked here: https://bugzilla.opensuse.org/show_bug.cgi?id=1081947 See also: systemd/systemd#6286 [fbui: fixes boo#1045886]
Until PAM module "pam_keyinit" is fully integrated in SUSE's PAM stack, this feature has to be disabled. openSUSE is still not ready for enabling the keyring stuff (see bsc#1081947). Some services got fixed (sshd, getty@.service) but some still haven't (xdm, login, ...) So leave it disabled again otherwise different users might end up using the same session keyring - the one created for the service used for logging in (sshd, getty@.service, xdm, etc...) The integration of pam_keyinit is tracked here: https://bugzilla.opensuse.org/show_bug.cgi?id=1081947 See also: systemd/systemd#6286 [fbui: fixes boo#1045886]
Commit 74dd6b5 (core: run each system
service with a fresh session keyring) broke adding keys to default
keyrings.
Added keys could not be accessed with error message:
keyctl_read_alloc: Permission denied
Commit 437a851 (core: link user keyring
to session keyring (#6275)) fixed this for the user keyring.
Link the user session keyring as well.