nix/nixos/common/modules/yubikey-auth.nix
2024-05-05 16:13:52 +09:00

22 lines
473 B
Nix

{ pkgs, ... }: {
security.pam.yubico = {
enable = true;
debug = true;
# control = "required";
mode = "challenge-response";
id = [ "18550256" ];
};
environment.systemPackages = with pkgs; [
yubico-pam
];
services.udev.extraRules = ''
ACTION=="remove",\
ENV{ID_BUS}=="usb",\
ENV{ID_MODEL_ID}=="0407",\
ENV{ID_VENDOR_ID}=="1050",\
ENV{ID_VENDOR}=="Yubico",\
RUN+="${pkgs.systemd}/bin/loginctl lock-sessions"
'';
}