Skip to content

Commit

Permalink
feat: Initial security key support
Browse files Browse the repository at this point in the history
Enables usage for login, sudo and automatically locks the system upon
removal
  • Loading branch information
lpchaim committed Aug 7, 2024
1 parent 9ab4eb0 commit b74ad61
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions modules/nixos/security/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{ pkgs, ... }:

{
security.pam = {
services = {
login.u2fAuth = true;
sudo.u2fAuth = true;
};
sshAgentAuth.enable = true;
u2f = {
enable = true;
control = "sufficient";
settings.cue = true;
};
};
programs = {
gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
};
services = {
pcscd.enable = true;
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"
'';
packages = [ pkgs.yubikey-personalization ];
};
};
environment.systemPackages = with pkgs; [
gnupg
pam_u2f
yubikey-personalization
yubioath-flutter
];
}

0 comments on commit b74ad61

Please sign in to comment.