about summary refs log tree commit diff
path: root/nixos/modules/security/pam.nix
diff options
context:
space:
mode:
authorEric Wolf <ericwolf42@gmail.com>2019-08-30 19:33:08 +0200
committerEric Wolf <ericwolf42@gmail.com>2019-08-30 19:33:08 +0200
commitedf538f7b9da60b318a0b1881881e90cf7884d67 (patch)
tree3db024a1ba06ce6e9bba927df05a2a929447f061 /nixos/modules/security/pam.nix
parent74bfecb7ee35a9eedb200ec8c6ae9f6f737d6b0c (diff)
downloadnixlib-edf538f7b9da60b318a0b1881881e90cf7884d67.tar
nixlib-edf538f7b9da60b318a0b1881881e90cf7884d67.tar.gz
nixlib-edf538f7b9da60b318a0b1881881e90cf7884d67.tar.bz2
nixlib-edf538f7b9da60b318a0b1881881e90cf7884d67.tar.lz
nixlib-edf538f7b9da60b318a0b1881881e90cf7884d67.tar.xz
nixlib-edf538f7b9da60b318a0b1881881e90cf7884d67.tar.zst
nixlib-edf538f7b9da60b318a0b1881881e90cf7884d67.zip
yubico-pam: make local authentication possible
using challenge response

see https://developers.yubico.com/yubico-pam/Authentication_Using_Challenge-Response.html
Diffstat (limited to 'nixos/modules/security/pam.nix')
-rw-r--r--nixos/modules/security/pam.nix19
1 files changed, 18 insertions, 1 deletions
diff --git a/nixos/modules/security/pam.nix b/nixos/modules/security/pam.nix
index 89e71c5136e4..d6622cb1e2f5 100644
--- a/nixos/modules/security/pam.nix
+++ b/nixos/modules/security/pam.nix
@@ -351,7 +351,7 @@ let
           ${let oath = config.security.pam.oath; in optionalString cfg.oathAuth
               "auth requisite ${pkgs.oathToolkit}/lib/security/pam_oath.so window=${toString oath.window} usersfile=${toString oath.usersFile} digits=${toString oath.digits}"}
           ${let yubi = config.security.pam.yubico; in optionalString cfg.yubicoAuth
-              "auth ${yubi.control} ${pkgs.yubico-pam}/lib/security/pam_yubico.so id=${toString yubi.id} ${optionalString yubi.debug "debug"}"}
+              "auth ${yubi.control} ${pkgs.yubico-pam}/lib/security/pam_yubico.so mode=${toString yubi.mode} ${optionalString (yubi.mode == "client") "id=${toString yubi.id}"} ${optionalString yubi.debug "debug"}"}
         '' +
           # Modules in this block require having the password set in PAM_AUTHTOK.
           # pam_unix is marked as 'sufficient' on NixOS which means nothing will run
@@ -696,6 +696,23 @@ in
           Debug output to stderr.
         '';
       };
+      mode = mkOption {
+        default = "client";
+        type = types.enum [ "client" "challenge-response" ];
+        description = ''
+          Mode of operation.
+
+          Use "client" for online validation with a YubiKey validation service such as
+          the YubiCloud.
+
+          Use "challenge-response" for offline validation using YubiKeys with HMAC-SHA-1
+          Challenge-Response configurations. See the man-page ykpamcfg(1) for further
+          details on how to configure offline Challenge-Response validation. 
+
+          More information can be found <link
+          xlink:href="https://developers.yubico.com/yubico-pam/Authentication_Using_Challenge-Response.html">here</link>.
+        '';
+      };
     };
 
     security.pam.enableEcryptfs = mkOption {