Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pam_fscrypt: eliminate unnecessary options and improve documentation #281

Merged
merged 4 commits into from
Mar 9, 2021
Merged

pam_fscrypt: eliminate unnecessary options and improve documentation #281

merged 4 commits into from
Mar 9, 2021

Conversation

ebiggers
Copy link
Collaborator

@ebiggers ebiggers commented Mar 3, 2021

  • Make pam_fscrypt decide automatically whether dropping caches is needed, so that the "drop_caches" option is no longer needed.
  • Make pam_fscrypt lock directories by default, so that the "lock_policies" option is no longer needed. As there is a chance that a small number of users might want the previous default behavior of unlock-only, add an option "unlock_only" to get that behavior.
  • Fix some things in the README related to pam_fscrypt.

Copy link
Member

@josephlr josephlr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good. Thanks for simplifying things!

One question, if we're already changing the functionality of the PAM module, do we even need an unlock_only flag? Personally, I don't really see the need for such a flag. Looking at #25 I didn't gave a rationale for why we shouldn't always relock a directory.

I think originally we were considering the case where two users shared a directory and it was protected by both their login passphrases. But I don't think that should be an issue now. With V2 policies, both users can provision and deprovision the same fscrypt key without any issues.

So unless there's a compelling reason to keep the old functionality, I say we just get rid of it.

@ebiggers
Copy link
Collaborator Author

ebiggers commented Mar 8, 2021

This looks really good. Thanks for simplifying things!

One question, if we're already changing the functionality of the PAM module, do we even need an unlock_only flag? Personally, I don't really see the need for such a flag. Looking at #25 I didn't gave a rationale for why we shouldn't always relock a directory.

I think originally we were considering the case where two users shared a directory and it was protected by both their login passphrases. But I don't think that should be an issue now. With V2 policies, both users can provision and deprovision the same fscrypt key without any issues.

So unless there's a compelling reason to keep the old functionality, I say we just get rid of it.

I intended the unlock_only option as an "escape hatch" in case anyone really wants the old default behavior. There might be some edge cases where someone wouldn't want pam_fscrypt to lock their directories. For example, someone might have a directory with a login protector and expect to be able to manually unlock it, then have it stay unlocked regardless of any log-in and log-out from that user. For v2 encryption policies, that will work if root does the initial unlock, but not if the initial unlock is done as that user (e.g. in a shell in which root has run sudo $user) -- since there is no reference counting for how many times each user has added the key.

It's unlikely though, and v2 encryption policies made things work better. So I think you're right that for simplicity we just shouldn't add the option, unless someone asks for it.

ebiggers added 4 commits March 8, 2021 15:20
Configuring whether pam_fscrypt drops caches or not isn't really
something the user should have to do, and it's also irrelevant for v2
encryption policies (the default on newer systems).  It's better to have
pam_fscrypt automatically decide whether it needs to drop caches or not.

Do this by making pam_fscrypt check whether any encryption policy keys
are being removed from a user keyring (rather than from a filesystem
keyring).  If so, it drops caches; otherwise it doesn't.  This
supersedes the "drop_caches" option, which won't do anything anymore.
All pam_fscrypt configuration guides that I'm aware of say to use the
"lock_policies" option for the pam_fscrypt.so session hook.  The
Debian/Ubuntu pam-config-framework config file has it too.

Make locking the default behavior, since this is what everyone wants.

Existing configuration files that contain the "lock_policies" option
will continue to work, but that option won't do anything anymore.

(We could add an option "unlock_only" to restore the old default
behavior, but it's not clear that it would be useful.  So for
simplicity, leave it out for now.)
There are several mentions of pam_fscrypt handling unlocking
directories.  Make sure to mention locking alongside this.
Make some more corrections:

- pam-config-framework isn't actually Ubuntu-specific but actually
  applies to Debian and any Debian derivative.

- The pam-config-framework file is indeed installed by `make install`,
  just not into the correct location.

- On Debian (and Debian derivatives), the PAM configuration isn't
  actually part of the 'fscrypt' package but rather 'libpam-fscrypt'.

- Clarify where to add the pam_fscrypt.so session hook.
@ebiggers
Copy link
Collaborator Author

ebiggers commented Mar 8, 2021

Updated to not add the unlock_only option.

@plumbeo
Copy link

plumbeo commented Oct 12, 2022

Hello, I'm sorry if I'm late but I got bitten by the new behaviour only now that I upgraded to the latest Ubuntu LTS release.

My use case is quite simple, I'm using fscrypt on a machine that's partially headless and now that every directory gets locked after I logout from my SSH session I can't use screen/tmux for long running processes, nor I can run VMs.

Is having back the option to not lock everything at logout still possible, or is there any alternative to prevent locking when screen/tmux are running?

Thanks.

ebiggers added a commit that referenced this pull request Oct 18, 2022
Now that it's been requested by users, bring back the "unlock_only"
option, which was originally proposed as part of
#281 but was dropped in the final
version of that pull request.

Resolves #357
ebiggers added a commit that referenced this pull request Oct 19, 2022
Now that it's been requested by users, bring back the "unlock_only"
option, which was originally proposed as part of
#281 but was dropped in the final
version of that pull request.

Resolves #357
ebiggers added a commit that referenced this pull request Oct 20, 2022
Now that it's been requested by users, bring back the "unlock_only"
option, which was originally proposed as part of
#281 but was dropped in the final
version of that pull request.

Resolves #357
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants