summary refs log tree commit diff
path: root/modules/hardware-keys.nix
diff options
context:
space:
mode:
authorMel <mel@rnrd.eu>2025-06-05 03:41:32 +0200
committerMel <mel@rnrd.eu>2025-06-05 03:41:32 +0200
commit182aa5ecdc5c6583ce9b44c5a13432bb30409fc8 (patch)
treebf4d0fbba4e1cc8db47238002a293bae90998e4e /modules/hardware-keys.nix
parentbca04b418838998c183b4e087ded86856c88a062 (diff)
downloadminerals-182aa5ecdc5c6583ce9b44c5a13432bb30409fc8.tar.zst
minerals-182aa5ecdc5c6583ce9b44c5a13432bb30409fc8.zip
Setup login and sudo authentication through U2F w/ YubiKey
Signed-off-by: Mel <mel@rnrd.eu>
Diffstat (limited to 'modules/hardware-keys.nix')
-rw-r--r--modules/hardware-keys.nix29
1 files changed, 29 insertions, 0 deletions
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
+  ];
+}