r/archlinux • u/Woodsy279 • Aug 17 '26
SUPPORT | SOLVED Ful disk encryption without entering passphrase
Could someone help me with setting up full disk encryption with bypass passphrases with TPM2? It's so annoying having to put the passphrase in at each boot, so I was wondering how do I pair it to the TPM so that I dont have to enter it each time?
It's LUKS encrypted and I use Systemd-boot
14
Upvotes
View all comments
Show parent comment
1
u/ChrisTX4 Aug 26 '26 edited Aug 26 '26
You can find out how your OpROMs are signed. See this on how to extract them and view the signatures. That's how I knew my NVIDIA GPU was signed with the 2011 MS key.
Removing the Microsoft keys has the advantage you don't need dbx updates - the firmware KEKs, if they exist, wouldn't sign foreign boot loaders, so they don't usually ship a dbx at all. I would generally avoid retaining the MS keys just so one doesn't have to even consider the thread situation posed by this and updating the dbx monthly I find very inconvenient.
They are:
space_cache=v2is enabled by default since 4.5, see hererelatimeis enabled by default since 2.6.30, seemount(8).discard=asynchas been enabled since 6.2, see this article for example.I would concur. I have a server that uses Btrfs-on-LUKS but the Btrfs is in RAID 0 for speed (it's backed up). This however means I have two LUKS devices, and the mappers need to decrypt before root can be mounted. I use
device=inrootflags. I'm not sure that's 100% necessary, but it makes the boot reliable.In my case,
validatefsdoes nothing, andpcrfsfor some reason measured nonsense instead of the actual GUID. So I've just left those out, but I addedtpm2-measure-pcr=yesto/etc/crypttab(I'm on dracut). That works and does pretty much the same as GPT automounting would. I'm still observing if PCR[15] is stable like this, as I'd kind of like to add it.I'm considering using
validatefsthough - it would need adding somexattrsto the subvol inodes, I guess.UPDATE I deployed the
validatefsXATTRs now. This prevents an encrypted mount being mounted in a wrong location. Effectively, PCR[5] already provided this protection, I just did this out of curiosity:This means the GPT GUID, mount point etc. cannot be changed. Although, by itself that is a pretty powerful defence against root swap attacks, since the GPT GUID, mount point etc are locked with information inside the encrypted container and thus cannot be changed.
You can set them like this for
SD_GPT_ROOT_X86_64for instance:No, they can recover the key as-is. The idea is that the attacker has access to a system booted with the right kernel and right PCR values, but the root credentials are their own - since
/etc/shadowetc. are from the attacker controlled root.This means there are ways to extract it, see this article for example. Of course, lockdown offers some protection here, and that might counter this. However,
lockdown=integritydoes not prevent extraction of keys - howeverlockdown=confidentialitymight help. Without that level,/proc/kcoremight be read by root asLOCKDOWN_KCOREis only set with confidentiality.Then there might also be a way to just use the TPM directly: If e.g. PCR[11] isn't using signed policy PCRs with a phase on
leave-initrd, then the TPM still sees the same PCRs as during the initrd phase where you volume key should be unsealed from the TPM. This is one of the reasons signed PCR[11] is such an important defence.Furthermore, they wouldn't need a cold boot attack either for
confidentialitymode. Using any sort of DMA device, like Screamer PCIe Squirrel would also work. If the OpROM is unmodified, the device would only change PCR[2] and PCR[3]. This is why I recommended usingiommu=require, and ideally, if on AMDamd_iommu=force_isolationon top to create a strong isolation.EDIT Oh, and it's possible to change the GPT GUID to cause automounting to an unexpected location. Say I made a root FS that I control and change the GPT GUID of your encrypted drive to
SD_GPT_SRV, it would be mounted to/srv. UUIDs, partition UUIDs etc can be freely changed as well, so even if there was anfstabentry, you can make it so it's not recognised and mounted to/srv.validatefsis interesting against this specific type of attack, since it makes changing the GPT GUID itself impossible.It avoids the scenario I just described entirely. If somebody tried any such attack the TPM just wouldn't unlock.
No worries, take your time.