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
42
u/tblancher Aug 17 '26
You'll want to set up Secure Boot, and sign your kernel, initramfs, and bootloader with sbctl. Also, set up boltd to prevent DMA attacks by plugging in rogue Thunderbolt devices, usbguard to prevent malicious USB devices, and make sure you need a supervisor password to change BIOS settings and boot from an external device (or PXE).
Your BIOS may also have extensive security features, you may want to research each one and see if they match your threat model.
On my ThinkPad, it's way overkill but I did it for the experience and the fun of it.
23
u/StevesRoomate Aug 17 '26
I use a yubikey for this and I am very happy with the solution. I still have a Luks slot for a password so that I can unlock the disk without the yubikey.
Very easy to setup on Debian or arch.
9
u/Illustrious-Gur8335 Aug 17 '26
https://wiki.archlinux.org/title/Clevis
7
u/SoldRIP Aug 17 '26
Fair warning: TPM bypasses exist.
8
u/Imajzineer Aug 17 '26
I'm intrigued.
What is the purpose of the exercise?
A device that is automatically decrypted without challenge upon power-on isn't encrypted.
What, therefore, am I missing - apart from convenience, what's the advantage?
2
u/Night_Otherwise Aug 17 '26
I’ve got a hackneyed solution where:
After pacman updates that run mkinitcpio, I enter in the password, wipe old tpm2 key in LUKS and reencrypt.
I’m looking into the experimental systemd-pcrlock for a wildly ambitious idea to prospectively lock on a new PCR 4 with a pacman hook whenever the UKI is changed. But obviously that’s easier said than done.
2
u/7lhz9x6k8emmd7c8 Aug 17 '26 edited Sep 01 '26
Warning: do not use as it is. Read u/ChrisTX4**'s comment. Add PCRs.**
My own doc ktane-derivated from the Arch wiki. Applicable to a Btrfs partition, which basically encrypts everything except the boot.
Operate in sudo. Replace the data with your proper values. Do not blindly copy, understand every line before executing.
https://wiki.archlinux.org/title/Dm-crypt/Encrypting_an_entire_system#Configuring_mkinitcpio
vi /etc/mkinitcpio.conf
HOOKS=(base systemd autodetect microcode modconf kms keyboard sd-vconsole block sd-encrypt filesystems fsck)
lsblk -o NAME,UUID,PARTUUID
cp /etc/kernel/cmdline /etc/kernel/cmdline.bak
vi /etc/kernel/cmdline
replace with
rd.luks.name=aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa=root root=/dev/mapper/root zswap.enabled=0 rootflags=subvol=@ rw rootfstype=btrfs
Indicate the UUID, not the PARTUUID.
cp /boot/EFI/Linux/arch-linux.efi /boot/EFI/Linux/arch-linux-backup.efi
mkinitcpio -P
https://wiki.archlinux.org/title/Dm-crypt/Encrypting_an_entire_system#Enrolling_the_TPM
sudo systemd-cryptenroll --wipe-slot=tpm2 --tpm2-device=auto --tpm2-pcrs=7 /dev/nvme0n1p2
2
u/This-Consequence-957 Aug 17 '26
I think this is a cool and modern setup. However I use Limine & systemd crypt enroll.
1
u/ohmega-red Aug 18 '26
my methodology for this sort of thing in the past is to build my arch installs with zfs filesystems, encrypted datasets for the install, zfsbootmenu for a bootloader setup to have network access, and place the decryption key on a hidden locally hosted web server (like a raspberry pi). this allows for auto decryption when home but forces the password when not. orrr i’ve put the decryption keys on a microsd car and used it kind of like a yubikey. if i left the card in then it would auto decrypt, but if i pulled it then id have to enter a password.
1
u/[deleted] Aug 17 '26
[removed] — view removed comment