diff --git a/nixos/modules/config/nsswitch.nix b/nixos/modules/config/nsswitch.nix index 354c506e0ae89..797d2422e27c0 100644 --- a/nixos/modules/config/nsswitch.nix +++ b/nixos/modules/config/nsswitch.nix @@ -97,6 +97,30 @@ ''; default = [ ]; }; + + subuid = lib.mkOption { + type = lib.types.listOf lib.types.str; + description = '' + List of subuid entries to configure in {file}`/etc/nsswitch.conf`. + + Note that "files" is always prepended. + + This option only takes effect if nscd is enabled. + ''; + default = [ ]; + }; + + subgid = lib.mkOption { + type = lib.types.listOf lib.types.str; + description = '' + List of subgid entries to configure in {file}`/etc/nsswitch.conf`. + + Note that "files" is always prepended. + + This option only takes effect if nscd is enabled. + ''; + default = [ ]; + }; }; }; @@ -133,6 +157,9 @@ services: ${lib.concatStringsSep " " config.system.nssDatabases.services} protocols: files rpc: files + + subuid: ${lib.concatStringsSep " " config.system.nssDatabases.subuid} + subgid: ${lib.concatStringsSep " " config.system.nssDatabases.subgid} ''; system.nssDatabases = { @@ -145,6 +172,8 @@ (lib.mkOrder 1499 [ "dns" ]) ]; services = lib.mkBefore [ "files" ]; + subuid = lib.mkBefore [ "files" ]; + subgid = lib.mkBefore [ "files" ]; }; }; } diff --git a/nixos/modules/security/ipa.nix b/nixos/modules/security/ipa.nix index b9ed5ff36bf75..0951cc0d262de 100644 --- a/nixos/modules/security/ipa.nix +++ b/nixos/modules/security/ipa.nix @@ -307,6 +307,7 @@ in allowed_uids = lib.concatStringsSep ", " cfg.ifpAllowedUids; }; }; + subIDsIntegration = true; }; networking.timeServers = lib.optional cfg.useAsTimeserver cfg.server; diff --git a/nixos/modules/services/misc/sssd.nix b/nixos/modules/services/misc/sssd.nix index 05351a040916c..5a4c3a3f45cad 100644 --- a/nixos/modules/services/misc/sssd.nix +++ b/nixos/modules/services/misc/sssd.nix @@ -93,6 +93,15 @@ in Kerberos will be configured to cache credentials in SSS. ''; }; + + subIDsIntegration = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Whether to use SSS as a source for subuid and subgid. + ''; + }; + environmentFile = lib.mkOption { type = lib.types.nullOr lib.types.path; default = null; @@ -246,6 +255,11 @@ in services.openssh.authorizedKeysCommand = "/etc/ssh/authorized_keys_command"; services.openssh.authorizedKeysCommandUser = "nobody"; }) + + (lib.mkIf cfg.subIDsIntegration { + system.nssDatabases.subuid = [ "sss" ]; + system.nssDatabases.subgid = [ "sss" ]; + }) ]; meta.maintainers = with lib.maintainers; [ bbigras ];