Skip to content

Commit

Permalink
Merge pull request #87006 from aanderse/duo-20.03-fix
Browse files Browse the repository at this point in the history
duosec: fix module [20.03]
  • Loading branch information
rnhmjoj authored May 5, 2020
2 parents 986799d + 55f53dd commit 8258818
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions nixos/modules/security/duosec.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,6 @@ let
motd=${boolToStr cfg.motd}
accept_env_factor=${boolToStr cfg.acceptEnvFactor}
'';

loginCfgFile = optionalAttrs cfg.ssh.enable {
"duo/login_duo.conf" =
{ source = pkgs.writeText "login_duo.conf" configFileLogin;
mode = "0600";
user = "sshd";
};
};

pamCfgFile = optional cfg.pam.enable {
"duo/pam_duo.conf" =
{ source = pkgs.writeText "pam_duo.conf" configFilePam;
mode = "0600";
user = "sshd";
};
};
in
{
imports = [
Expand Down Expand Up @@ -198,7 +182,18 @@ in
environment.systemPackages = [ pkgs.duo-unix ];

security.wrappers.login_duo.source = "${pkgs.duo-unix.out}/bin/login_duo";
environment.etc = loginCfgFile // pamCfgFile;

environment.etc."duo/login_duo.conf" = mkIf cfg.ssh.enable
{ source = pkgs.writeText "login_duo.conf" configFileLogin;
mode = "0600";
user = "sshd";
};

environment.etc."duo/pam_duo.conf" = mkIf cfg.pam.enable
{ source = pkgs.writeText "pam_duo.conf" configFilePam;
mode = "0600";
user = "sshd";
};

/* If PAM *and* SSH are enabled, then don't do anything special.
If PAM isn't used, set the default SSH-only options. */
Expand Down

0 comments on commit 8258818

Please sign in to comment.