summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorMichael Raskin <7c6f434c@mail.ru>2014-09-02 00:58:30 +0400
committerMichael Raskin <7c6f434c@mail.ru>2014-09-02 00:58:30 +0400
commit419031bcfce177ea6142286d555499b6cd54d141 (patch)
treef39d2a781ab33ac5fdaa3b762e95864d8e43a261 /nixos
parent292196630079f602613df2bf0d934c2242ef7314 (diff)
parent1d5d7fdee2e85460e44b9931f3259254c2092806 (diff)
downloadnixlib-419031bcfce177ea6142286d555499b6cd54d141.tar
nixlib-419031bcfce177ea6142286d555499b6cd54d141.tar.gz
nixlib-419031bcfce177ea6142286d555499b6cd54d141.tar.bz2
nixlib-419031bcfce177ea6142286d555499b6cd54d141.tar.lz
nixlib-419031bcfce177ea6142286d555499b6cd54d141.tar.xz
nixlib-419031bcfce177ea6142286d555499b6cd54d141.tar.zst
nixlib-419031bcfce177ea6142286d555499b6cd54d141.zip
Merge pull request #2644 from lethalman/pam_tally
pam: Add logFailures option for adding pam_tally to su
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/programs/shadow.nix2
-rw-r--r--nixos/modules/security/pam.nix8
2 files changed, 9 insertions, 1 deletions
diff --git a/nixos/modules/programs/shadow.nix b/nixos/modules/programs/shadow.nix
index 5a467e112c23..5c2ea07c5549 100644
--- a/nixos/modules/programs/shadow.nix
+++ b/nixos/modules/programs/shadow.nix
@@ -83,7 +83,7 @@ in
     security.pam.services =
       { chsh = { rootOK = true; };
         chfn = { rootOK = true; };
-        su = { rootOK = true; forwardXAuth = true; };
+        su = { rootOK = true; forwardXAuth = true; logFailures = true; };
         passwd = {};
         # Note: useradd, groupadd etc. aren't setuid root, so it
         # doesn't really matter what the PAM config says as long as it
diff --git a/nixos/modules/security/pam.nix b/nixos/modules/security/pam.nix
index 2a1606e42f3d..844a9da0eb46 100644
--- a/nixos/modules/security/pam.nix
+++ b/nixos/modules/security/pam.nix
@@ -142,6 +142,12 @@ let
         description = "Whether to update <filename>/var/log/wtmp</filename>.";
       };
 
+      logFailures = mkOption {
+        default = false;
+        type = types.bool;
+        description = "Whether to log authentication failures in <filename>/var/log/faillog</filename>.";
+      };
+
       text = mkOption {
         type = types.nullOr types.lines;
         description = "Contents of the PAM service file.";
@@ -169,6 +175,8 @@ let
           # Authentication management.
           ${optionalString cfg.rootOK
               "auth sufficient pam_rootok.so"}
+          ${optionalString cfg.logFailures
+              "auth required pam_tally.so"}
           ${optionalString (config.security.pam.enableSSHAgentAuth && cfg.sshAgentAuth)
               "auth sufficient ${pkgs.pam_ssh_agent_auth}/libexec/pam_ssh_agent_auth.so file=~/.ssh/authorized_keys:~/.ssh/authorized_keys2:/etc/ssh/authorized_keys.d/%u"}
           ${optionalString cfg.usbAuth