Skip to content

Commit 579d6f9

Browse files
committed
freeipa: Add support for subUIDs and subGIDs
1 parent a4f6b5c commit 579d6f9

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

nixos/modules/config/nsswitch.nix

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,30 @@
9797
'';
9898
default = [ ];
9999
};
100+
101+
subuid = lib.mkOption {
102+
type = lib.types.listOf lib.types.str;
103+
description = ''
104+
List of subuid entries to configure in {file}`/etc/nsswitch.conf`.
105+
106+
Note that "files" is always prepended.
107+
108+
This option only takes effect if nscd is enabled.
109+
'';
110+
default = [ ];
111+
};
112+
113+
subgid = lib.mkOption {
114+
type = lib.types.listOf lib.types.str;
115+
description = ''
116+
List of subgid entries to configure in {file}`/etc/nsswitch.conf`.
117+
118+
Note that "files" is always prepended.
119+
120+
This option only takes effect if nscd is enabled.
121+
'';
122+
default = [ ];
123+
};
100124
};
101125
};
102126

@@ -133,6 +157,9 @@
133157
services: ${lib.concatStringsSep " " config.system.nssDatabases.services}
134158
protocols: files
135159
rpc: files
160+
161+
subuid: ${lib.concatStringsSep " " config.system.nssDatabases.subuid}
162+
subgid: ${lib.concatStringsSep " " config.system.nssDatabases.subgid}
136163
'';
137164

138165
system.nssDatabases = {
@@ -145,6 +172,8 @@
145172
(lib.mkOrder 1499 [ "dns" ])
146173
];
147174
services = lib.mkBefore [ "files" ];
175+
subuid = lib.mkBefore [ "files" ];
176+
subgid = lib.mkBefore [ "files" ];
148177
};
149178
};
150179
}

nixos/modules/security/ipa.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ in
307307
allowed_uids = lib.concatStringsSep ", " cfg.ifpAllowedUids;
308308
};
309309
};
310+
subIDsIntegration = true;
310311
};
311312

312313
networking.timeServers = lib.optional cfg.useAsTimeserver cfg.server;

nixos/modules/services/misc/sssd.nix

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,15 @@ in
9393
Kerberos will be configured to cache credentials in SSS.
9494
'';
9595
};
96+
97+
subIDsIntegration = lib.mkOption {
98+
type = lib.types.bool;
99+
default = false;
100+
description = ''
101+
Whether to use SSS as a source for subuid and subgid.
102+
'';
103+
};
104+
96105
environmentFile = lib.mkOption {
97106
type = lib.types.nullOr lib.types.path;
98107
default = null;
@@ -246,6 +255,11 @@ in
246255
services.openssh.authorizedKeysCommand = "/etc/ssh/authorized_keys_command";
247256
services.openssh.authorizedKeysCommandUser = "nobody";
248257
})
258+
259+
(lib.mkIf cfg.subIDsIntegration {
260+
system.nssDatabases.subuid = [ "sss" ];
261+
system.nssDatabases.subgid = [ "sss" ];
262+
})
249263
];
250264

251265
meta.maintainers = with lib.maintainers; [ bbigras ];

0 commit comments

Comments
 (0)