Implement full-disk encryption with unattended reboots on Linux dedicated servers using LUKS2 for AES-XTS storage encryption and Tang/Clevis for Network-Bound Disk Encryption (NBDE). On boot, Clevis queries a trusted Tang server over an isolated private network to derive the decryption key automatically. This protects retired or stolen NVMe drives without requiring manual IPMI passphrase entry after every reboot.
Quick Answer: LUKS2 Full-Disk Encryption with Tang & Clevis Auto-Unlock
Encrypting bare-metal NVMe drives with LUKS2 (AES-XTS-Plain64 + Argon2id) protects sensitive data against physical drive theft or RMA disposal, but normally stalls unattended reboots at an initramfs passphrase prompt. Binding a secondary LUKS2 keyslot to Clevis and a network-reachable Tang server (using McCallum-Relyea cryptographic key exchange) enables zero-touch reboots inside your private VLAN while keeping drives unreadable outside your datacenter.
Core Stack: Linux cryptsetup (LUKS2), clevis-luks + clevis-initramfs, redundant tangd servers over private VLAN/IPsec, and an emergency recovery passphrase slot.
Encrypting bare-metal NVMe drives with LUKS2 protects data during drive RMAs or rack decommissioning, yet manual passphrase prompts stall unattended reboots. Binding Clevis to a private Tang server automates initramfs decryption, provided network timing and recovery keyslots are configured safely. Learn how to deploy Tang, bind LUKS2, and test boot recovery.
Standard full-disk encryption halts server startups at initramfs until an engineer enters passphrases over IPMI.
Slow DHCP leases or unreachable Tang nodes prevent auto-unlock unless redundant servers and backup keyslots exist.
Inspect LUKS2 keyslot bindings, verify private VLAN Tang reachability, and retain an offline recovery passphrase.
1. Prerequisites: Partition Layout, AES-NI Hardware, and Network Topology
Network-Bound Disk Encryption relies on an unencrypted /boot (and EFI) partition loading the kernel, initramfs, and network drivers before the root filesystem is decrypted.
CPU AES-NI Offload, Argon2id RAM Sizing, and 4K Sector Alignment
Verify that your dedicated server CPU supports hardware aes instructions (AES-NI) and AVX2/AVX-512 so dm-crypt encryption does not bottleneck PCIe Gen4 NVMe throughput. On modern AMD EPYC and Intel Xeon processors, AES-NI encrypts at 10+ GB/s per core—far exceeding a single NVMe drive’s 3.5–7 GB/s ceiling. However, default dm-crypt kernel threads serialize I/O through workqueues unless explicitly bypassed; always append --perf-no_read_workqueue and --perf-no_write_workqueue (and --sector-size 4096 to match physical 4 KiB NVMe LBA sectors) when formatting high-IOPS database volumes.
Also size Argon2id key-derivation memory carefully during early boot. LUKS2 defaults to Argon2id with up to 1 GiB of RAM per keyslot unlock (--pbkdf-memory 1048576). On a storage server unlocking eight separate LUKS2 NVMe drives simultaneously inside a constrained initramfs environment, parallel Argon2id derivations can trigger an initramfs OOM panic if you have less than 16 GB RAM or leave systemd-cryptsetup unbounded. For multi-drive servers, cap Clevis or emergency passphrase KDF memory to 256–512 MiB (--pbkdf-memory 262144) while preserving a 2,000 ms iteration budget so boot unlocks complete reliably under 3 seconds.
Dedicated Tang Placement and Private VLANs
Never host the Tang server on the same physical machine it is unlocking, and avoid exposing Tang on the public internet. Deploy at least two lightweight Tang nodes (512 MB RAM and 1 vCPU each is plenty) on separate hardware or an out-of-band management VLAN—optionally bridged across sites via our strongSwan IPsec VTI tunnel guide—using Clevis Shamir Secret Sharing (SSS) with "t":1 for high availability or "t":2 across three nodes when dual-site quorum authorization is required.
2. Tang/Clevis NBDE vs. TPM 2.0 vs. Dropbear SSH Unlock Matrix
Before committing to NBDE, compare how Tang/Clevis stacks up against hardware TPM 2.0 auto-unlock and manual Dropbear SSH unlocking.
| Unlock Mechanism | Unattended Reboots | Protection Against Drive Theft | Operational Dependencies |
|---|---|---|---|
| Tang + Clevis (NBDE) | Yes (automatic on LAN/VLAN) | Strong (useless outside Tang network) | Requires initramfs network + reachable Tang |
| TPM 2.0 (PCR Sealing) | Yes (local hardware bound) | Strong against disk-only removal | BIOS/GRUB updates can trip PCRs |
| Dropbear SSH in Initramfs | No (blocks until admin SSHs in) | Maximum (key never stored anywhere) | Manual intervention on every reboot |
3. Step-by-Step Tang Server, LUKS2 Formatting, and Clevis Binding
First deploy the Tang key server on a separate trusted management host, then format or bind your target dedicated server’s LUKS2 volume with Clevis and rebuild the initramfs.
Step 1: Deploy Redundant Tang Servers on Your Management Host
Tang is stateless with respect to client disks—it only holds its own elliptic-curve signing and exchange keypair in /var/db/tang and never learns any client’s LUKS passphrase. Deploy at least two independent Tang servers (e.g., 10.20.0.10 and 10.20.0.11) and let each server generate its own unique keys rather than copying /var/db/tang between hosts. Independent keys ensure Clevis Shamir Secret Sharing (SSS) builds separate cryptographic shares per server, allowing you to rotate or decommission one Tang host without invalidating the entire fleet.
# On your management/Tang server (Ubuntu 24.04 / Debian 12)
sudo apt-get update && sudo apt-get install -y tang jose curl
# Change Tang socket listener port if needed (default 80; example uses 7500)
sudo mkdir -p /etc/systemd/system/tangd.socket.d
cat <<'EOF' | sudo tee /etc/systemd/system/tangd.socket.d/override.conf
[Socket]
ListenStream=
ListenStream=10.20.0.10:7500
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now tangd.socket
# Verify Tang key advertisement JSON
curl -s http://10.20.0.10:7500/adv | jq .
Step 2: Provision LUKS2 Volume and Bind Clevis to Tang
On the target dedicated server, format a data or root partition with LUKS2 (keeping Slot 0 as a high-entropy emergency recovery passphrase stored in your password vault), then bind Slot 1 to your Tang server using clevis luks bind.
# Install Clevis initramfs and LUKS integration on the client server
sudo apt-get update && sudo apt-get install -y cryptsetup clevis clevis-luks clevis-initramfs initramfs-tools
# Format an NVMe data partition with LUKS2, 4K sectors, and low-latency queue flags
sudo cryptsetup luksFormat --type luks2 \
--cipher aes-xts-plain64 --key-size 512 --hash sha256 \
--sector-size 4096 --pbkdf argon2id --pbkdf-memory 524288 \
/dev/nvme1n1p1
# Back up the raw LUKS2 header immediately to an external secure vault
sudo cryptsetup luksHeaderBackup /dev/nvme1n1p1 --header-backup-file /root/nvme1n1p1-luks2.hdr.bak
# Bind Clevis using SSS threshold=1 across two Tang servers for HA
sudo clevis luks bind -d /dev/nvme1n1p1 sss '{"t":1,"pins":{"tang":[{"url":"http://10.20.0.10:7500"},{"url":"http://10.20.0.11:7500"}]}}'
# Persist performance flags in /etc/crypttab using the device UUID
UUID=$(sudo blkid -s UUID -o value /dev/nvme1n1p1)
echo "nvme_data UUID=${UUID} none luks,discard,no-read-workqueue,no-write-workqueue,_netdev" | sudo tee -a /etc/crypttab
# Enable early-boot networking in initramfs and regenerate
echo "IP=dhcp" | sudo tee /etc/initramfs-tools/conf.d/network.conf
sudo update-initramfs -u -k all
sudo systemctl enable clevis-luks-askpass.path
Note the trade-off on discard in /etc/crypttab: enabling TRIM/discard preserves NVMe write endurance and steady-state IOPS, though it leaks which logical blocks are unallocated; for strict forensics compliance where zero metadata leakage outweighs SSD wear leveling, omit discard. If your datacenter requires static IP configuration rather than DHCP during initramfs boot, set IP=<client-ip>::<gateway>:<netmask>::eth0:off inside /etc/initramfs-tools/conf.d/network.conf so Clevis can reach Tang within two seconds of kernel handoff. You can automate this entire partition and Clevis bootstrap across fleets using our PXE and iPXE automated bare-metal OS provisioning guide.
4. Verifying LUKS2 Keyslots, Initramfs Networking, and Auto-Unlock
Before rebooting a remote production machine, verify that Clevis actually wrote its JWE metadata token into the LUKS2 header, that the initramfs contains the Clevis hooks, and that the NVMe crypto mapping operates with hardware AES-NI.
# 1. Inspect LUKS2 header, keyslots, and Clevis token
sudo cryptsetup luksDump /dev/nvme1n1p1
sudo clevis luks list -d /dev/nvme1n1p1
# 2. Confirm Clevis, curl, and NIC drivers are packed inside initramfs
lsinitramfs /boot/initrd.img-$(uname -r) | grep -E "clevis|tang|curl"
# 3. Verify AES-NI hardware acceleration, active workqueue bypass, and 4K sector alignment
grep -o "aes" /proc/cpuinfo | head -n 4
sudo dmsetup table --target crypt
sudo cryptsetup status nvme_data
cryptsetup benchmark --cipher aes-xts --key-size 512
In dmsetup table --target crypt output, confirm no_read_workqueue and no_write_workqueue appear alongside sector_size:4096. Check physical NVMe sector geometry with sudo blockdev --getpbsz /dev/nvme1n1p1 so the LUKS2 4K sector size matches your drive’s native physical block boundary without read-modify-write amplification. On modern AMD EPYC or Intel Xeon CPUs with AES-NI, cryptsetup benchmark should report 4,000–8,000+ MB/s single-thread AES-XTS-512 throughput—confirming CPU encryption will never throttle PCIe Gen4 storage. Before scheduling an unattended reboot on a production box, test the Tang exchange directly from userspace using echo '{"ping":true}' | clevis encrypt tang '{"url":"http://10.20.0.10:7500"}' | clevis decrypt to confirm end-to-end JWE key derivation succeeds without firewall drops.
5. Securing Tang Endpoints, Key Rotation, and NVMe Performance
Because Tang responds to unauthenticated HTTP requests over your internal network, network segmentation, cryptographic auditability, and periodic key rotation are essential to maintain security posture.
Restricting Tang Access to Authorized Datacenter Subnets
Bind tangd.socket strictly to your private management or storage VLAN IP and enforce an nftables allowlist permitting only the IP addresses of your managed dedicated servers to reach port 7500. Never expose Tang on a public WAN interface, and monitor tangd connection logs so any unauthorized host probing /adv triggers an immediate SIEM alert:
# On Tang server: restrict port 7500 strictly to authorized VLAN subnet on eth1
sudo nft add table inet tang_guard
sudo nft add chain inet tang_guard input '{ type filter hook input priority 0; policy accept; }'
sudo nft add rule inet tang_guard input iifname "eth1" ip saddr 10.20.0.0/24 tcp dport 7500 accept
sudo nft add rule inet tang_guard input tcp dport 7500 counter drop
Rotating Tang Keys Without Breaking Existing Clients
To rotate Tang keys without locking out servers mid-cycle, generate a new keypair in /var/db/tang, rename the old keys with a leading dot (e.g., .oldkey.jwk) so Tang stops advertising them to new bindings while still honoring existing client decryption requests, re-run clevis luks regen on all clients, and only then delete the hidden old keys:
# On Tang server: generate new signing + exchange keys and hide old keys
sudo /usr/libexec/tangd-keygen /var/db/tang
cd /var/db/tang && sudo mv OLD_SIGN.jwk .OLD_SIGN.jwk && sudo mv OLD_EXCH.jwk .OLD_EXCH.jwk
# On each client server: refresh Slot 1 JWE metadata against new Tang keys
sudo clevis luks regen -d /dev/nvme1n1p1 -s 1
6. Troubleshooting Initramfs DHCP Delays, Tang Outages, and Rollbacks
If a server hangs during early boot, the issue is almost always an initramfs network interface mismatch, switch Spanning Tree (STP) port-blocking delay, or an unreachable Tang IP.
Diagnosing Auto-Unlock Failures
- Boot Stalls at “Waiting for encrypted source device”: The initramfs either lacked the NIC kernel module (e.g., Mellanox
mlx5_coreor Intelice) or DHCP timed out before the switch port finished Spanning Tree forwarding. Enable PortFast/EdgePort on your switch, switch to staticIP=in/etc/initramfs-tools/conf.d/network.conf, and verify the NIC driver name in/etc/initramfs-tools/modules. - Both Tang Servers Unreachable During Maintenance: Clevis falls back cleanly to the interactive LUKS2 passphrase prompt on the console. Log into your IPMI/iKVM console and enter the Slot 0 recovery passphrase from your vault.
- Initramfs OOM Panic on Multi-Drive Servers: Unlocking four or more 1 GiB Argon2id keyslots in parallel exhausts early-boot RAM. Lower PBKDF memory to
262144KiB withcryptsetup luksConvertKey --pbkdf-memory 262144and regenerate initramfs. - High CPU Load During Heavy NVMe Writes: Add
no-read-workqueue,no-write-workqueueoptions to/etc/crypttaband runupdate-initramfs -uto cut dm-crypt latency on fast PCIe Gen4 SSDs.
Removing Clevis Binding and Restoring LUKS2 Headers Safely
If you decommission Tang or move a server to a different network segment, unbind the Clevis keyslot cleanly while keeping your Slot 0 passphrase intact, and verify Slot 0 works before deleting backups. If a metadata edit ever corrupts a keyslot, restore your pre-change LUKS2 header backup immediately.
# List bound slot ID (e.g., slot 1) and unbind without touching slot 0
sudo clevis luks list -d /dev/nvme1n1p1
sudo clevis luks unbind -d /dev/nvme1n1p1 -s 1
# Verify Slot 0 recovery passphrase still unlocks cleanly (dry run)
sudo cryptsetup open --test-passphrase /dev/nvme1n1p1
# Emergency header restore if keyslot metadata was damaged
# sudo cryptsetup luksHeaderRestore /dev/nvme1n1p1 --header-backup-file /root/nvme1n1p1-luks2.hdr.bak
Frequently Asked Questions
Does Tang store my server’s LUKS2 encryption keys?
No. Tang uses the McCallum-Relyea elliptic-curve exchange protocol so the client derives its unlocking key locally without ever sending the LUKS passphrase or volume key to the Tang server.
What happens if a drive with LUKS2 + Clevis is stolen from the datacenter?
Without network access to your private Tang server (or your offline Slot 0 recovery passphrase), the encrypted NVMe drive cannot be unlocked and all data remains cryptographically unreadable.
Can I use Shamir Secret Sharing (SSS) with multiple Tang servers?
Yes. Configuring "t":1 across two or more Tang servers allows auto-unlock if any single Tang node is online, while "t":2 requires two independent Tang nodes to agree before decryption succeeds.
How much performance does LUKS2 AES-XTS cost on modern NVMe SSDs?
With hardware AES-NI and no-read-workqueue,no-write-workqueue enabled, LUKS2 typically adds less than 5% CPU overhead and under 20 microseconds of I/O latency.
Does Clevis auto-unlock survive Linux kernel upgrades automatically?
Yes, once clevis-initramfs is installed, Debian and Ubuntu APT kernel hooks automatically embed the Clevis scripts and network configuration into every newly built initrd.img. Still verify with lsinitramfs after major OS upgrades.
Encrypt Bare-Metal NVMe Storage Without Reboot Friction
Protect regulated workloads on dedicated Linux servers with AES-NI hardware acceleration, private VLAN networking for Tang NBDE, and out-of-band IPMI recovery access.
