From 182aa5ecdc5c6583ce9b44c5a13432bb30409fc8 Mon Sep 17 00:00:00 2001 From: Mel Date: Thu, 5 Jun 2025 03:41:32 +0200 Subject: Setup login and sudo authentication through U2F w/ YubiKey Signed-off-by: Mel --- modules/hardware-keys.nix | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 modules/hardware-keys.nix (limited to 'modules/hardware-keys.nix') diff --git a/modules/hardware-keys.nix b/modules/hardware-keys.nix new file mode 100644 index 0000000..e6ae089 --- /dev/null +++ b/modules/hardware-keys.nix @@ -0,0 +1,29 @@ +{ pkgs, ... }: + +{ + programs = { + yubikey-touch-detector = { + enable = true; + libnotify = true; + }; + }; + + services = { + yubikey-agent.enable = true; + }; + + # see `modules/home/yubikeys.nix` for the YubiKey + # universal second factor (u2f) configuration file. + security = { + pam.services = { + login.u2fAuth = true; + sudo.u2fAuth = true; + }; + }; + + environment.systemPackages = with pkgs; [ + yubikey-manager yubikey-manager-qt + yubikey-personalization yubikey-personalization-gui + age-plugin-yubikey pam_u2f + ]; +} -- cgit 1.4.1