pam_zfs_key: support keyfile for filesystem mount in sm_open_session #11247
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
pam_zfs_key: support keyfile for filesystem mount in sm_open_session
Use pam's pw_get to decrypt the filesystem if 'keylocation=prompt',
otherwise use zfs_crypto_load_key to verify and parse the keylocation
in order to get the key loaded.
If the authentication token is being changed for a user, the dataset in
relation to that user will do password change conditionally.
Only conditionally do if 'keylocation=prompt' already in use or argv
convKeyPrompt has been set. Thr former one will get the dataset updated
naturally without the need of convKeyPrompt.
The latter one, convKeyPrompt, does change keyformat and keylocation to
passphrase and prompt respectively even the original key is a file.
Signed-off-by: Crag Wang [email protected]
Motivation and Context
Support keyfile to mount a filesystem when user session opens up.
Description
decrypt_mount()
intopam_sm_open_session
's bodyprompt
in use from the encrypted datasetpw_get()
ifprompt
in use from the encrypted dataset, for the others usezfs_crypto_load_key()
How Has This Been Tested?
Compiled successfully on top of
04a82e
, deployed onto Ubuntu 20.04 for testing throughssh
,su
and graphical login . The encrypted dataset corresponding to the user can be mounted successfully, the key worked from not onlypassphrase
frompw_get()
but alsokeyfile
.Tests for
convKeyPrompt
:Types of changes
Checklist:
Signed-off-by
.