unbound service: add fetching root anchor for DNSSEC
This commit is contained in:
parent
9ba533ee4a
commit
483e78d0f0
@ -16,6 +16,11 @@ let
|
|||||||
"forward-zone:\n name: .\n" +
|
"forward-zone:\n name: .\n" +
|
||||||
concatMapStrings (x: " forward-addr: ${x}\n") cfg.forwardAddresses;
|
concatMapStrings (x: " forward-addr: ${x}\n") cfg.forwardAddresses;
|
||||||
|
|
||||||
|
rootTrustAnchorFile = "${stateDir}/root.key";
|
||||||
|
|
||||||
|
trustAnchor = optionalString cfg.enableRootTrustAnchor
|
||||||
|
"auto-trust-anchor-file: ${rootTrustAnchorFile}";
|
||||||
|
|
||||||
confFile = pkgs.writeText "unbound.conf" ''
|
confFile = pkgs.writeText "unbound.conf" ''
|
||||||
server:
|
server:
|
||||||
directory: "${stateDir}"
|
directory: "${stateDir}"
|
||||||
@ -24,6 +29,7 @@ let
|
|||||||
pidfile: ""
|
pidfile: ""
|
||||||
${interfaces}
|
${interfaces}
|
||||||
${access}
|
${access}
|
||||||
|
${trustAnchor}
|
||||||
${cfg.extraConfig}
|
${cfg.extraConfig}
|
||||||
${forward}
|
${forward}
|
||||||
'';
|
'';
|
||||||
@ -61,6 +67,12 @@ in
|
|||||||
description = "What servers to forward queries to.";
|
description = "What servers to forward queries to.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enableRootTrustAnchor = mkOption {
|
||||||
|
default = true;
|
||||||
|
type = types.bool;
|
||||||
|
description = "Use and update root trust anchor for DNSSEC validation.";
|
||||||
|
};
|
||||||
|
|
||||||
extraConfig = mkOption {
|
extraConfig = mkOption {
|
||||||
default = "";
|
default = "";
|
||||||
type = types.str;
|
type = types.str;
|
||||||
@ -94,7 +106,8 @@ in
|
|||||||
preStart = ''
|
preStart = ''
|
||||||
mkdir -m 0755 -p ${stateDir}/dev/
|
mkdir -m 0755 -p ${stateDir}/dev/
|
||||||
cp ${confFile} ${stateDir}/unbound.conf
|
cp ${confFile} ${stateDir}/unbound.conf
|
||||||
chown unbound ${stateDir}
|
${pkgs.unbound}/bin/unbound-anchor -a ${rootTrustAnchorFile}
|
||||||
|
chown unbound ${stateDir} ${rootTrustAnchorFile}
|
||||||
touch ${stateDir}/dev/random
|
touch ${stateDir}/dev/random
|
||||||
${pkgs.utillinux}/bin/mount --bind -n /dev/random ${stateDir}/dev/random
|
${pkgs.utillinux}/bin/mount --bind -n /dev/random ${stateDir}/dev/random
|
||||||
'';
|
'';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user