Source-only C-port and extended fork of Debian cryptsetup-nuke-password.
Configure a special "nuke password" entered at the usual boot passphrase prompt to destroy LUKS keys on the prompted volume (plus optional auto-nuke timer for still-locked crypttab volumes).
- Full LUKS header shred on nuke password (as opposed to keyslot erase only)
- Optional auto-nuke timer (
/etc/cryptsetup-nuke-ng/timeout_minutes) - Detached LUKS2 headers (
header=in crypttab)
Dependencies: libcryptsetup-dev, libcrypt-dev, shunit2 (tests).
make
make check # optionalsudo make installThis installs the binary, initramfs hook, replaces /lib/cryptsetup/askpass
(stock askpass saved as /lib/cryptsetup/askpass.cryptsetup), and writes
/etc/cryptsetup-nuke-ng/askpass.real.
Remove with sudo make uninstall (keeps /etc/cryptsetup-nuke-ng/ config).
sudo scripts/configureOr manually:
sudo install -d -m 700 /etc/cryptsetup-nuke-ng
read -rs pass
echo -n "$pass" | cryptsetup-nuke-ng --generate | sudo tee /etc/cryptsetup-nuke-ng/password_hash >/dev/null
sudo chmod 600 /etc/cryptsetup-nuke-ng/password_hash
echo 15 | sudo tee /etc/cryptsetup-nuke-ng/timeout_minutes # optional; 0 = off
sudo update-initramfs -u -k all- The nuke password hash is copied into the initramfs. Treat it like a password hash on disk: use a strong, unique nuke passphrase (SHA-512
crypt(3)is used by default). - Password comparison uses
crypt(3)and is not fully timing-safe. This is generally acceptable for a duress/nuke password entered at boot. - If header backup fails, keyslots are still destroyed; header overwrite may be skipped with a warning logged.
- The auto-nuke timer keeps waiting when the crypttab is missing, empty, or unreadable, and attempts destruction when the deadline expires.
NUKE_ALLOW_MOCKandNUKE_ALLOW_ENV_OVERRIDEare for testing only; do not set them in production initramfs.- Multi-volume: The
nukedmarker is global; destroying any one volume stops the auto-nuke timer for all crypttab entries. - Concurrent destroy: Destroying the same device from the timer and askpass at once is serialized via
flock(2)on a per-device lock file under the run directory; different volumes are unaffected.
GPL-3.0-or-later. See LICENSE.