mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 06:00:33 +03:00
nixos: add systemd-homed support
As a start, it's not very configurable, but works pretty well.
This commit is contained in:
parent
0cc87ab901
commit
05420f34cf
8 changed files with 171 additions and 5 deletions
|
@ -488,6 +488,9 @@ let
|
|||
account [success=ok ignore=ignore default=die] ${pkgs.google-guest-oslogin}/lib/security/pam_oslogin_login.so
|
||||
account [success=ok default=ignore] ${pkgs.google-guest-oslogin}/lib/security/pam_oslogin_admin.so
|
||||
'' +
|
||||
optionalString config.services.homed.enable ''
|
||||
account sufficient ${config.systemd.package}/lib/security/pam_systemd_home.so
|
||||
'' +
|
||||
# The required pam_unix.so module has to come after all the sufficient modules
|
||||
# because otherwise, the account lookup will fail if the user does not exist
|
||||
# locally, for example with MySQL- or LDAP-auth.
|
||||
|
@ -541,8 +544,10 @@ let
|
|||
# after it succeeds. Certain modules need to run after pam_unix
|
||||
# prompts the user for password so we run it once with 'optional' at an
|
||||
# earlier point and it will run again with 'sufficient' further down.
|
||||
# We use try_first_pass the second time to avoid prompting password twice
|
||||
(optionalString (cfg.unixAuth &&
|
||||
# We use try_first_pass the second time to avoid prompting password twice.
|
||||
#
|
||||
# The same principle applies to systemd-homed
|
||||
(optionalString ((cfg.unixAuth || config.services.homed.enable) &&
|
||||
(config.security.pam.enableEcryptfs
|
||||
|| config.security.pam.enableFscrypt
|
||||
|| cfg.pamMount
|
||||
|
@ -553,7 +558,10 @@ let
|
|||
|| cfg.failDelay.enable
|
||||
|| cfg.duoSecurity.enable))
|
||||
(
|
||||
''
|
||||
optionalString config.services.homed.enable ''
|
||||
auth optional ${config.systemd.package}/lib/security/pam_systemd_home.so
|
||||
'' +
|
||||
optionalString cfg.unixAuth ''
|
||||
auth optional pam_unix.so ${optionalString cfg.allowNullPassword "nullok"} ${optionalString cfg.nodelay "nodelay"} likeauth
|
||||
'' +
|
||||
optionalString config.security.pam.enableEcryptfs ''
|
||||
|
@ -584,6 +592,9 @@ let
|
|||
auth required ${pkgs.duo-unix}/lib/security/pam_duo.so
|
||||
''
|
||||
)) +
|
||||
optionalString config.services.homed.enable ''
|
||||
auth sufficient ${config.systemd.package}/lib/security/pam_systemd_home.so
|
||||
'' +
|
||||
optionalString cfg.unixAuth ''
|
||||
auth sufficient pam_unix.so ${optionalString cfg.allowNullPassword "nullok"} ${optionalString cfg.nodelay "nodelay"} likeauth try_first_pass
|
||||
'' +
|
||||
|
@ -605,6 +616,10 @@ let
|
|||
auth required pam_deny.so
|
||||
|
||||
# Password management.
|
||||
'' +
|
||||
optionalString config.services.homed.enable ''
|
||||
password sufficient ${config.systemd.package}/lib/security/pam_systemd_home.so
|
||||
'' + ''
|
||||
password sufficient pam_unix.so nullok sha512
|
||||
'' +
|
||||
optionalString config.security.pam.enableEcryptfs ''
|
||||
|
@ -650,6 +665,9 @@ let
|
|||
++ optional (cfg.ttyAudit.enablePattern != null) "enable=${cfg.ttyAudit.enablePattern}"
|
||||
++ optional (cfg.ttyAudit.disablePattern != null) "disable=${cfg.ttyAudit.disablePattern}"
|
||||
)) +
|
||||
optionalString config.services.homed.enable ''
|
||||
session required ${config.systemd.package}/lib/security/pam_systemd_home.so
|
||||
'' +
|
||||
optionalString cfg.makeHomeDir ''
|
||||
session required ${pkgs.pam}/lib/security/pam_mkhomedir.so silent skel=${config.security.pam.makeHomeDir.skelDirectory} umask=0077
|
||||
'' +
|
||||
|
@ -1345,6 +1363,9 @@ in
|
|||
'' +
|
||||
optionalString config.virtualisation.lxc.lxcfs.enable ''
|
||||
mr ${pkgs.lxc}/lib/security/pam_cgfs.so
|
||||
'' +
|
||||
optionalString config.services.homed.enable ''
|
||||
mr ${config.systemd.package}/lib/security/pam_systemd_home.so
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue