-
Notifications
You must be signed in to change notification settings - Fork 21
mkdumprd: include tpm2-tss dracut module for encrypted storages #81
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
base: main
Are you sure you want to change the base?
Conversation
LUKS volumes can be automatically unlocked by TPM devices and this comes handy for kdump as there's no need to a manual action. This, however, doesn't work by default: systemd-cryptsetup[494]: Automatically discovered security TPM2 token unlocks volume. systemd-cryptsetup[494]: Could not find TPM2 device: Operation not supported systemd-cryptsetup[494]: TPM2 operation failed, falling back to traditional unlocking: Operation not supported The problem is that we need to have libcryptsetup-token-systemd-tpm2.so and the corresponding tools/libraries in the initramfs and this is done by 'tpm2-tss' module which is not in the default set. Include it when 'tpm2' tool (tpm2-tools package) is present. In theory, we can be smarter and try to detect 'systemd-tpm2' tokens with cryptsetup: # cryptsetup luksDump /dev/vda2 LUKS header information Version: 2 Epoch: 394 ... Tokens: 1: systemd-tpm2 tpm2-hash-pcrs: 7 tpm2-pcr-bank: sha256 but the risk is that tokens can change after kdump initramfs is created. For now, stick to a simpler but more robust solution. Signed-off-by: Vitaly Kuznetsov <[email protected]>
Reviewer's Guide by SourceryThis pull request adds the 'tpm2-tss' dracut module to the kdump initramfs when the 'tpm2-tools' package is present. This allows LUKS volumes to be automatically unlocked by TPM devices during kdump, avoiding the need for manual intervention. The change ensures that the necessary libraries and tools for TPM2 unlocking are included in the initramfs. No diagrams generated as the changes look simple and do not need a visual representation. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @vittyvk - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding a comment explaining why we check for the
tpm2tool instead of thetpm2-tsspackage directly.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
Hi @vittyvk , Do you have an agenda to support this case in RHEL? If we can wait, I'll prefer a more general solution [PATCH v9 0/8] Support kdump with LUKS encryption by reusing LUKS volume keys. Currently the patch set has been pulled into Andrew Morton's nm-everything tree and there is a good chance it will be pulled into Linus's tree. |
|
Hey @coiby , yes, 'reusing LUKS keys' is a much more interesting feature indeed :-) Here, however, we may be solving one additional use-case: imagine we want to dump to a LUKS device which is not actually used in the main system (e.g. a special dedicated device for dumps) which can be unlocked with TPM. Then, we can't pass LUKS key to it from the main kernel as it doesn't have it. I'm not sure if it is so important though. |
|
Thanks for proposing another scenario! Unfortunately, kdumpctl needs to unlock the device to check if disk space will be available for vmcore dumping. However it doesn't know how to unlock a LUKS device. If we want to support this additional case, we will need to add these code as well. Otherwise, kdumpctl will fail to build the initramfs, Btw, my work to support kdump with LUKS encryption by reusing LUKS volume keys has been merged into Linus's tree. While doing the corresponding user space part in kdump-utils and anaconda, I'll also evaluate the necessity of this PR. |
LUKS volumes can be automatically unlocked by TPM devices and this comes handy for kdump as there's no need to a manual action. This, however, doesn't work by default:
The problem is that we need to have libcryptsetup-token-systemd-tpm2.so and the corresponding tools/libraries in the initramfs and this is done by 'tpm2-tss' module which is not in the default set. Include it when 'tpm2' tool (tpm2-tools package) is present.
In theory, we can be smarter and try to detect 'systemd-tpm2' tokens with cryptsetup:
but the risk is that tokens can change after kdump initramfs is created. For now, stick to a simpler but more robust solution.