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

Allow using multiple "contexts" for LUKS #1354

Merged

Conversation

vojtechtrefny
Copy link
Member

Currently only one passphrase and one key file can be specified when creating new LUKS, this change allows specifying multiple different "contexts" for when creating a new or unlocking an existing LUKS device. For now only passphrase and key file contexts are supported, but this change will also allow adding support for new types of contexts (kernel keyring, TPM etc.) in the future.

The change is made to be backwards compatible so "passphrase" can still be specified for the LUKS format, it will just internally create a new passphrase context so no changes are needed for existing code.

Currently one passphrase and one key file can be specified when
creating or managing LUKS devices. This means a second passphrase
can be added only manually after creating the LUKS format. This
change add support for specifying multiple "key slot contexts"
for the LUKS format. This will also allow using some more advanced
"contexts" for LUKS in the future, like referencing keys saved in
the kernel keyring or creating LUKS devices protected with TPM.

The original API for setting passphrase and key file will not be
removed, but it internally uses the new "context" API.
This is for backward compatibility, Anaconda sets passphrase to
None to remove passphrases that don't work.
add_password and remove_password are kept for backwards
compatibility, add_key and remove_key which work with contexts
should be prefered.
This way we can protect it from being overwritten and also
document its usage better.
@vojtechtrefny vojtechtrefny marked this pull request as draft March 21, 2025 13:24
@vojtechtrefny vojtechtrefny marked this pull request as ready for review March 25, 2025 11:53
@vojtechtrefny
Copy link
Member Author

Marking as ready for review. The anaconda tests are now passing and I also run some luks kickstart tests which also passed.

@vojtechtrefny vojtechtrefny merged commit ef1c6ec into storaged-project:main Mar 26, 2025
13 of 15 checks passed
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.

1 participant