···172172 else if ! isPath value then
173173 if isStringLike value then
174174 throw ''
175175- ${context} ("${toString value}") is a string-like value, but it should be a path instead.
175175+ ${context} ("${toString value}") is a string-like value, but it should be a file set or a path instead.
176176 Paths represented as strings are not supported by `lib.fileset`, use `lib.sources` or derivations instead.''
177177 else
178178 throw ''
179179- ${context} is of type ${typeOf value}, but it should be a path instead.''
179179+ ${context} is of type ${typeOf value}, but it should be a file set or a path instead.''
180180 else if ! pathExists value then
181181 throw ''
182182 ${context} (${toString value}) does not exist.''
+2-2
lib/fileset/tests.sh
···355355rm -rf *
356356357357# Path coercion only works for paths
358358-expectFailure 'toSource { root = ./.; fileset = 10; }' 'lib.fileset.toSource: `fileset` is of type int, but it should be a path instead.'
359359-expectFailure 'toSource { root = ./.; fileset = "/some/path"; }' 'lib.fileset.toSource: `fileset` \("/some/path"\) is a string-like value, but it should be a path instead.
358358+expectFailure 'toSource { root = ./.; fileset = 10; }' 'lib.fileset.toSource: `fileset` is of type int, but it should be a file set or a path instead.'
359359+expectFailure 'toSource { root = ./.; fileset = "/some/path"; }' 'lib.fileset.toSource: `fileset` \("/some/path"\) is a string-like value, but it should be a file set or a path instead.
360360\s*Paths represented as strings are not supported by `lib.fileset`, use `lib.sources` or derivations instead.'
361361362362# Path coercion errors for non-existent paths
···305305306306- `service.borgmatic.settings.location` and `services.borgmatic.configurations.<name>.location` are deprecated, please move your options out of sections to the global scope.
307307308308+- `dagger` was removed because using a package called `dagger` and packaging it from source violates their trademark policy.
309309+308310## Other Notable Changes {#sec-release-23.11-notable-changes}
309311310312- The Cinnamon module now enables XDG desktop integration by default. If you are experiencing collisions related to xdg-desktop-portal-gtk you can safely remove `xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];` from your NixOS configuration.
+390-354
nixos/modules/security/pam.nix
···66with lib;
7788let
99+1010+ mkRulesTypeOption = type: mkOption {
1111+ # These options are experimental and subject to breaking changes without notice.
1212+ description = lib.mdDoc ''
1313+ PAM `${type}` rules for this service.
1414+1515+ Attribute keys are the name of each rule.
1616+ '';
1717+ type = types.attrsOf (types.submodule ({ name, config, ... }: {
1818+ options = {
1919+ name = mkOption {
2020+ type = types.str;
2121+ description = lib.mdDoc ''
2222+ Name of this rule.
2323+ '';
2424+ internal = true;
2525+ readOnly = true;
2626+ };
2727+ enable = mkOption {
2828+ type = types.bool;
2929+ default = true;
3030+ description = lib.mdDoc ''
3131+ Whether this rule is added to the PAM service config file.
3232+ '';
3333+ };
3434+ order = mkOption {
3535+ type = types.int;
3636+ description = lib.mdDoc ''
3737+ Order of this rule in the service file. Rules are arranged in ascending order of this value.
3838+3939+ ::: {.warning}
4040+ The `order` values for the built-in rules are subject to change. If you assign a constant value to this option, a system update could silently reorder your rule. You could be locked out of your system, or your system could be left wide open. When using this option, set it to a relative offset from another rule's `order` value:
4141+4242+ ```nix
4343+ {
4444+ security.pam.services.login.rules.auth.foo.order =
4545+ config.security.pam.services.login.rules.auth.unix.order + 10;
4646+ }
4747+ ```
4848+ :::
4949+ '';
5050+ };
5151+ control = mkOption {
5252+ type = types.str;
5353+ description = lib.mdDoc ''
5454+ Indicates the behavior of the PAM-API should the module fail to succeed in its authentication task. See `control` in {manpage}`pam.conf(5)` for details.
5555+ '';
5656+ };
5757+ modulePath = mkOption {
5858+ type = types.str;
5959+ description = lib.mdDoc ''
6060+ Either the full filename of the PAM to be used by the application (it begins with a '/'), or a relative pathname from the default module location. See `module-path` in {manpage}`pam.conf(5)` for details.
6161+ '';
6262+ };
6363+ args = mkOption {
6464+ type = types.listOf types.str;
6565+ description = lib.mdDoc ''
6666+ Tokens that can be used to modify the specific behavior of the given PAM. Such arguments will be documented for each individual module. See `module-arguments` in {manpage}`pam.conf(5)` for details.
6767+6868+ Escaping rules for spaces and square brackets are automatically applied.
6969+7070+ {option}`settings` are automatically added as {option}`args`. It's recommended to use the {option}`settings` option whenever possible so that arguments can be overridden.
7171+ '';
7272+ };
7373+ settings = mkOption {
7474+ type = with types; attrsOf (nullOr (oneOf [ bool str int pathInStore ]));
7575+ default = {};
7676+ description = lib.mdDoc ''
7777+ Settings to add as `module-arguments`.
7878+7979+ Boolean values render just the key if true, and nothing if false. Null values are ignored. All other values are rendered as key-value pairs.
8080+ '';
8181+ };
8282+ };
8383+ config = {
8484+ inherit name;
8585+ # Formats an attrset of settings as args for use as `module-arguments`.
8686+ args = concatLists (flip mapAttrsToList config.settings (name: value:
8787+ if isBool value
8888+ then optional value name
8989+ else optional (value != null) "${name}=${toString value}"
9090+ ));
9191+ };
9292+ }));
9393+ };
9494+995 parentConfig = config;
10961197 pamOpts = { config, name, ... }: let cfg = config; in let config = parentConfig; in {
···16102 example = "sshd";
17103 type = types.str;
18104 description = lib.mdDoc "Name of the PAM service.";
105105+ };
106106+107107+ rules = mkOption {
108108+ # This option is experimental and subject to breaking changes without notice.
109109+ visible = false;
110110+111111+ description = lib.mdDoc ''
112112+ PAM rules for this service.
113113+114114+ ::: {.warning}
115115+ This option and its suboptions are experimental and subject to breaking changes without notice.
116116+117117+ If you use this option in your system configuration, you will need to manually monitor this module for any changes. Otherwise, failure to adjust your configuration properly could lead to you being locked out of your system, or worse, your system could be left wide open to attackers.
118118+119119+ If you share configuration examples that use this option, you MUST include this warning so that users are informed.
120120+121121+ You may freely use this option within `nixpkgs`, and future changes will account for those use sites.
122122+ :::
123123+ '';
124124+ type = types.submodule {
125125+ options = genAttrs [ "account" "auth" "password" "session" ] mkRulesTypeOption;
126126+ };
19127 };
2012821129 unixAuth = mkOption {
···470578 setLoginUid = mkDefault cfg.startSession;
471579 limits = mkDefault config.security.pam.loginLimits;
472580581581+ text = let
582582+ ensureUniqueOrder = type: rules:
583583+ let
584584+ checkPair = a: b: assert assertMsg (a.order != b.order) "security.pam.services.${name}.rules.${type}: rules '${a.name}' and '${b.name}' cannot have the same order value (${toString a.order})"; b;
585585+ checked = zipListsWith checkPair rules (drop 1 rules);
586586+ in take 1 rules ++ checked;
587587+ # Formats a string for use in `module-arguments`. See `man pam.conf`.
588588+ formatModuleArgument = token:
589589+ if hasInfix " " token
590590+ then "[${replaceStrings ["]"] ["\\]"] token}]"
591591+ else token;
592592+ formatRules = type: pipe cfg.rules.${type} [
593593+ attrValues
594594+ (filter (rule: rule.enable))
595595+ (sort (a: b: a.order < b.order))
596596+ (ensureUniqueOrder type)
597597+ (map (rule: concatStringsSep " " (
598598+ [ type rule.control rule.modulePath ]
599599+ ++ map formatModuleArgument rule.args
600600+ ++ [ "# ${rule.name} (order ${toString rule.order})" ]
601601+ )))
602602+ (concatStringsSep "\n")
603603+ ];
604604+ in mkDefault ''
605605+ # Account management.
606606+ ${formatRules "account"}
607607+608608+ # Authentication management.
609609+ ${formatRules "auth"}
610610+611611+ # Password management.
612612+ ${formatRules "password"}
613613+614614+ # Session management.
615615+ ${formatRules "session"}
616616+ '';
617617+473618 # !!! TODO: move the LDAP stuff to the LDAP module, and the
474619 # Samba stuff to the Samba module. This requires that the PAM
475620 # module provides the right hooks.
476476- text = mkDefault
477477- (
478478- ''
479479- # Account management.
480480- '' +
481481- optionalString use_ldap ''
482482- account sufficient ${pam_ldap}/lib/security/pam_ldap.so
483483- '' +
484484- optionalString cfg.mysqlAuth ''
485485- account sufficient ${pkgs.pam_mysql}/lib/security/pam_mysql.so config_file=/etc/security/pam_mysql.conf
486486- '' +
487487- optionalString (config.services.kanidm.enablePam) ''
488488- account sufficient ${pkgs.kanidm}/lib/pam_kanidm.so ignore_unknown_user
489489- '' +
490490- optionalString (config.services.sssd.enable && cfg.sssdStrictAccess==false) ''
491491- account sufficient ${pkgs.sssd}/lib/security/pam_sss.so
492492- '' +
493493- optionalString (config.services.sssd.enable && cfg.sssdStrictAccess) ''
494494- account [default=bad success=ok user_unknown=ignore] ${pkgs.sssd}/lib/security/pam_sss.so
495495- '' +
496496- optionalString config.security.pam.krb5.enable ''
497497- account sufficient ${pam_krb5}/lib/security/pam_krb5.so
498498- '' +
499499- optionalString cfg.googleOsLoginAccountVerification ''
500500- account [success=ok ignore=ignore default=die] ${pkgs.google-guest-oslogin}/lib/security/pam_oslogin_login.so
501501- account [success=ok default=ignore] ${pkgs.google-guest-oslogin}/lib/security/pam_oslogin_admin.so
502502- '' +
503503- optionalString config.services.homed.enable ''
504504- account sufficient ${config.systemd.package}/lib/security/pam_systemd_home.so
505505- '' +
621621+ rules = let
622622+ autoOrderRules = flip pipe [
623623+ (imap1 (index: rule: rule // { order = mkDefault (10000 + index * 100); } ))
624624+ (map (rule: nameValuePair rule.name (removeAttrs rule [ "name" ])))
625625+ listToAttrs
626626+ ];
627627+ in {
628628+ account = autoOrderRules [
629629+ { name = "ldap"; enable = use_ldap; control = "sufficient"; modulePath = "${pam_ldap}/lib/security/pam_ldap.so"; }
630630+ { name = "mysql"; enable = cfg.mysqlAuth; control = "sufficient"; modulePath = "${pkgs.pam_mysql}/lib/security/pam_mysql.so"; settings = {
631631+ config_file = "/etc/security/pam_mysql.conf";
632632+ }; }
633633+ { name = "kanidm"; enable = config.services.kanidm.enablePam; control = "sufficient"; modulePath = "${pkgs.kanidm}/lib/pam_kanidm.so"; settings = {
634634+ ignore_unknown_user = true;
635635+ }; }
636636+ { name = "sss"; enable = config.services.sssd.enable; control = if cfg.sssdStrictAccess then "[default=bad success=ok user_unknown=ignore]" else "sufficient"; modulePath = "${pkgs.sssd}/lib/security/pam_sss.so"; }
637637+ { name = "krb5"; enable = config.security.pam.krb5.enable; control = "sufficient"; modulePath = "${pam_krb5}/lib/security/pam_krb5.so"; }
638638+ { name = "oslogin_login"; enable = cfg.googleOsLoginAccountVerification; control = "[success=ok ignore=ignore default=die]"; modulePath = "${pkgs.google-guest-oslogin}/lib/security/pam_oslogin_login.so"; }
639639+ { name = "oslogin_admin"; enable = cfg.googleOsLoginAccountVerification; control = "[success=ok default=ignore]"; modulePath = "${pkgs.google-guest-oslogin}/lib/security/pam_oslogin_admin.so"; }
640640+ { name = "systemd_home"; enable = config.services.homed.enable; control = "sufficient"; modulePath = "${config.systemd.package}/lib/security/pam_systemd_home.so"; }
506641 # The required pam_unix.so module has to come after all the sufficient modules
507642 # because otherwise, the account lookup will fail if the user does not exist
508643 # locally, for example with MySQL- or LDAP-auth.
509509- ''
510510- account required pam_unix.so
644644+ { name = "unix"; control = "required"; modulePath = "pam_unix.so"; }
645645+ ];
511646512512- # Authentication management.
513513- '' +
514514- optionalString cfg.googleOsLoginAuthentication ''
515515- auth [success=done perm_denied=die default=ignore] ${pkgs.google-guest-oslogin}/lib/security/pam_oslogin_login.so
516516- '' +
517517- optionalString cfg.rootOK ''
518518- auth sufficient pam_rootok.so
519519- '' +
520520- optionalString cfg.requireWheel ''
521521- auth required pam_wheel.so use_uid
522522- '' +
523523- optionalString cfg.logFailures ''
524524- auth required pam_faillock.so
525525- '' +
526526- optionalString cfg.mysqlAuth ''
527527- auth sufficient ${pkgs.pam_mysql}/lib/security/pam_mysql.so config_file=/etc/security/pam_mysql.conf
528528- '' +
529529- optionalString (config.security.pam.enableSSHAgentAuth && cfg.sshAgentAuth) ''
530530- auth sufficient ${pkgs.pam_ssh_agent_auth}/libexec/pam_ssh_agent_auth.so file=${lib.concatStringsSep ":" config.services.openssh.authorizedKeysFiles}
531531- '' +
532532- (let p11 = config.security.pam.p11; in optionalString cfg.p11Auth ''
533533- auth ${p11.control} ${pkgs.pam_p11}/lib/security/pam_p11.so ${pkgs.opensc}/lib/opensc-pkcs11.so
534534- '') +
535535- (let u2f = config.security.pam.u2f; in optionalString cfg.u2fAuth (''
536536- auth ${u2f.control} ${pkgs.pam_u2f}/lib/security/pam_u2f.so ${optionalString u2f.debug "debug"} ${optionalString (u2f.authFile != null) "authfile=${u2f.authFile}"} ''
537537- + ''${optionalString u2f.interactive "interactive"} ${optionalString u2f.cue "cue"} ${optionalString (u2f.appId != null) "appid=${u2f.appId}"} ${optionalString (u2f.origin != null) "origin=${u2f.origin}"}
538538- '')) +
539539- optionalString cfg.usbAuth ''
540540- auth sufficient ${pkgs.pam_usb}/lib/security/pam_usb.so
541541- '' +
542542- (let ussh = config.security.pam.ussh; in optionalString (config.security.pam.ussh.enable && cfg.usshAuth) ''
543543- auth ${ussh.control} ${pkgs.pam_ussh}/lib/security/pam_ussh.so ${optionalString (ussh.caFile != null) "ca_file=${ussh.caFile}"} ${optionalString (ussh.authorizedPrincipals != null) "authorized_principals=${ussh.authorizedPrincipals}"} ${optionalString (ussh.authorizedPrincipalsFile != null) "authorized_principals_file=${ussh.authorizedPrincipalsFile}"} ${optionalString (ussh.group != null) "group=${ussh.group}"}
544544- '') +
545545- (let oath = config.security.pam.oath; in optionalString cfg.oathAuth ''
546546- auth requisite ${pkgs.oath-toolkit}/lib/security/pam_oath.so window=${toString oath.window} usersfile=${toString oath.usersFile} digits=${toString oath.digits}
547547- '') +
548548- (let yubi = config.security.pam.yubico; in optionalString cfg.yubicoAuth ''
549549- auth ${yubi.control} ${pkgs.yubico-pam}/lib/security/pam_yubico.so mode=${toString yubi.mode} ${optionalString (yubi.challengeResponsePath != null) "chalresp_path=${yubi.challengeResponsePath}"} ${optionalString (yubi.mode == "client") "id=${toString yubi.id}"} ${optionalString yubi.debug "debug"}
550550- '') +
551551- (let dp9ik = config.security.pam.dp9ik; in optionalString dp9ik.enable ''
552552- auth ${dp9ik.control} ${pkgs.pam_dp9ik}/lib/security/pam_p9.so ${dp9ik.authserver}
553553- '') +
554554- optionalString cfg.fprintAuth ''
555555- auth sufficient ${pkgs.fprintd}/lib/security/pam_fprintd.so
556556- '' +
647647+ auth = autoOrderRules ([
648648+ { name = "oslogin_login"; enable = cfg.googleOsLoginAuthentication; control = "[success=done perm_denied=die default=ignore]"; modulePath = "${pkgs.google-guest-oslogin}/lib/security/pam_oslogin_login.so"; }
649649+ { name = "rootok"; enable = cfg.rootOK; control = "sufficient"; modulePath = "pam_rootok.so"; }
650650+ { name = "wheel"; enable = cfg.requireWheel; control = "required"; modulePath = "pam_wheel.so"; settings = {
651651+ use_uid = true;
652652+ }; }
653653+ { name = "faillock"; enable = cfg.logFailures; control = "required"; modulePath = "pam_faillock.so"; }
654654+ { name = "mysql"; enable = cfg.mysqlAuth; control = "sufficient"; modulePath = "${pkgs.pam_mysql}/lib/security/pam_mysql.so"; settings = {
655655+ config_file = "/etc/security/pam_mysql.conf";
656656+ }; }
657657+ { name = "ssh_agent_auth"; enable = config.security.pam.enableSSHAgentAuth && cfg.sshAgentAuth; control = "sufficient"; modulePath = "${pkgs.pam_ssh_agent_auth}/libexec/pam_ssh_agent_auth.so"; settings = {
658658+ file = lib.concatStringsSep ":" config.services.openssh.authorizedKeysFiles;
659659+ }; }
660660+ (let p11 = config.security.pam.p11; in { name = "p11"; enable = cfg.p11Auth; control = p11.control; modulePath = "${pkgs.pam_p11}/lib/security/pam_p11.so"; args = [
661661+ "${pkgs.opensc}/lib/opensc-pkcs11.so"
662662+ ]; })
663663+ (let u2f = config.security.pam.u2f; in { name = "u2f"; enable = cfg.u2fAuth; control = u2f.control; modulePath = "${pkgs.pam_u2f}/lib/security/pam_u2f.so"; settings = {
664664+ inherit (u2f) debug interactive cue origin;
665665+ authfile = u2f.authFile;
666666+ appid = u2f.appId;
667667+ }; })
668668+ { name = "usb"; enable = cfg.usbAuth; control = "sufficient"; modulePath = "${pkgs.pam_usb}/lib/security/pam_usb.so"; }
669669+ (let ussh = config.security.pam.ussh; in { name = "ussh"; enable = config.security.pam.ussh.enable && cfg.usshAuth; control = ussh.control; modulePath = "${pkgs.pam_ussh}/lib/security/pam_ussh.so"; settings = {
670670+ ca_file = ussh.caFile;
671671+ authorized_principals = ussh.authorizedPrincipals;
672672+ authorized_principals_file = ussh.authorizedPrincipalsFile;
673673+ inherit (ussh) group;
674674+ }; })
675675+ (let oath = config.security.pam.oath; in { name = "oath"; enable = cfg.oathAuth; control = "requisite"; modulePath = "${pkgs.oath-toolkit}/lib/security/pam_oath.so"; settings = {
676676+ inherit (oath) window digits;
677677+ usersfile = oath.usersFile;
678678+ }; })
679679+ (let yubi = config.security.pam.yubico; in { name = "yubico"; enable = cfg.yubicoAuth; control = yubi.control; modulePath = "${pkgs.yubico-pam}/lib/security/pam_yubico.so"; settings = {
680680+ inherit (yubi) mode debug;
681681+ chalresp_path = yubi.challengeResponsePath;
682682+ id = mkIf (yubi.mode == "client") yubi.id;
683683+ }; })
684684+ (let dp9ik = config.security.pam.dp9ik; in { name = "p9"; enable = dp9ik.enable; control = dp9ik.control; modulePath = "${pkgs.pam_dp9ik}/lib/security/pam_p9.so"; args = [
685685+ dp9ik.authserver
686686+ ]; })
687687+ { name = "fprintd"; enable = cfg.fprintAuth; control = "sufficient"; modulePath = "${pkgs.fprintd}/lib/security/pam_fprintd.so"; }
688688+ ] ++
557689 # Modules in this block require having the password set in PAM_AUTHTOK.
558690 # pam_unix is marked as 'sufficient' on NixOS which means nothing will run
559691 # after it succeeds. Certain modules need to run after pam_unix
···562694 # We use try_first_pass the second time to avoid prompting password twice.
563695 #
564696 # The same principle applies to systemd-homed
565565- (optionalString ((cfg.unixAuth || config.services.homed.enable) &&
697697+ (optionals ((cfg.unixAuth || config.services.homed.enable) &&
566698 (config.security.pam.enableEcryptfs
567699 || config.security.pam.enableFscrypt
568700 || cfg.pamMount
···573705 || cfg.failDelay.enable
574706 || cfg.duoSecurity.enable
575707 || cfg.zfs))
576576- (
577577- optionalString config.services.homed.enable ''
578578- auth optional ${config.systemd.package}/lib/security/pam_systemd_home.so
579579- '' +
580580- optionalString cfg.unixAuth ''
581581- auth optional pam_unix.so ${optionalString cfg.allowNullPassword "nullok"} ${optionalString cfg.nodelay "nodelay"} likeauth
582582- '' +
583583- optionalString config.security.pam.enableEcryptfs ''
584584- auth optional ${pkgs.ecryptfs}/lib/security/pam_ecryptfs.so unwrap
585585- '' +
586586- optionalString config.security.pam.enableFscrypt ''
587587- auth optional ${pkgs.fscrypt-experimental}/lib/security/pam_fscrypt.so
588588- '' +
589589- optionalString cfg.zfs ''
590590- auth optional ${config.boot.zfs.package}/lib/security/pam_zfs_key.so homes=${config.security.pam.zfs.homes}
591591- '' +
592592- optionalString cfg.pamMount ''
593593- auth optional ${pkgs.pam_mount}/lib/security/pam_mount.so disable_interactive
594594- '' +
595595- optionalString cfg.enableKwallet ''
596596- auth optional ${pkgs.plasma5Packages.kwallet-pam}/lib/security/pam_kwallet5.so kwalletd=${pkgs.plasma5Packages.kwallet.bin}/bin/kwalletd5
597597- '' +
598598- optionalString cfg.enableGnomeKeyring ''
599599- auth optional ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so
600600- '' +
601601- optionalString cfg.gnupg.enable ''
602602- auth optional ${pkgs.pam_gnupg}/lib/security/pam_gnupg.so ${optionalString cfg.gnupg.storeOnly " store-only"}
603603- '' +
604604- optionalString cfg.failDelay.enable ''
605605- auth optional ${pkgs.pam}/lib/security/pam_faildelay.so delay=${toString cfg.failDelay.delay}
606606- '' +
607607- optionalString cfg.googleAuthenticator.enable ''
608608- auth required ${pkgs.google-authenticator}/lib/security/pam_google_authenticator.so no_increment_hotp
609609- '' +
610610- optionalString cfg.duoSecurity.enable ''
611611- auth required ${pkgs.duo-unix}/lib/security/pam_duo.so
612612- ''
613613- )) +
614614- optionalString config.services.homed.enable ''
615615- auth sufficient ${config.systemd.package}/lib/security/pam_systemd_home.so
616616- '' +
617617- optionalString cfg.unixAuth ''
618618- auth sufficient pam_unix.so ${optionalString cfg.allowNullPassword "nullok"} ${optionalString cfg.nodelay "nodelay"} likeauth try_first_pass
619619- '' +
620620- optionalString cfg.otpwAuth ''
621621- auth sufficient ${pkgs.otpw}/lib/security/pam_otpw.so
622622- '' +
623623- optionalString use_ldap ''
624624- auth sufficient ${pam_ldap}/lib/security/pam_ldap.so use_first_pass
625625- '' +
626626- optionalString config.services.kanidm.enablePam ''
627627- auth sufficient ${pkgs.kanidm}/lib/pam_kanidm.so ignore_unknown_user use_first_pass
628628- '' +
629629- optionalString config.services.sssd.enable ''
630630- auth sufficient ${pkgs.sssd}/lib/security/pam_sss.so use_first_pass
631631- '' +
632632- optionalString config.security.pam.krb5.enable ''
633633- auth [default=ignore success=1 service_err=reset] ${pam_krb5}/lib/security/pam_krb5.so use_first_pass
634634- auth [default=die success=done] ${pam_ccreds}/lib/security/pam_ccreds.so action=validate use_first_pass
635635- auth sufficient ${pam_ccreds}/lib/security/pam_ccreds.so action=store use_first_pass
636636- '' +
637637- ''
638638- auth required pam_deny.so
708708+ [
709709+ { name = "systemd_home-early"; enable = config.services.homed.enable; control = "optional"; modulePath = "${config.systemd.package}/lib/security/pam_systemd_home.so"; }
710710+ { name = "unix-early"; enable = cfg.unixAuth; control = "optional"; modulePath = "pam_unix.so"; settings = {
711711+ nullok = cfg.allowNullPassword;
712712+ inherit (cfg) nodelay;
713713+ likeauth = true;
714714+ }; }
715715+ { name = "ecryptfs"; enable = config.security.pam.enableEcryptfs; control = "optional"; modulePath = "${pkgs.ecryptfs}/lib/security/pam_ecryptfs.so"; settings = {
716716+ unwrap = true;
717717+ }; }
718718+ { name = "fscrypt"; enable = config.security.pam.enableFscrypt; control = "optional"; modulePath = "${pkgs.fscrypt-experimental}/lib/security/pam_fscrypt.so"; }
719719+ { name = "zfs_key"; enable = cfg.zfs; control = "optional"; modulePath = "${config.boot.zfs.package}/lib/security/pam_zfs_key.so"; settings = {
720720+ inherit (config.security.pam.zfs) homes;
721721+ }; }
722722+ { name = "mount"; enable = cfg.pamMount; control = "optional"; modulePath = "${pkgs.pam_mount}/lib/security/pam_mount.so"; settings = {
723723+ disable_interactive = true;
724724+ }; }
725725+ { name = "kwallet5"; enable = cfg.enableKwallet; control = "optional"; modulePath = "${pkgs.plasma5Packages.kwallet-pam}/lib/security/pam_kwallet5.so"; settings = {
726726+ kwalletd = "${pkgs.plasma5Packages.kwallet.bin}/bin/kwalletd5";
727727+ }; }
728728+ { name = "gnome_keyring"; enable = cfg.enableGnomeKeyring; control = "optional"; modulePath = "${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so"; }
729729+ { name = "gnupg"; enable = cfg.gnupg.enable; control = "optional"; modulePath = "${pkgs.pam_gnupg}/lib/security/pam_gnupg.so"; settings = {
730730+ store-only = cfg.gnupg.storeOnly;
731731+ }; }
732732+ { name = "faildelay"; enable = cfg.failDelay.enable; control = "optional"; modulePath = "${pkgs.pam}/lib/security/pam_faildelay.so"; settings = {
733733+ inherit (cfg.failDelay) delay;
734734+ }; }
735735+ { name = "google_authenticator"; enable = cfg.googleAuthenticator.enable; control = "required"; modulePath = "${pkgs.google-authenticator}/lib/security/pam_google_authenticator.so"; settings = {
736736+ no_increment_hotp = true;
737737+ }; }
738738+ { name = "duo"; enable = cfg.duoSecurity.enable; control = "required"; modulePath = "${pkgs.duo-unix}/lib/security/pam_duo.so"; }
739739+ ]) ++ [
740740+ { name = "systemd_home"; enable = config.services.homed.enable; control = "sufficient"; modulePath = "${config.systemd.package}/lib/security/pam_systemd_home.so"; }
741741+ { name = "unix"; enable = cfg.unixAuth; control = "sufficient"; modulePath = "pam_unix.so"; settings = {
742742+ nullok = cfg.allowNullPassword;
743743+ inherit (cfg) nodelay;
744744+ likeauth = true;
745745+ try_first_pass = true;
746746+ }; }
747747+ { name = "otpw"; enable = cfg.otpwAuth; control = "sufficient"; modulePath = "${pkgs.otpw}/lib/security/pam_otpw.so"; }
748748+ { name = "ldap"; enable = use_ldap; control = "sufficient"; modulePath = "${pam_ldap}/lib/security/pam_ldap.so"; settings = {
749749+ use_first_pass = true;
750750+ }; }
751751+ { name = "kanidm"; enable = config.services.kanidm.enablePam; control = "sufficient"; modulePath = "${pkgs.kanidm}/lib/pam_kanidm.so"; settings = {
752752+ ignore_unknown_user = true;
753753+ use_first_pass = true;
754754+ }; }
755755+ { name = "sss"; enable = config.services.sssd.enable; control = "sufficient"; modulePath = "${pkgs.sssd}/lib/security/pam_sss.so"; settings = {
756756+ use_first_pass = true;
757757+ }; }
758758+ { name = "krb5"; enable = config.security.pam.krb5.enable; control = "[default=ignore success=1 service_err=reset]"; modulePath = "${pam_krb5}/lib/security/pam_krb5.so"; settings = {
759759+ use_first_pass = true;
760760+ }; }
761761+ { name = "ccreds-validate"; enable = config.security.pam.krb5.enable; control = "[default=die success=done]"; modulePath = "${pam_ccreds}/lib/security/pam_ccreds.so"; settings = {
762762+ action = "validate";
763763+ use_first_pass = true;
764764+ }; }
765765+ { name = "ccreds-store"; enable = config.security.pam.krb5.enable; control = "sufficient"; modulePath = "${pam_ccreds}/lib/security/pam_ccreds.so"; settings = {
766766+ action = "store";
767767+ use_first_pass = true;
768768+ }; }
769769+ { name = "deny"; control = "required"; modulePath = "pam_deny.so"; }
770770+ ]);
639771640640- # Password management.
641641- '' +
642642- optionalString config.services.homed.enable ''
643643- password sufficient ${config.systemd.package}/lib/security/pam_systemd_home.so
644644- '' + ''
645645- password sufficient pam_unix.so nullok yescrypt
646646- '' +
647647- optionalString config.security.pam.enableEcryptfs ''
648648- password optional ${pkgs.ecryptfs}/lib/security/pam_ecryptfs.so
649649- '' +
650650- optionalString config.security.pam.enableFscrypt ''
651651- password optional ${pkgs.fscrypt-experimental}/lib/security/pam_fscrypt.so
652652- '' +
653653- optionalString cfg.zfs ''
654654- password optional ${config.boot.zfs.package}/lib/security/pam_zfs_key.so homes=${config.security.pam.zfs.homes}
655655- '' +
656656- optionalString cfg.pamMount ''
657657- password optional ${pkgs.pam_mount}/lib/security/pam_mount.so
658658- '' +
659659- optionalString use_ldap ''
660660- password sufficient ${pam_ldap}/lib/security/pam_ldap.so
661661- '' +
662662- optionalString cfg.mysqlAuth ''
663663- password sufficient ${pkgs.pam_mysql}/lib/security/pam_mysql.so config_file=/etc/security/pam_mysql.conf
664664- '' +
665665- optionalString config.services.kanidm.enablePam ''
666666- password sufficient ${pkgs.kanidm}/lib/pam_kanidm.so
667667- '' +
668668- optionalString config.services.sssd.enable ''
669669- password sufficient ${pkgs.sssd}/lib/security/pam_sss.so
670670- '' +
671671- optionalString config.security.pam.krb5.enable ''
672672- password sufficient ${pam_krb5}/lib/security/pam_krb5.so use_first_pass
673673- '' +
674674- optionalString cfg.enableGnomeKeyring ''
675675- password optional ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so use_authtok
676676- '' +
677677- ''
772772+ password = autoOrderRules [
773773+ { name = "systemd_home"; enable = config.services.homed.enable; control = "sufficient"; modulePath = "${config.systemd.package}/lib/security/pam_systemd_home.so"; }
774774+ { name = "unix"; control = "sufficient"; modulePath = "pam_unix.so"; settings = {
775775+ nullok = true;
776776+ yescrypt = true;
777777+ }; }
778778+ { name = "ecryptfs"; enable = config.security.pam.enableEcryptfs; control = "optional"; modulePath = "${pkgs.ecryptfs}/lib/security/pam_ecryptfs.so"; }
779779+ { name = "fscrypt"; enable = config.security.pam.enableFscrypt; control = "optional"; modulePath = "${pkgs.fscrypt-experimental}/lib/security/pam_fscrypt.so"; }
780780+ { name = "zfs_key"; enable = cfg.zfs; control = "optional"; modulePath = "${config.boot.zfs.package}/lib/security/pam_zfs_key.so"; settings = {
781781+ inherit (config.security.pam.zfs) homes;
782782+ }; }
783783+ { name = "mount"; enable = cfg.pamMount; control = "optional"; modulePath = "${pkgs.pam_mount}/lib/security/pam_mount.so"; }
784784+ { name = "ldap"; enable = use_ldap; control = "sufficient"; modulePath = "${pam_ldap}/lib/security/pam_ldap.so"; }
785785+ { name = "mysql"; enable = cfg.mysqlAuth; control = "sufficient"; modulePath = "${pkgs.pam_mysql}/lib/security/pam_mysql.so"; settings = {
786786+ config_file = "/etc/security/pam_mysql.conf";
787787+ }; }
788788+ { name = "kanidm"; enable = config.services.kanidm.enablePam; control = "sufficient"; modulePath = "${pkgs.kanidm}/lib/pam_kanidm.so"; }
789789+ { name = "sss"; enable = config.services.sssd.enable; control = "sufficient"; modulePath = "${pkgs.sssd}/lib/security/pam_sss.so"; }
790790+ { name = "krb5"; enable = config.security.pam.krb5.enable; control = "sufficient"; modulePath = "${pam_krb5}/lib/security/pam_krb5.so"; settings = {
791791+ use_first_pass = true;
792792+ }; }
793793+ { name = "gnome_keyring"; enable = cfg.enableGnomeKeyring; control = "optional"; modulePath = "${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so"; settings = {
794794+ use_authtok = true;
795795+ }; }
796796+ ];
678797679679- # Session management.
680680- '' +
681681- optionalString cfg.setEnvironment ''
682682- session required pam_env.so conffile=/etc/pam/environment readenv=0
683683- '' +
684684- ''
685685- session required pam_unix.so
686686- '' +
687687- optionalString cfg.setLoginUid ''
688688- session ${if config.boot.isContainer then "optional" else "required"} pam_loginuid.so
689689- '' +
690690- optionalString cfg.ttyAudit.enable (concatStringsSep " \\\n " ([
691691- "session required ${pkgs.pam}/lib/security/pam_tty_audit.so"
692692- ] ++ optional cfg.ttyAudit.openOnly "open_only"
693693- ++ optional (cfg.ttyAudit.enablePattern != null) "enable=${cfg.ttyAudit.enablePattern}"
694694- ++ optional (cfg.ttyAudit.disablePattern != null) "disable=${cfg.ttyAudit.disablePattern}"
695695- )) +
696696- optionalString config.services.homed.enable ''
697697- session required ${config.systemd.package}/lib/security/pam_systemd_home.so
698698- '' +
699699- optionalString cfg.makeHomeDir ''
700700- session required ${pkgs.pam}/lib/security/pam_mkhomedir.so silent skel=${config.security.pam.makeHomeDir.skelDirectory} umask=${config.security.pam.makeHomeDir.umask}
701701- '' +
702702- optionalString cfg.updateWtmp ''
703703- session required ${pkgs.pam}/lib/security/pam_lastlog.so silent
704704- '' +
705705- optionalString config.security.pam.enableEcryptfs ''
706706- session optional ${pkgs.ecryptfs}/lib/security/pam_ecryptfs.so
707707- '' +
708708- optionalString config.security.pam.enableFscrypt ''
709709- # Work around https://github.com/systemd/systemd/issues/8598
710710- # Skips the pam_fscrypt module for systemd-user sessions which do not have a password
711711- # anyways.
712712- # See also https://github.com/google/fscrypt/issues/95
713713- session [success=1 default=ignore] pam_succeed_if.so service = systemd-user
714714- session optional ${pkgs.fscrypt-experimental}/lib/security/pam_fscrypt.so
715715- '' +
716716- optionalString cfg.zfs ''
717717- session [success=1 default=ignore] pam_succeed_if.so service = systemd-user
718718- session optional ${config.boot.zfs.package}/lib/security/pam_zfs_key.so homes=${config.security.pam.zfs.homes} ${optionalString config.security.pam.zfs.noUnmount "nounmount"}
719719- '' +
720720- optionalString cfg.pamMount ''
721721- session optional ${pkgs.pam_mount}/lib/security/pam_mount.so disable_interactive
722722- '' +
723723- optionalString use_ldap ''
724724- session optional ${pam_ldap}/lib/security/pam_ldap.so
725725- '' +
726726- optionalString cfg.mysqlAuth ''
727727- session optional ${pkgs.pam_mysql}/lib/security/pam_mysql.so config_file=/etc/security/pam_mysql.conf
728728- '' +
729729- optionalString config.services.kanidm.enablePam ''
730730- session optional ${pkgs.kanidm}/lib/pam_kanidm.so
731731- '' +
732732- optionalString config.services.sssd.enable ''
733733- session optional ${pkgs.sssd}/lib/security/pam_sss.so
734734- '' +
735735- optionalString config.security.pam.krb5.enable ''
736736- session optional ${pam_krb5}/lib/security/pam_krb5.so
737737- '' +
738738- optionalString cfg.otpwAuth ''
739739- session optional ${pkgs.otpw}/lib/security/pam_otpw.so
740740- '' +
741741- optionalString cfg.startSession ''
742742- session optional ${config.systemd.package}/lib/security/pam_systemd.so
743743- '' +
744744- optionalString cfg.forwardXAuth ''
745745- session optional pam_xauth.so xauthpath=${pkgs.xorg.xauth}/bin/xauth systemuser=99
746746- '' +
747747- optionalString (cfg.limits != []) ''
748748- session required ${pkgs.pam}/lib/security/pam_limits.so conf=${makeLimitsConf cfg.limits}
749749- '' +
750750- optionalString (cfg.showMotd && (config.users.motd != null || config.users.motdFile != null)) ''
751751- session optional ${pkgs.pam}/lib/security/pam_motd.so motd=${motd}
752752- '' +
753753- optionalString (cfg.enableAppArmor && config.security.apparmor.enable) ''
754754- session optional ${pkgs.apparmor-pam}/lib/security/pam_apparmor.so order=user,group,default debug
755755- '' +
756756- optionalString (cfg.enableKwallet) ''
757757- session optional ${pkgs.plasma5Packages.kwallet-pam}/lib/security/pam_kwallet5.so kwalletd=${pkgs.plasma5Packages.kwallet.bin}/bin/kwalletd5
758758- '' +
759759- optionalString (cfg.enableGnomeKeyring) ''
760760- session optional ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so auto_start
761761- '' +
762762- optionalString cfg.gnupg.enable ''
763763- session optional ${pkgs.pam_gnupg}/lib/security/pam_gnupg.so ${optionalString cfg.gnupg.noAutostart " no-autostart"}
764764- '' +
765765- optionalString (config.virtualisation.lxc.lxcfs.enable) ''
766766- session optional ${pkgs.lxc}/lib/security/pam_cgfs.so -c all
767767- ''
768768- );
798798+ session = autoOrderRules [
799799+ { name = "env"; enable = cfg.setEnvironment; control = "required"; modulePath = "pam_env.so"; settings = {
800800+ conffile = "/etc/pam/environment";
801801+ readenv = 0;
802802+ }; }
803803+ { name = "unix"; control = "required"; modulePath = "pam_unix.so"; }
804804+ { name = "loginuid"; enable = cfg.setLoginUid; control = if config.boot.isContainer then "optional" else "required"; modulePath = "pam_loginuid.so"; }
805805+ { name = "tty_audit"; enable = cfg.ttyAudit.enable; control = "required"; modulePath = "${pkgs.pam}/lib/security/pam_tty_audit.so"; settings = {
806806+ open_only = cfg.ttyAudit.openOnly;
807807+ enable = cfg.ttyAudit.enablePattern;
808808+ disable = cfg.ttyAudit.disablePattern;
809809+ }; }
810810+ { name = "systemd_home"; enable = config.services.homed.enable; control = "required"; modulePath = "${config.systemd.package}/lib/security/pam_systemd_home.so"; }
811811+ { name = "mkhomedir"; enable = cfg.makeHomeDir; control = "required"; modulePath = "${pkgs.pam}/lib/security/pam_mkhomedir.so"; settings = {
812812+ silent = true;
813813+ skel = config.security.pam.makeHomeDir.skelDirectory;
814814+ inherit (config.security.pam.makeHomeDir) umask;
815815+ }; }
816816+ { name = "lastlog"; enable = cfg.updateWtmp; control = "required"; modulePath = "${pkgs.pam}/lib/security/pam_lastlog.so"; settings = {
817817+ silent = true;
818818+ }; }
819819+ { name = "ecryptfs"; enable = config.security.pam.enableEcryptfs; control = "optional"; modulePath = "${pkgs.ecryptfs}/lib/security/pam_ecryptfs.so"; }
820820+ # Work around https://github.com/systemd/systemd/issues/8598
821821+ # Skips the pam_fscrypt module for systemd-user sessions which do not have a password
822822+ # anyways.
823823+ # See also https://github.com/google/fscrypt/issues/95
824824+ { name = "fscrypt-skip-systemd"; enable = config.security.pam.enableFscrypt; control = "[success=1 default=ignore]"; modulePath = "pam_succeed_if.so"; args = [
825825+ "service" "=" "systemd-user"
826826+ ]; }
827827+ { name = "fscrypt"; enable = config.security.pam.enableFscrypt; control = "optional"; modulePath = "${pkgs.fscrypt-experimental}/lib/security/pam_fscrypt.so"; }
828828+ { name = "zfs_key-skip-systemd"; enable = cfg.zfs; control = "[success=1 default=ignore]"; modulePath = "pam_succeed_if.so"; args = [
829829+ "service" "=" "systemd-user"
830830+ ]; }
831831+ { name = "zfs_key"; enable = cfg.zfs; control = "optional"; modulePath = "${config.boot.zfs.package}/lib/security/pam_zfs_key.so"; settings = {
832832+ inherit (config.security.pam.zfs) homes;
833833+ nounmount = config.security.pam.zfs.noUnmount;
834834+ }; }
835835+ { name = "mount"; enable = cfg.pamMount; control = "optional"; modulePath = "${pkgs.pam_mount}/lib/security/pam_mount.so"; settings = {
836836+ disable_interactive = true;
837837+ }; }
838838+ { name = "ldap"; enable = use_ldap; control = "optional"; modulePath = "${pam_ldap}/lib/security/pam_ldap.so"; }
839839+ { name = "mysql"; enable = cfg.mysqlAuth; control = "optional"; modulePath = "${pkgs.pam_mysql}/lib/security/pam_mysql.so"; settings = {
840840+ config_file = "/etc/security/pam_mysql.conf";
841841+ }; }
842842+ { name = "kanidm"; enable = config.services.kanidm.enablePam; control = "optional"; modulePath = "${pkgs.kanidm}/lib/pam_kanidm.so"; }
843843+ { name = "sss"; enable = config.services.sssd.enable; control = "optional"; modulePath = "${pkgs.sssd}/lib/security/pam_sss.so"; }
844844+ { name = "krb5"; enable = config.security.pam.krb5.enable; control = "optional"; modulePath = "${pam_krb5}/lib/security/pam_krb5.so"; }
845845+ { name = "otpw"; enable = cfg.otpwAuth; control = "optional"; modulePath = "${pkgs.otpw}/lib/security/pam_otpw.so"; }
846846+ { name = "systemd"; enable = cfg.startSession; control = "optional"; modulePath = "${config.systemd.package}/lib/security/pam_systemd.so"; }
847847+ { name = "xauth"; enable = cfg.forwardXAuth; control = "optional"; modulePath = "pam_xauth.so"; settings = {
848848+ xauthpath = "${pkgs.xorg.xauth}/bin/xauth";
849849+ systemuser = 99;
850850+ }; }
851851+ { name = "limits"; enable = cfg.limits != []; control = "required"; modulePath = "${pkgs.pam}/lib/security/pam_limits.so"; settings = {
852852+ conf = "${makeLimitsConf cfg.limits}";
853853+ }; }
854854+ { name = "motd"; enable = cfg.showMotd && (config.users.motd != null || config.users.motdFile != null); control = "optional"; modulePath = "${pkgs.pam}/lib/security/pam_motd.so"; settings = {
855855+ inherit motd;
856856+ }; }
857857+ { name = "apparmor"; enable = cfg.enableAppArmor && config.security.apparmor.enable; control = "optional"; modulePath = "${pkgs.apparmor-pam}/lib/security/pam_apparmor.so"; settings = {
858858+ order = "user,group,default";
859859+ debug = true;
860860+ }; }
861861+ { name = "kwallet5"; enable = cfg.enableKwallet; control = "optional"; modulePath = "${pkgs.plasma5Packages.kwallet-pam}/lib/security/pam_kwallet5.so"; settings = {
862862+ kwalletd = "${pkgs.plasma5Packages.kwallet.bin}/bin/kwalletd5";
863863+ }; }
864864+ { name = "gnome_keyring"; enable = cfg.enableGnomeKeyring; control = "optional"; modulePath = "${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so"; settings = {
865865+ auto_start = true;
866866+ }; }
867867+ { name = "gnupg"; enable = cfg.gnupg.enable; control = "optional"; modulePath = "${pkgs.pam_gnupg}/lib/security/pam_gnupg.so"; settings = {
868868+ no-autostart = cfg.gnupg.noAutostart;
869869+ }; }
870870+ { name = "cgfs"; enable = config.virtualisation.lxc.lxcfs.enable; control = "optional"; modulePath = "${pkgs.lxc}/lib/security/pam_cgfs.so"; args = [
871871+ "-c" "all"
872872+ ]; }
873873+ ];
874874+ };
769875 };
770876771877 };
···840946in
841947842948{
949949+950950+ meta.maintainers = [ maintainers.majiir ];
843951844952 imports = [
845953 (mkRenamedOptionModule [ "security" "pam" "enableU2F" ] [ "security" "pam" "u2f" "enable" ])
···14021510 fscrypt = {};
14031511 };
1404151214051405- security.apparmor.includes."abstractions/pam" = let
14061406- isEnabled = test: fold or false (map test (attrValues config.security.pam.services));
14071407- in
15131513+ security.apparmor.includes."abstractions/pam" =
14081514 lib.concatMapStrings
14091515 (name: "r ${config.environment.etc."pam.d/${name}".source},\n")
14101516 (attrNames config.security.pam.services) +
···14131519 mr ${getLib pkgs.pam}/lib/security/pam_*.so,
14141520 r ${getLib pkgs.pam}/lib/security/,
14151521 '' +
14161416- optionalString use_ldap ''
14171417- mr ${pam_ldap}/lib/security/pam_ldap.so,
14181418- '' +
14191419- optionalString config.services.kanidm.enablePam ''
14201420- mr ${pkgs.kanidm}/lib/pam_kanidm.so,
14211421- '' +
14221422- optionalString config.services.sssd.enable ''
14231423- mr ${pkgs.sssd}/lib/security/pam_sss.so,
14241424- '' +
14251425- optionalString config.security.pam.krb5.enable ''
14261426- mr ${pam_krb5}/lib/security/pam_krb5.so,
14271427- mr ${pam_ccreds}/lib/security/pam_ccreds.so,
14281428- '' +
14291429- optionalString (isEnabled (cfg: cfg.googleOsLoginAccountVerification)) ''
14301430- mr ${pkgs.google-guest-oslogin}/lib/security/pam_oslogin_login.so,
14311431- mr ${pkgs.google-guest-oslogin}/lib/security/pam_oslogin_admin.so,
14321432- '' +
14331433- optionalString (isEnabled (cfg: cfg.googleOsLoginAuthentication)) ''
14341434- mr ${pkgs.google-guest-oslogin}/lib/security/pam_oslogin_login.so,
14351435- '' +
14361436- optionalString (config.security.pam.enableSSHAgentAuth
14371437- && isEnabled (cfg: cfg.sshAgentAuth)) ''
14381438- mr ${pkgs.pam_ssh_agent_auth}/libexec/pam_ssh_agent_auth.so,
14391439- '' +
14401440- optionalString (isEnabled (cfg: cfg.fprintAuth)) ''
14411441- mr ${pkgs.fprintd}/lib/security/pam_fprintd.so,
14421442- '' +
14431443- optionalString (isEnabled (cfg: cfg.u2fAuth)) ''
14441444- mr ${pkgs.pam_u2f}/lib/security/pam_u2f.so,
14451445- '' +
14461446- optionalString (isEnabled (cfg: cfg.usbAuth)) ''
14471447- mr ${pkgs.pam_usb}/lib/security/pam_usb.so,
14481448- '' +
14491449- optionalString (isEnabled (cfg: cfg.usshAuth)) ''
14501450- mr ${pkgs.pam_ussh}/lib/security/pam_ussh.so,
14511451- '' +
14521452- optionalString (isEnabled (cfg: cfg.oathAuth)) ''
14531453- "mr ${pkgs.oath-toolkit}/lib/security/pam_oath.so,
14541454- '' +
14551455- optionalString (isEnabled (cfg: cfg.mysqlAuth)) ''
14561456- mr ${pkgs.pam_mysql}/lib/security/pam_mysql.so,
14571457- '' +
14581458- optionalString (isEnabled (cfg: cfg.yubicoAuth)) ''
14591459- mr ${pkgs.yubico-pam}/lib/security/pam_yubico.so,
14601460- '' +
14611461- optionalString (isEnabled (cfg: cfg.duoSecurity.enable)) ''
14621462- mr ${pkgs.duo-unix}/lib/security/pam_duo.so,
14631463- '' +
14641464- optionalString (isEnabled (cfg: cfg.otpwAuth)) ''
14651465- mr ${pkgs.otpw}/lib/security/pam_otpw.so,
14661466- '' +
14671467- optionalString config.security.pam.enableEcryptfs ''
14681468- mr ${pkgs.ecryptfs}/lib/security/pam_ecryptfs.so,
14691469- '' +
14701470- optionalString config.security.pam.enableFscrypt ''
14711471- mr ${pkgs.fscrypt-experimental}/lib/security/pam_fscrypt.so,
14721472- '' +
14731473- optionalString (isEnabled (cfg: cfg.pamMount)) ''
14741474- mr ${pkgs.pam_mount}/lib/security/pam_mount.so,
14751475- '' +
14761476- optionalString (isEnabled (cfg: cfg.enableGnomeKeyring)) ''
14771477- mr ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so,
14781478- '' +
14791479- optionalString (isEnabled (cfg: cfg.startSession)) ''
14801480- mr ${config.systemd.package}/lib/security/pam_systemd.so,
14811481- '' +
14821482- optionalString (isEnabled (cfg: cfg.enableAppArmor)
14831483- && config.security.apparmor.enable) ''
14841484- mr ${pkgs.apparmor-pam}/lib/security/pam_apparmor.so,
14851485- '' +
14861486- optionalString (isEnabled (cfg: cfg.enableKwallet)) ''
14871487- mr ${pkgs.plasma5Packages.kwallet-pam}/lib/security/pam_kwallet5.so,
14881488- '' +
14891489- optionalString config.virtualisation.lxc.lxcfs.enable ''
14901490- mr ${pkgs.lxc}/lib/security/pam_cgfs.so,
14911491- '' +
14921492- optionalString (isEnabled (cfg: cfg.zfs)) ''
14931493- mr ${config.boot.zfs.package}/lib/security/pam_zfs_key.so,
14941494- '' +
14951495- optionalString config.services.homed.enable ''
14961496- mr ${config.systemd.package}/lib/security/pam_systemd_home.so
14971497- '';
15221522+ (with lib; pipe config.security.pam.services [
15231523+ attrValues
15241524+ (catAttrs "rules")
15251525+ (concatMap attrValues)
15261526+ (concatMap attrValues)
15271527+ (filter (rule: rule.enable))
15281528+ (catAttrs "modulePath")
15291529+ (filter (hasPrefix "/"))
15301530+ unique
15311531+ (map (module: "mr ${module},"))
15321532+ concatLines
15331533+ ]);
14981534 };
1499153515001536}
···66 "auth required pam_deny.so",
77 "auth sufficient @@pam_ccreds@@/lib/security/pam_ccreds.so action=store use_first_pass",
88 "auth sufficient pam_rootok.so",
99- "auth sufficient pam_unix.so likeauth try_first_pass",
99+ "auth sufficient pam_unix.so likeauth try_first_pass",
1010 "password sufficient @@pam_krb5@@/lib/security/pam_krb5.so use_first_pass",
1111 "password sufficient pam_unix.so nullok yescrypt",
1212 "session optional @@pam_krb5@@/lib/security/pam_krb5.so",
···1515}
1616actual_lines = set(machine.succeed("cat /etc/pam.d/chfn").splitlines())
17171818-missing_lines = expected_lines - actual_lines
1919-extra_lines = actual_lines - expected_lines
2020-non_functional_lines = set([line for line in extra_lines if (line == "" or line.startswith("#"))])
1818+stripped_lines = set([line.split("#")[0].rstrip() for line in actual_lines])
1919+missing_lines = expected_lines - stripped_lines
2020+extra_lines = stripped_lines - expected_lines
2121+non_functional_lines = set([line for line in extra_lines if line == ""])
2122unexpected_functional_lines = extra_lines - non_functional_lines
22232324with subtest("All expected lines are in the file"):
-10
nixos/tests/systemd-repart.nix
···2929 "+32M",
3030 ])
31313232- # Fix the GPT table by moving the backup table to the end of the enlarged
3333- # disk image. This is necessary because we increased the size of the disk
3434- # before. The disk needs to be a raw disk because sgdisk can only run on
3535- # raw images.
3636- subprocess.run([
3737- "${pkgs.gptfdisk}/bin/sgdisk",
3838- "--move-second-header",
3939- tmp_disk_image.name,
4040- ])
4141-4232 # Set NIX_DISK_IMAGE so that the qemu script finds the right disk image.
4333 os.environ['NIX_DISK_IMAGE'] = tmp_disk_image.name
4434 '';
···3838 buildHashes = builtins.fromJSON (builtins.readFile ./hashes.json);
39394040 # our version of buck2; this should be a git tag
4141- version = "2023-10-01";
4141+ version = "2023-10-15";
42424343 # the platform-specific, statically linked binary — which is also
4444 # zstd-compressed
···6363 # tooling
6464 prelude-src =
6565 let
6666- prelude-hash = "75aa81a92edd2bf477538f9a3f0fe6a47e811842";
6666+ prelude-hash = "880be565178cf1e08ce9badef52b215f91e48479";
6767 name = "buck2-prelude-${version}.tar.gz";
6868 hash = buildHashes."_prelude";
6969 url = "https://github.com/facebook/buck2-prelude/archive/${prelude-hash}.tar.gz";
···166166167167 ### D ###
168168169169+ dagger = throw "'dagger' has been removed from nixpkgs, as the trademark policy of the upstream project is incompatible"; # Added 2023-10-16
169170 dart_stable = dart; # Added 2020-01-15
170171 dat = nodePackages.dat;
171172 deadpixi-sam = deadpixi-sam-unstable;
···285285 pylibgen = throw "pylibgen is unmaintained upstreamed, and removed from nixpkgs"; # added 2020-06-20
286286 PyLD = pyld; # added 2022-06-22
287287 pymatgen-lammps = throw "pymatgen-lammps has been removed because it is unmaintained and broken"; # added 2023-06-20
288288+ pymazda = throw "pymazda has been removed, because the upstream repo has been affected by a DCMA claim."; # added 2023-10-16
288289 pymc3 = pymc; # added 2022-06-05, module was rename starting with 4.0.0
289290 pymssql = throw "pymssql has been abandoned upstream."; # added 2020-05-04
290291 PyMVGLive = pymvglive; # added 2023-02-19