You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, both automatic unlocking of directories and rewrapping of the user's login protector are done though the PAM modulepam_fscrypt.so. Specifically the following PAM types do the following things:
session
tracks of the number of open sessions for that user
automatically unlocks user encrypted directories
automatically locks user encrypted directories (on the last logout)
auth forwards the AUTHTOK object as part of the PAM data (if necessary)
password rewarps the login protector (if necessary)
The basic plan is to keep the auth and password types in the pam modules (with modifications), while doing all the stuff we do in session in [email protected].
@ebiggers, @tyhicks: I'd love your feedback on the basic idea (and if it would improve things).
@fancytenseletters, @Minecrell, @sebadoom: This should (hopefully) fix some of the bugs you've reported.
Justification
Bugs #66, #77, #93, #196 (#57 and #34 are also related) seem to be bugs around what order certain operations run in. Ideally, we want all of our setup to happen before any user task starts. Similarly, all our teardown should occur after all user tasks complete. To do this well, we need to integrate with the OS's init service. This is because the init service:
knows when the first session of a user begins
knows when the last session ends
allows us to run fscrypt commands at specific points to prevent things from breaking
eCryptfs has been running into issues with systemd and automatic mounting via PAM modules. See: Arch Bug, Debian Bug, Ubuntu Bug, systemd Bug. pam_mount.so, which can do similar stuff for device encryption, has also had issues.
Details
This change would require changing or adding three things.
For auth, if the user has a login protector, use the passphrase to unlock the login protector, and store it in the root user keyring (with type user). We could also prompt the user here to enter their old login password if things have gotten out of sync.
For password, if we find a login protector, use the passphrase hashes of AUTHTOK and OLDAUTHTOK to update the login protector to update the login protector
Add new commands to fscrypt that must be run as root:
fscrypt system start <uid> --unlock=[none|login] [--link-to-root]
--unlock adds policies to the user's keyring
login gets the login protector key from the root user keyring and uses it to unlock the corresponding policies
--link-root-keyring makes sure the user keyring is linked into the root user keyring
fscrypt system stop <uid> --lock=[none|login|all] [--drop-caches] [--unlink-from-root]
--lock removes policies from the user's keyring:
login removes just those protected by the login passphrase
Right now, both automatic unlocking of directories and rewrapping of the user's login protector are done though the PAM module
pam_fscrypt.so. Specifically the following PAM types do the following things:sessionauthforwards theAUTHTOKobject as part of the PAM data (if necessary)passwordrewarps the login protector (if necessary)The basic plan is to keep the
authandpasswordtypes in the pam modules (with modifications), while doing all the stuff we do insessionin[email protected].@ebiggers, @tyhicks: I'd love your feedback on the basic idea (and if it would improve things).
@fancytenseletters, @Minecrell, @sebadoom: This should (hopefully) fix some of the bugs you've reported.
Justification
Bugs #66, #77, #93, #196 (#57 and #34 are also related) seem to be bugs around what order certain operations run in. Ideally, we want all of our setup to happen before any user task starts. Similarly, all our teardown should occur after all user tasks complete. To do this well, we need to integrate with the OS's init service. This is because the init service:
eCryptfs has been running into issues with systemd and automatic mounting via PAM modules. See: Arch Bug, Debian Bug, Ubuntu Bug, systemd Bug.
pam_mount.so, which can do similar stuff for device encryption, has also had issues.Details
This change would require changing or adding three things.
Remove functionality from
pam_fscrypt.sosessionhooks, keyring linking code, caches code, etc..auth, if the user has a login protector, use the passphrase to unlock the login protector, and store it in the root user keyring (with typeuser). We could also prompt the user here to enter their old login password if things have gotten out of sync.password, if we find a login protector, use the passphrase hashes ofAUTHTOKandOLDAUTHTOKto update the login protector to update the login protectorAdd new commands to fscrypt that must be run as root:
fscrypt system start <uid> --unlock=[none|login] [--link-to-root]--unlockadds policies to the user's keyringlogingets the login protector key from the root user keyring and uses it to unlock the corresponding policies--link-root-keyringmakes sure the user keyring is linked into the root user keyringfscrypt system stop <uid> --lock=[none|login|all] [--drop-caches] [--unlink-from-root]--lockremoves policies from the user's keyring:loginremoves just those protected by the login passphraseallremoves all policies in the user's keyring--drop-cachescallsDropFilesystemCacheafter all keys are removed--unlink-from-rootremoves the user keyring from the root user keyringAdd a systemd service to trigger the appropriate commands. For example:
Benefits
fscrypt system [start|stop] <uid>.