2024-08-01 08:17:09 +02:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
cfg = config.jade.hwKey;
|
|
|
|
in
|
|
|
|
with lib; {
|
|
|
|
options.jade.hwKey = {
|
|
|
|
pamAuth.enable = mkEnableOption "Enable PAM authentication with hardware keys";
|
|
|
|
};
|
|
|
|
config = {
|
|
|
|
# nitrokey
|
|
|
|
services.udev.packages = [pkgs.nitrokey-udev-rules];
|
2024-03-05 13:49:22 +01:00
|
|
|
|
2024-08-01 08:17:09 +02:00
|
|
|
# smartcard daemon
|
|
|
|
services.pcscd.enable = true;
|
2024-03-05 13:49:22 +01:00
|
|
|
|
2024-08-01 08:17:09 +02:00
|
|
|
# authenticate using hw key
|
|
|
|
security.pam = {
|
|
|
|
services.jade.u2fAuth = cfg.pamAuth.enable;
|
|
|
|
u2f = {
|
|
|
|
enable = true;
|
|
|
|
control = "sufficient";
|
|
|
|
settings = {
|
|
|
|
cue = true;
|
|
|
|
authFile = "/home/jade/.ssh/u2f_keys";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-03-05 13:49:22 +01:00
|
|
|
|
2024-08-01 08:17:09 +02:00
|
|
|
programs.i3lock.u2fSupport = true;
|
|
|
|
};
|
|
|
|
}
|