nixos/powerdns: use upstream systemd unit
This commit is contained in:
parent
603f0dcae8
commit
4f5d3794d3
@ -8,42 +8,40 @@ let
|
|||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
services.powerdns = {
|
services.powerdns = {
|
||||||
enable = mkEnableOption "Powerdns domain name server";
|
enable = mkEnableOption "PowerDNS domain name server";
|
||||||
|
|
||||||
extraConfig = mkOption {
|
extraConfig = mkOption {
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
default = "launch=bind";
|
default = "launch=bind";
|
||||||
description = ''
|
description = ''
|
||||||
Extra lines to be added verbatim to pdns.conf.
|
PowerDNS configuration. Refer to
|
||||||
Powerdns will chroot to /var/lib/powerdns.
|
<link xlink:href="https://doc.powerdns.com/authoritative/settings.html"/>
|
||||||
So any file, powerdns is supposed to be read,
|
for details on supported values.
|
||||||
should be in /var/lib/powerdns and needs to specified
|
|
||||||
relative to the chroot.
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf config.services.powerdns.enable {
|
config = mkIf cfg.enable {
|
||||||
|
|
||||||
|
systemd.packages = [ pkgs.powerdns ];
|
||||||
|
|
||||||
systemd.services.pdns = {
|
systemd.services.pdns = {
|
||||||
unitConfig.Documentation = "man:pdns_server(1) man:pdns_control(1)";
|
|
||||||
description = "Powerdns name server";
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = ["network.target" "mysql.service" "postgresql.service" "openldap.service"];
|
after = [ "network.target" "mysql.service" "postgresql.service" "openldap.service" ];
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Restart="on-failure";
|
ExecStart = [ "" "${pkgs.powerdns}/bin/pdns_server --config-dir=${configDir} --guardian=no --daemon=no --disable-syslog --log-timestamp=no --write-pid=no" ];
|
||||||
RestartSec="1";
|
|
||||||
StartLimitInterval="0";
|
|
||||||
PrivateDevices=true;
|
|
||||||
CapabilityBoundingSet="CAP_CHOWN CAP_NET_BIND_SERVICE CAP_SETGID CAP_SETUID CAP_SYS_CHROOT";
|
|
||||||
NoNewPrivileges=true;
|
|
||||||
ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p /var/lib/powerdns";
|
|
||||||
ExecStart = "${pkgs.powerdns}/bin/pdns_server --setuid=nobody --setgid=nogroup --chroot=/var/lib/powerdns --socket-dir=/ --daemon=no --guardian=no --disable-syslog --write-pid=no --config-dir=${configDir}";
|
|
||||||
ProtectSystem="full";
|
|
||||||
ProtectHome=true;
|
|
||||||
RestrictAddressFamilies="AF_UNIX AF_INET AF_INET6";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
users.users.pdns = {
|
||||||
|
isSystemUser = true;
|
||||||
|
group = "pdns";
|
||||||
|
description = "PowerDNS";
|
||||||
|
};
|
||||||
|
|
||||||
|
users.groups.pdns = {};
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user