Score:0

Full disk encryption on CentOS 9 Stream with TPM2 decryption at boot time

cy flag

I'm working on provisioning a server that requires full drive encryption and I want to automate the process of decrypting the drive at startup using the TPM2 module available on the motherboard, but I can't quite get the system to do so. I have a fresh install of CentOS 9 Stream that was created uing automated LVM partitioning of the only available drive, and it was encrypted as a LUKSv2.

After the installation of the OS, I made sure that clevis, clevis-luks, and dracut were installed. I also installed clevis-systemd and clevis-udisks2 just in case.

At this stage, running tpm2_pcrread reported the expected registers.

Then I binded the drive to clevis using the following command:

sudo clevis luks bind -d /dev/<drive> tmp2 '{"pcr_bank":"sha256","pcr_ids":"0,1,7"}'

No issue so far.

I then created a dracut config named tpm2.conf in /etc/dracut.config.d/ with:

add_dracutmodules+=" clevis clevis-pin-tpm2 crypt tpm2-tss "
install_items+=" /usr/bin/clevis "
hostonly="yes"

Then ran:

sudo dracut -f

At this stage, I thought that was all I needed, but it seems like it wasn't enough.

I then tried to boot with the grub options rd.luks.options=<luks-UUID>=tpm2-device=auto but that did nothing.

Any idea of what could be the issue?

Thank you

Score:0
cn flag

according to the documentation, no file in /etc/dracut.config.d/ is necessary. Try removing that file you created and regenerating the initramfs with dracut -f --regenerate-all.

If after doing that and rebooting it still does not work automatically decrypt the container (sometimes you need to be a bit patient, wait some time before entering the passphrase), then please post the output of both lsblk and of clevis luks list -d /dev/yourblockdevice you bound to the tpm2 chip.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.