Automated disk encryption: TPM2, Clevis/Tang & FIDO2
In modern data centers, edge computing, and enterprise fleets, manual passphrase entry at boot is operationally infeasible. Linux provides native cryptographic mechanisms to automate the unlocking of LUKS2 encrypted volumes using hardware security modules (TPM 2.0), network key escrow (Clevis & Tang), or physical FIDO2 / YubiKey tokens.
Automated unlock architectural models
| Method | Underlying Mechanism | Primary Deployment Use Case | Theft Protection Level |
|---|---|---|---|
| TPM 2.0 Sealed Keys | systemd-cryptenroll / tpm2-tss binding to PCR 0+2+7 | Laptops, edge gateways, single physical servers with Secure Boot. | Protects against stolen drive removed from chassis; requires physical motherboard. |
| Network-Bound (NBDE) | Clevis client contacting Tang server over LAN | Headless data center hypervisors, cloud nodes, clustered SAN servers. | Protects against theft of entire physical chassis outside corporate facility. |
| FIDO2 / YubiKey | FIDO2 HMAC-secret extension via user-present touch | High-security developer workstations and mobile engineering laptops. | Requires physical hardware key presence and user interaction. |
1. TPM 2.0 binding via systemd-cryptenroll
Modern Linux distributions with systemd 248+ include systemd-cryptenroll, allowing direct enrollment of TPM2 chips into LUKS2 token metadata without third-party daemons.
Enrollment workflow
# 1. Verify TPM2 device presence
systemd-cryptenroll --tpm2-device=list
# 2. Enroll TPM2 into a LUKS2 keyslot bound to PCR 0 (firmware), 2 (Option ROM code), and 7 (Secure Boot)
sudo systemd-cryptenroll \
--tpm2-device=auto \
--tpm2-pcrs=0+2+7 \
/dev/nvme0n1p3
# 3. View the updated LUKS2 header token slots
cryptsetup luksDump /dev/nvme0n1p3Configuring persistent boot unlock (/etc/crypttab)
# Add tpm2-device=auto option in /etc/crypttab
# <target_name> <source_device> <keyfile> <options>
secure_root UUID=6b3e1f00-2495-4720-9492-7489ab8a8341 none tpm2-device=auto,discard,luks2. Network-Bound Disk Encryption (Clevis & Tang)
NBDE decouples the encryption key between the client and a trusted network server using the Tang protocol (HTTP-based cryptographic key exchange based on McCallum-Relyea exchange).
1. Set up the Tang server (Key Escrow Host)
# Install and start Tang daemon on internal infrastructure server (e.g. 10.0.0.50)
sudo apt install tang # or dnf install tang
sudo systemctl enable --now tangd.socket
# Display Tang server thumbprint
tang-show-keys 802. Bind LUKS volume to Tang server using Clevis
# Install Clevis client tools
sudo apt install clevis clevis-luks clevis-systemd clevis-initramfs
# Bind volume to Tang server
sudo clevis luks bind -d /dev/nvme0n1p3 tang '{"url":"http://10.0.0.50", "thp":"TANG_THUMBPRINT_HASH"}'
# Verify enrolled Clevis JWE pins
clevis luks list -d /dev/nvme0n1p33. Early boot networking in initramfs
For root filesystem decryption over the network, the initramfs must obtain a DHCP IP address before mounting root:
# Add kernel boot argument in GRUB / systemd-boot:
# ip=dhcp rd.neednet=1
# Rebuild initramfs with Clevis networking hooks
sudo dracut -f --add "clevis network"
# or on Debian/Ubuntu:
sudo update-initramfs -u3. FIDO2 / YubiKey hardware token enrollment
To require a physical FIDO2 security key tap to unlock storage:
# Enroll FIDO2 key with user-presence verification
sudo systemd-cryptenroll --fido2-device=auto /dev/nvme0n1p3
# Update /etc/crypttab with fido2-device=auto
# secure_data UUID=... none fido2-device=auto,discard,luksKey rotation & emergency recovery
Never delete all passphrase slots. Hardware changes, firmware upgrades, or switch reconfigurations will lock TPM2 and Tang bindings. Retain at least one emergency recovery passphrase in keyslot 0.
# Remove old TPM2 binding before a motherboard or BIOS update
sudo systemd-cryptenroll --wipe-slot=tpm2 /dev/nvme0n1p3
# Re-enroll after update completes
sudo systemd-cryptenroll --tpm2-device=auto --tpm2-pcrs=0+2+7 /dev/nvme0n1p3Frequently asked questions
What are TPM2 PCRs and which registers should be bound?
Platform Configuration Registers (PCRs) record cryptographic hashes of each boot stage. Recommended registers for disk binding are PCR 0 (Core UEFI firmware code), PCR 2 (Option ROM code from adapter cards), and PCR 7 (Secure Boot policy and certificate database state). If firmware or Secure Boot is tampered with, the TPM2 refuses to unseal the LUKS decryption key.
What is Network-Bound Disk Encryption (NBDE) with Clevis and Tang?
NBDE allows headless enterprise servers in a data center to unlock their encrypted LUKS drives automatically upon booting, provided they are connected to the trusted internal corporate network. The server runs the Clevis client to fetch cryptographic key shares from a Tang server. If a drive is stolen or removed from the data center network, it cannot unlock.
Can you combine TPM2 and Network (Tang) unlocking using Shamir's Secret Sharing?
Yes. Clevis provides the sss (Shamir's Secret Sharing) pin, allowing multi-factor decryption policies like (TPM2 AND Tang) or (TPM2 OR Tang). This requires both the physical server hardware and physical data center network connection to decrypt.
What happens if a UEFI BIOS update changes the PCR hashes?
A firmware update will alter PCR 0 and PCR 2 hashes, preventing the TPM2 chip from unsealing the volume key. Always maintain a human passphrase in a separate LUKS keyslot as an emergency recovery fallback, then re-enroll the TPM2 after updating firmware.