@@ -63,6 +63,14 @@ let
6363 '';
6464 };
6565
66+ oathAuth = mkOption {
67+ default = config.security.pam.enableOATH;
68+ type = types.bool;
69+ description = ''
70+ If set, the OATH Toolkit will be used.
71+ '';
72+ };
73+
6674 sshAgentAuth = mkOption {
6775 default = false;
6876 type = types.bool;
@@ -206,6 +214,8 @@ let
206214 "auth sufficient pam_unix.so ${optionalString cfg.allowNullPassword "nullok"} likeauth"}
207215 ${optionalString cfg.otpwAuth
208216 "auth sufficient ${pkgs.otpw}/lib/security/pam_otpw.so"}
217+ ${optionalString cfg.oathAuth
218+ "auth sufficient ${pkgs.oathToolkit}/lib/security/pam_oath.so"} window=5 usersfile=/etc/users.oath
209219 ${optionalString config.users.ldap.enable
210220 "auth sufficient ${pam_ldap}/lib/security/pam_ldap.so use_first_pass"}
211221 ${optionalString config.krb5.enable ''
@@ -241,6 +251,8 @@ let
241251 "session optional ${pam_krb5}/lib/security/pam_krb5.so"}
242252 ${optionalString cfg.otpwAuth
243253 "session optional ${pkgs.otpw}/lib/security/pam_otpw.so"}
254+ ${optionalString cfg.oathAuth
255+ "session optional ${pkgs.oathToolkit}/lib/security/pam_oath.so"} window=5 usersfile=/etc/users.oath
244256 ${optionalString cfg.startSession
245257 "session optional ${pkgs.systemd}/lib/security/pam_systemd.so"}
246258 ${optionalString cfg.forwardXAuth
@@ -338,6 +350,13 @@ in
338350 '';
339351 };
340352
353+ security.pam.enableOATH = mkOption {
354+ default = false;
355+ description = ''
356+ Enable the OATH (one-time password) PAM module.
357+ '';
358+ };
359+
341360 users.motd = mkOption {
342361 default = null;
343362 example = "Today is Sweetmorn, the 4th day of The Aftermath in the YOLD 3178.";
@@ -357,7 +376,8 @@ in
357376 [ pkgs.pam ]
358377 ++ optional config.users.ldap.enable pam_ldap
359378 ++ optionals config.krb5.enable [pam_krb5 pam_ccreds]
360− ++ optionals config.security.pam.enableOTPW [ pkgs.otpw ];
379+ ++ optionals config.security.pam.enableOTPW [ pkgs.otpw ]
380+ ++ optionals config.security.pam.enableOATH [ pkgs.oathToolkit ];
361381
362382 environment.etc =
363383 mapAttrsToList (n: v: makePAMService v) config.security.pam.services;