Skip to content

zungur/cryptsetup-nuke-ng

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cryptsetup-nuke-ng

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).

Features

  • 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)

Build

Dependencies: libcryptsetup-dev, libcrypt-dev, shunit2 (tests).

make
make check    # optional

Install

sudo make install

This 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).

Configure

sudo scripts/configure

Or 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

Security notes

  • 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_MOCK and NUKE_ALLOW_ENV_OVERRIDE are for testing only; do not set them in production initramfs.
  • Multi-volume: The nuked marker 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.

License

GPL-3.0-or-later. See LICENSE.

About

Duress/nuke password for LUKS at boot, with full header shred and optional timeout.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages