nixos/dhcpd: Use dhcp user instead of nobody

This commit is contained in:
William A. Kennington III 2014-06-25 03:28:53 -05:00
parent 4fbf120e84
commit 24368beed8
2 changed files with 9 additions and 21 deletions

View file

@ -140,6 +140,7 @@
mopidy = 130;
unifi = 131;
gdm = 132;
dhcpd = 133;
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!

View file

@ -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 {
default = null;
description = "
@ -126,6 +108,13 @@ in
config = mkIf config.services.dhcpd.enable {
users = {
extraUsers.dhcpd = {
uid = config.ids.uids.dhcpd;
description = "DHCP daemon user";
};
};
jobs.dhcpd =
{ description = "DHCP server";
@ -139,9 +128,7 @@ in
touch ${stateDir}/dhcpd.leases
exec ${pkgs.dhcp}/sbin/dhcpd -f --no-pid -cf ${configFile} \
-lf ${stateDir}/dhcpd.leases \
${optionalString (cfg.user != null) "-user ${cfg.user}"} \
${optionalString (cfg.group != null) "-group ${cfg.group}"} \
-lf ${stateDir}/dhcpd.leases -user dhcpd -group nogroup \
${toString cfg.interfaces}
'';
};