nixos/dhcpd: Use dhcp user instead of nobody
This commit is contained in:
parent
4fbf120e84
commit
24368beed8
@ -140,6 +140,7 @@
|
|||||||
mopidy = 130;
|
mopidy = 130;
|
||||||
unifi = 131;
|
unifi = 131;
|
||||||
gdm = 132;
|
gdm = 132;
|
||||||
|
dhcpd = 133;
|
||||||
|
|
||||||
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
|
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
|
||||||
|
|
||||||
|
@ -66,24 +66,6 @@ in
|
|||||||
";
|
";
|
||||||
};
|
};
|
||||||
|
|
||||||
user = mkOption {
|
|
||||||
default = "nobody";
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
description = ''
|
|
||||||
The user to drop privileges to after the daemon has started.
|
|
||||||
A value of null disables the user privilege change.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
group = mkOption {
|
|
||||||
default = "nogroup";
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
description = ''
|
|
||||||
The group to drop privileges to after the daemon has started.
|
|
||||||
A value of null disables the group privilege change.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
configFile = mkOption {
|
configFile = mkOption {
|
||||||
default = null;
|
default = null;
|
||||||
description = "
|
description = "
|
||||||
@ -126,6 +108,13 @@ in
|
|||||||
|
|
||||||
config = mkIf config.services.dhcpd.enable {
|
config = mkIf config.services.dhcpd.enable {
|
||||||
|
|
||||||
|
users = {
|
||||||
|
extraUsers.dhcpd = {
|
||||||
|
uid = config.ids.uids.dhcpd;
|
||||||
|
description = "DHCP daemon user";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
jobs.dhcpd =
|
jobs.dhcpd =
|
||||||
{ description = "DHCP server";
|
{ description = "DHCP server";
|
||||||
|
|
||||||
@ -139,9 +128,7 @@ in
|
|||||||
touch ${stateDir}/dhcpd.leases
|
touch ${stateDir}/dhcpd.leases
|
||||||
|
|
||||||
exec ${pkgs.dhcp}/sbin/dhcpd -f --no-pid -cf ${configFile} \
|
exec ${pkgs.dhcp}/sbin/dhcpd -f --no-pid -cf ${configFile} \
|
||||||
-lf ${stateDir}/dhcpd.leases \
|
-lf ${stateDir}/dhcpd.leases -user dhcpd -group nogroup \
|
||||||
${optionalString (cfg.user != null) "-user ${cfg.user}"} \
|
|
||||||
${optionalString (cfg.group != null) "-group ${cfg.group}"} \
|
|
||||||
${toString cfg.interfaces}
|
${toString cfg.interfaces}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user