2023-03-25 18:06:16 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
2024-08-03 17:32:02 +00:00
|
|
|
}: let
|
|
|
|
inherit (lib) mkEnableOption mkIf;
|
|
|
|
|
2023-03-25 18:06:16 +00:00
|
|
|
cfg = config.aa.apps.yubikey;
|
|
|
|
in {
|
2024-08-03 17:32:02 +00:00
|
|
|
options.aa.apps.yubikey = {
|
2023-03-25 18:06:16 +00:00
|
|
|
enable = mkEnableOption "yubikey";
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
yubikey-manager
|
|
|
|
yubikey-agent
|
|
|
|
yubico-pam
|
2023-07-09 15:24:54 +00:00
|
|
|
age-plugin-yubikey
|
|
|
|
rage
|
2023-03-25 18:06:16 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
services.pcscd.enable = true;
|
|
|
|
|
|
|
|
security.pam.yubico = {
|
|
|
|
enable = true;
|
|
|
|
mode = "challenge-response";
|
|
|
|
# Uncomment below for 2FA
|
|
|
|
#control = "required";
|
|
|
|
};
|
|
|
|
# To set up, need to run (might need to run first command as root)
|
|
|
|
# ykman otp chalresp --touch --generate 2
|
|
|
|
# ykpamcfg -2 -v
|
|
|
|
};
|
|
|
|
}
|