Skip to content

⚙ darkone.system.yubikey

YubiKey strong authentication: fleet-wide PAM U2F + declarative FIDO2 LUKS.

One physical enrollment per (user, key) on the admin host — just yubikey <user> [key] [action] — feeds:

  • a public registry usr/secrets/yubikeys.json in the consumer workspace: pamu2fcfg credential, FIDO2 hmac-secret credential id and salt (all useless without the physical key, hence committable);
  • one sops secret yubikey/<user>/<key>/luks-secret (the FIDO2-derived LUKS passphrase) plus the shared luks-passphrase (the passphrase typed at disko install time, needed to authorize new keyslots).

The module then propagates everything declaratively (just apply), without ever plugging the key on the target hosts:

  • login / sudo / greeter: pam_u2f as a password alternative (sufficient): touching the key logs in, the sops password remains the automatic fallback. One credential is valid fleet-wide thanks to the fixed origin (pam://<network.domain>).
  • encrypted hosts: a oneshot service self-enrolls each declared key in every disko-declared LUKS2 header (keyslot + systemd-fido2 token, the exact format systemd-cryptenroll writes) and prunes revoked ones. The physical key is only ever needed at boot to unlock the disk.
  • enable bool YubiKey authentication (default: enabled when usr/secrets/yubikeys.json exists)
  • origin str Fixed pam_u2f origin/appid: one enrollment is valid fleet-wide
  • luks.enable bool FIDO2 unlock of the host LUKS volumes (inert without disko LUKS + enrolled keys)
darkone.system.yubikey = {
enable = hasRegistry;
origin = "pam://${network.domain}";
luks.enable = true;
};

Source: modules/system/yubikey.nix 🡕