mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 00:12:56 +00:00
nixos/dhcpd: Use dhcp user instead of nobody
This commit is contained in:
parent
4fbf120e84
commit
24368beed8
@ -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!
|
||||
|
||||
|
@ -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}
|
||||
'';
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user