nsd service: code cleanup
Puts everything in alphanumeric order and removes unnecessary spaces to better match NixOS coding style.
This commit is contained in:
parent
a0753c7cb2
commit
8442a7d12c
@ -30,59 +30,60 @@ let
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# options are ordered alphanumerically by the nixos option name
|
||||||
configFile = pkgs.writeText "nsd.conf" ''
|
configFile = pkgs.writeText "nsd.conf" ''
|
||||||
server:
|
server:
|
||||||
username: ${username}
|
|
||||||
chroot: "${stateDir}"
|
chroot: "${stateDir}"
|
||||||
|
username: ${username}
|
||||||
|
|
||||||
# The directory for zonefile: files. The daemon chdirs here.
|
# The directory for zonefile: files. The daemon chdirs here.
|
||||||
zonesdir: "${stateDir}"
|
zonesdir: "${stateDir}"
|
||||||
|
|
||||||
# the list of dynamically added zones.
|
# the list of dynamically added zones.
|
||||||
zonelistfile: "${stateDir}/var/zone.list"
|
|
||||||
database: "${stateDir}/var/nsd.db"
|
database: "${stateDir}/var/nsd.db"
|
||||||
pidfile: "${pidFile}"
|
pidfile: "${pidFile}"
|
||||||
xfrdfile: "${stateDir}/var/xfrd.state"
|
xfrdfile: "${stateDir}/var/xfrd.state"
|
||||||
xfrdir: "${stateDir}/tmp"
|
xfrdir: "${stateDir}/tmp"
|
||||||
|
zonelistfile: "${stateDir}/var/zone.list"
|
||||||
|
|
||||||
# interfaces
|
# interfaces
|
||||||
${forEach " ip-address: " cfg.interfaces}
|
${forEach " ip-address: " cfg.interfaces}
|
||||||
|
|
||||||
server-count: ${toString cfg.serverCount}
|
|
||||||
ip-transparent: ${yesOrNo cfg.ipTransparent}
|
|
||||||
do-ip4: ${yesOrNo cfg.ipv4}
|
|
||||||
do-ip6: ${yesOrNo cfg.ipv6}
|
|
||||||
port: ${toString cfg.port}
|
|
||||||
verbosity: ${toString cfg.verbosity}
|
|
||||||
hide-version: ${yesOrNo cfg.hideVersion}
|
hide-version: ${yesOrNo cfg.hideVersion}
|
||||||
identity: "${cfg.identity}"
|
identity: "${cfg.identity}"
|
||||||
|
ip-transparent: ${yesOrNo cfg.ipTransparent}
|
||||||
|
do-ip4: ${yesOrNo cfg.ipv4}
|
||||||
|
ipv4-edns-size: ${toString cfg.ipv4EDNSSize}
|
||||||
|
do-ip6: ${yesOrNo cfg.ipv6}
|
||||||
|
ipv6-edns-size: ${toString cfg.ipv6EDNSSize}
|
||||||
${maybeString "nsid: " cfg.nsid}
|
${maybeString "nsid: " cfg.nsid}
|
||||||
|
port: ${toString cfg.port}
|
||||||
|
server-count: ${toString cfg.serverCount}
|
||||||
|
${if cfg.statistics == null then "" else "statistics: ${toString cfg.statistics}"}
|
||||||
tcp-count: ${toString cfg.tcpCount}
|
tcp-count: ${toString cfg.tcpCount}
|
||||||
tcp-query-count: ${toString cfg.tcpQueryCount}
|
tcp-query-count: ${toString cfg.tcpQueryCount}
|
||||||
tcp-timeout: ${toString cfg.tcpTimeout}
|
tcp-timeout: ${toString cfg.tcpTimeout}
|
||||||
ipv4-edns-size: ${toString cfg.ipv4EDNSSize}
|
verbosity: ${toString cfg.verbosity}
|
||||||
ipv6-edns-size: ${toString cfg.ipv6EDNSSize}
|
|
||||||
${if cfg.statistics == null then "" else "statistics: ${toString cfg.statistics}"}
|
|
||||||
xfrd-reload-timeout: ${toString cfg.xfrdReloadTimeout}
|
xfrd-reload-timeout: ${toString cfg.xfrdReloadTimeout}
|
||||||
zonefiles-check: ${yesOrNo cfg.zonefilesCheck}
|
zonefiles-check: ${yesOrNo cfg.zonefilesCheck}
|
||||||
|
|
||||||
rrl-size: ${toString cfg.ratelimit.size}
|
|
||||||
rrl-ratelimit: ${toString cfg.ratelimit.ratelimit}
|
|
||||||
rrl-whitelist-ratelimit: ${toString cfg.ratelimit.whitelistRatelimit}
|
|
||||||
${maybeString "rrl-slip: " cfg.ratelimit.slip}
|
|
||||||
${maybeString "rrl-ipv4-prefix-length: " cfg.ratelimit.ipv4PrefixLength}
|
${maybeString "rrl-ipv4-prefix-length: " cfg.ratelimit.ipv4PrefixLength}
|
||||||
${maybeString "rrl-ipv6-prefix-length: " cfg.ratelimit.ipv6PrefixLength}
|
${maybeString "rrl-ipv6-prefix-length: " cfg.ratelimit.ipv6PrefixLength}
|
||||||
|
rrl-ratelimit: ${toString cfg.ratelimit.ratelimit}
|
||||||
|
${maybeString "rrl-slip: " cfg.ratelimit.slip}
|
||||||
|
rrl-size: ${toString cfg.ratelimit.size}
|
||||||
|
rrl-whitelist-ratelimit: ${toString cfg.ratelimit.whitelistRatelimit}
|
||||||
|
|
||||||
${keyConfigFile}
|
${keyConfigFile}
|
||||||
|
|
||||||
remote-control:
|
remote-control:
|
||||||
control-enable: ${yesOrNo cfg.remoteControl.enable}
|
control-enable: ${yesOrNo cfg.remoteControl.enable}
|
||||||
${forEach " control-interface: " cfg.remoteControl.interfaces}
|
|
||||||
control-port: ${toString cfg.port}
|
|
||||||
server-key-file: "${cfg.remoteControl.serverKeyFile}"
|
|
||||||
server-cert-file: "${cfg.remoteControl.serverCertFile}"
|
|
||||||
control-key-file: "${cfg.remoteControl.controlKeyFile}"
|
control-key-file: "${cfg.remoteControl.controlKeyFile}"
|
||||||
control-cert-file: "${cfg.remoteControl.controlCertFile}"
|
control-cert-file: "${cfg.remoteControl.controlCertFile}"
|
||||||
|
${forEach " control-interface: " cfg.remoteControl.interfaces}
|
||||||
|
control-port: ${toString cfg.remoteControl.port}
|
||||||
|
server-key-file: "${cfg.remoteControl.serverKeyFile}"
|
||||||
|
server-cert-file: "${cfg.remoteControl.serverCertFile}"
|
||||||
|
|
||||||
# zone files reside in "${zoneFiles}" linked to "${stateDir}/zones"
|
# zone files reside in "${zoneFiles}" linked to "${stateDir}/zones"
|
||||||
${concatStrings (mapAttrsToList zoneConfigFile zoneConfigs)}
|
${concatStrings (mapAttrsToList zoneConfigFile zoneConfigs)}
|
||||||
@ -111,17 +112,18 @@ let
|
|||||||
'') cfg.keys);
|
'') cfg.keys);
|
||||||
|
|
||||||
|
|
||||||
|
# options are ordered alphanumerically by the nixos option name
|
||||||
zoneConfigFile = name: zone: ''
|
zoneConfigFile = name: zone: ''
|
||||||
zone:
|
zone:
|
||||||
name: "${name}"
|
name: "${name}"
|
||||||
zonefile: "${stateDir}/zones/${name}"
|
zonefile: "${stateDir}/zones/${name}"
|
||||||
${maybeString "zonestats: " zone.zoneStats}
|
|
||||||
${maybeString "outgoing-interface: " zone.outgoingInterface}
|
${maybeString "outgoing-interface: " zone.outgoingInterface}
|
||||||
${forEach " rrl-whitelist: " zone.rrlWhitelist}
|
${forEach " rrl-whitelist: " zone.rrlWhitelist}
|
||||||
|
${maybeString "zonestats: " zone.zoneStats}
|
||||||
|
|
||||||
|
allow-axfr-fallback: ${yesOrNo zone.allowAXFRFallback}
|
||||||
${forEach " allow-notify: " zone.allowNotify}
|
${forEach " allow-notify: " zone.allowNotify}
|
||||||
${forEach " request-xfr: " zone.requestXFR}
|
${forEach " request-xfr: " zone.requestXFR}
|
||||||
allow-axfr-fallback: ${yesOrNo zone.allowAXFRFallback}
|
|
||||||
|
|
||||||
${forEach " notify: " zone.notify}
|
${forEach " notify: " zone.notify}
|
||||||
notify-retry: ${toString zone.notifyRetry}
|
notify-retry: ${toString zone.notifyRetry}
|
||||||
@ -152,17 +154,16 @@ let
|
|||||||
|
|
||||||
childConfig = x: v: { options.children = { type = types.attrsOf x; visible = v; }; };
|
childConfig = x: v: { options.children = { type = types.attrsOf x; visible = v; }; };
|
||||||
|
|
||||||
|
# options are ordered alphanumerically
|
||||||
zoneOptionsRaw = types.submodule {
|
zoneOptionsRaw = types.submodule {
|
||||||
options = {
|
options = {
|
||||||
children = mkOption {
|
|
||||||
default = {};
|
allowAXFRFallback = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
description = ''
|
description = ''
|
||||||
Children zones inherit all options of their parents. Attributes
|
If NSD as secondary server should be allowed to AXFR if the primary
|
||||||
defined in a child will overwrite the ones of its parent. Only
|
server does not allow IXFR.
|
||||||
leaf zones will be actually served. This way it's possible to
|
|
||||||
define maybe zones which share most attributes without
|
|
||||||
duplicating everything. This mechanism replaces nsd's patterns
|
|
||||||
in a save and functional way.
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -193,21 +194,25 @@ let
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
requestXFR = mkOption {
|
children = mkOption {
|
||||||
type = types.listOf types.str;
|
default = {};
|
||||||
default = [];
|
|
||||||
example = [];
|
|
||||||
description = ''
|
description = ''
|
||||||
Format: <code>[AXFR|UDP] <ip-address> <key-name | NOKEY></code>
|
Children zones inherit all options of their parents. Attributes
|
||||||
|
defined in a child will overwrite the ones of its parent. Only
|
||||||
|
leaf zones will be actually served. This way it's possible to
|
||||||
|
define maybe zones which share most attributes without
|
||||||
|
duplicating everything. This mechanism replaces nsd's patterns
|
||||||
|
in a save and functional way.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
allowAXFRFallback = mkOption {
|
data = mkOption {
|
||||||
type = types.bool;
|
type = types.str;
|
||||||
default = true;
|
default = "";
|
||||||
|
example = "";
|
||||||
description = ''
|
description = ''
|
||||||
If NSD as secondary server should be allowed to AXFR if the primary
|
The actual zone data. This is the content of your zone file.
|
||||||
server does not allow IXFR.
|
Use imports or pkgs.lib.readFile if you don't want this data in your config file.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -238,16 +243,6 @@ let
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
provideXFR = mkOption {
|
|
||||||
type = types.listOf types.str;
|
|
||||||
default = [];
|
|
||||||
example = [ "192.0.2.0/24 NOKEY" "192.0.2.0/24 my_tsig_key_name" ];
|
|
||||||
description = ''
|
|
||||||
Allow these IPs and TSIG to transfer zones, addr TSIG|NOKEY|BLOCKED
|
|
||||||
address range 192.0.2.0/24, 1.2.3.4&255.255.0.0, 3.0.2.20-3.0.2.40
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
outgoingInterface = mkOption {
|
outgoingInterface = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
default = null;
|
default = null;
|
||||||
@ -260,6 +255,25 @@ let
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
provideXFR = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [];
|
||||||
|
example = [ "192.0.2.0/24 NOKEY" "192.0.2.0/24 my_tsig_key_name" ];
|
||||||
|
description = ''
|
||||||
|
Allow these IPs and TSIG to transfer zones, addr TSIG|NOKEY|BLOCKED
|
||||||
|
address range 192.0.2.0/24, 1.2.3.4&255.255.0.0, 3.0.2.20-3.0.2.40
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
requestXFR = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [];
|
||||||
|
example = [];
|
||||||
|
description = ''
|
||||||
|
Format: <code>[AXFR|UDP] <ip-address> <key-name | NOKEY></code>
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
rrlWhitelist = mkOption {
|
rrlWhitelist = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [];
|
default = [];
|
||||||
@ -270,16 +284,6 @@ let
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
data = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = "";
|
|
||||||
example = "";
|
|
||||||
description = ''
|
|
||||||
The actual zone data. This is the content of your zone file.
|
|
||||||
Use imports or pkgs.lib.readFile if you don't want this data in your config file.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
zoneStats = mkOption {
|
zoneStats = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
default = null;
|
default = null;
|
||||||
@ -292,79 +296,24 @@ let
|
|||||||
and stats_noreset.
|
and stats_noreset.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
# options are ordered alphanumerically
|
||||||
services.nsd = {
|
options.services.nsd = {
|
||||||
|
|
||||||
enable = mkEnableOption "NSD authoritative DNS server";
|
enable = mkEnableOption "NSD authoritative DNS server";
|
||||||
|
|
||||||
bind8Stats = mkEnableOption "BIND8 like statistics";
|
bind8Stats = mkEnableOption "BIND8 like statistics";
|
||||||
|
|
||||||
rootServer = mkOption {
|
extraConfig = mkOption {
|
||||||
type = types.bool;
|
type = types.str;
|
||||||
default = false;
|
default = "";
|
||||||
description = ''
|
description = ''
|
||||||
Wheter if this server will be a root server (a DNS root server, you
|
Extra nsd config.
|
||||||
usually don't want that).
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
interfaces = mkOption {
|
|
||||||
type = types.listOf types.str;
|
|
||||||
default = [ "127.0.0.0" "::1" ];
|
|
||||||
description = ''
|
|
||||||
What addresses the server should listen to.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
serverCount = mkOption {
|
|
||||||
type = types.int;
|
|
||||||
default = 1;
|
|
||||||
description = ''
|
|
||||||
Number of NSD servers to fork. Put the number of CPUs to use here.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
ipTransparent = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = false;
|
|
||||||
description = ''
|
|
||||||
Allow binding to non local addresses.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
ipv4 = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = true;
|
|
||||||
description = ''
|
|
||||||
Wheter to listen on IPv4 connections.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
ipv6 = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = true;
|
|
||||||
description = ''
|
|
||||||
Wheter to listen on IPv6 connections.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
port = mkOption {
|
|
||||||
type = types.int;
|
|
||||||
default = 53;
|
|
||||||
description = ''
|
|
||||||
Port the service should bind do.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
verbosity = mkOption {
|
|
||||||
type = types.int;
|
|
||||||
default = 0;
|
|
||||||
description = ''
|
|
||||||
Verbosity level.
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -384,6 +333,54 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
interfaces = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [ "127.0.0.0" "::1" ];
|
||||||
|
description = ''
|
||||||
|
What addresses the server should listen to.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
ipTransparent = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Allow binding to non local addresses.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
ipv4 = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Wheter to listen on IPv4 connections.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
ipv4EDNSSize = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 4096;
|
||||||
|
description = ''
|
||||||
|
Preferred EDNS buffer size for IPv4.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
ipv6 = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Wheter to listen on IPv6 connections.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
ipv6EDNSSize = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 4096;
|
||||||
|
description = ''
|
||||||
|
Preferred EDNS buffer size for IPv6.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
nsid = mkOption {
|
nsid = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
default = null;
|
default = null;
|
||||||
@ -392,6 +389,40 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
port = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 53;
|
||||||
|
description = ''
|
||||||
|
Port the service should bind do.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
rootServer = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Wheter if this server will be a root server (a DNS root server, you
|
||||||
|
usually don't want that).
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
serverCount = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 1;
|
||||||
|
description = ''
|
||||||
|
Number of NSD servers to fork. Put the number of CPUs to use here.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
statistics = mkOption {
|
||||||
|
type = types.nullOr types.int;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
Statistics are produced every number of seconds. Prints to log.
|
||||||
|
If null no statistics are logged.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
tcpCount = mkOption {
|
tcpCount = mkOption {
|
||||||
type = types.int;
|
type = types.int;
|
||||||
default = 100;
|
default = 100;
|
||||||
@ -417,28 +448,11 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
ipv4EDNSSize = mkOption {
|
verbosity = mkOption {
|
||||||
type = types.int;
|
type = types.int;
|
||||||
default = 4096;
|
default = 0;
|
||||||
description = ''
|
description = ''
|
||||||
Preferred EDNS buffer size for IPv4.
|
Verbosity level.
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
ipv6EDNSSize = mkOption {
|
|
||||||
type = types.int;
|
|
||||||
default = 4096;
|
|
||||||
description = ''
|
|
||||||
Preferred EDNS buffer size for IPv6.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
statistics = mkOption {
|
|
||||||
type = types.nullOr types.int;
|
|
||||||
default = null;
|
|
||||||
description = ''
|
|
||||||
Statistics are produced every number of seconds. Prints to log.
|
|
||||||
If null no statistics are logged.
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -459,134 +473,10 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
extraConfig = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = "";
|
|
||||||
description = ''
|
|
||||||
Extra nsd config.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
ratelimit = {
|
|
||||||
enable = mkEnableOption "ratelimit capabilities";
|
|
||||||
|
|
||||||
size = mkOption {
|
|
||||||
type = types.int;
|
|
||||||
default = 1000000;
|
|
||||||
description = ''
|
|
||||||
Size of the hashtable. More buckets use more memory but lower
|
|
||||||
the chance of hash hash collisions.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
ratelimit = mkOption {
|
|
||||||
type = types.int;
|
|
||||||
default = 200;
|
|
||||||
description = ''
|
|
||||||
Max qps allowed from any query source.
|
|
||||||
0 means unlimited. With an verbosity of 2 blocked and
|
|
||||||
unblocked subnets will be logged.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
whitelistRatelimit = mkOption {
|
|
||||||
type = types.int;
|
|
||||||
default = 2000;
|
|
||||||
description = ''
|
|
||||||
Max qps allowed from whitelisted sources.
|
|
||||||
0 means unlimited. Set the rrl-whitelist option for specific
|
|
||||||
queries to apply this limit instead of the default to them.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
slip = mkOption {
|
|
||||||
type = types.nullOr types.int;
|
|
||||||
default = null;
|
|
||||||
description = ''
|
|
||||||
Number of packets that get discarded before replying a SLIP response.
|
|
||||||
0 disables SLIP responses. 1 will make every response a SLIP response.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
ipv4PrefixLength = mkOption {
|
|
||||||
type = types.nullOr types.int;
|
|
||||||
default = null;
|
|
||||||
description = ''
|
|
||||||
IPv4 prefix length. Addresses are grouped by netblock.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
ipv6PrefixLength = mkOption {
|
|
||||||
type = types.nullOr types.int;
|
|
||||||
default = null;
|
|
||||||
description = ''
|
|
||||||
IPv6 prefix length. Addresses are grouped by netblock.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
remoteControl = {
|
|
||||||
enable = mkEnableOption "remote control via nsd-control";
|
|
||||||
|
|
||||||
interfaces = mkOption {
|
|
||||||
type = types.listOf types.str;
|
|
||||||
default = [ "127.0.0.1" "::1" ];
|
|
||||||
description = ''
|
|
||||||
Which interfaces NSD should bind to for remote control.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
port = mkOption {
|
|
||||||
type = types.int;
|
|
||||||
default = 8952;
|
|
||||||
description = ''
|
|
||||||
Port number for remote control operations (uses TLS over TCP).
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
serverKeyFile = mkOption {
|
|
||||||
type = types.path;
|
|
||||||
default = "/etc/nsd/nsd_server.key";
|
|
||||||
description = ''
|
|
||||||
Path to the server private key, which is used by the server
|
|
||||||
but not by nsd-control. This file is generated by nsd-control-setup.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
serverCertFile = mkOption {
|
|
||||||
type = types.path;
|
|
||||||
default = "/etc/nsd/nsd_server.pem";
|
|
||||||
description = ''
|
|
||||||
Path to the server self signed certificate, which is used by the server
|
|
||||||
but and by nsd-control. This file is generated by nsd-control-setup.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
controlKeyFile = mkOption {
|
|
||||||
type = types.path;
|
|
||||||
default = "/etc/nsd/nsd_control.key";
|
|
||||||
description = ''
|
|
||||||
Path to the client private key, which is used by nsd-control
|
|
||||||
but not by the server. This file is generated by nsd-control-setup.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
controlCertFile = mkOption {
|
|
||||||
type = types.path;
|
|
||||||
default = "/etc/nsd/nsd_control.pem";
|
|
||||||
description = ''
|
|
||||||
Path to the client certificate signed with the server certificate.
|
|
||||||
This file is used by nsd-control and generated by nsd-control-setup.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
keys = mkOption {
|
keys = mkOption {
|
||||||
type = types.attrsOf (types.submodule {
|
type = types.attrsOf (types.submodule {
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
algorithm = mkOption {
|
algorithm = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "hmac-sha256";
|
default = "hmac-sha256";
|
||||||
@ -604,6 +494,7 @@ in
|
|||||||
user.
|
user.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
default = {};
|
default = {};
|
||||||
@ -618,40 +509,158 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
ratelimit = {
|
||||||
|
|
||||||
|
enable = mkEnableOption "ratelimit capabilities";
|
||||||
|
|
||||||
|
ipv4PrefixLength = mkOption {
|
||||||
|
type = types.nullOr types.int;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
IPv4 prefix length. Addresses are grouped by netblock.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
ipv6PrefixLength = mkOption {
|
||||||
|
type = types.nullOr types.int;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
IPv6 prefix length. Addresses are grouped by netblock.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
ratelimit = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 200;
|
||||||
|
description = ''
|
||||||
|
Max qps allowed from any query source.
|
||||||
|
0 means unlimited. With an verbosity of 2 blocked and
|
||||||
|
unblocked subnets will be logged.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
slip = mkOption {
|
||||||
|
type = types.nullOr types.int;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
Number of packets that get discarded before replying a SLIP response.
|
||||||
|
0 disables SLIP responses. 1 will make every response a SLIP response.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
size = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 1000000;
|
||||||
|
description = ''
|
||||||
|
Size of the hashtable. More buckets use more memory but lower
|
||||||
|
the chance of hash hash collisions.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
whitelistRatelimit = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 2000;
|
||||||
|
description = ''
|
||||||
|
Max qps allowed from whitelisted sources.
|
||||||
|
0 means unlimited. Set the rrl-whitelist option for specific
|
||||||
|
queries to apply this limit instead of the default to them.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
remoteControl = {
|
||||||
|
|
||||||
|
enable = mkEnableOption "remote control via nsd-control";
|
||||||
|
|
||||||
|
controlCertFile = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
default = "/etc/nsd/nsd_control.pem";
|
||||||
|
description = ''
|
||||||
|
Path to the client certificate signed with the server certificate.
|
||||||
|
This file is used by nsd-control and generated by nsd-control-setup.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
controlKeyFile = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
default = "/etc/nsd/nsd_control.key";
|
||||||
|
description = ''
|
||||||
|
Path to the client private key, which is used by nsd-control
|
||||||
|
but not by the server. This file is generated by nsd-control-setup.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
interfaces = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [ "127.0.0.1" "::1" ];
|
||||||
|
description = ''
|
||||||
|
Which interfaces NSD should bind to for remote control.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
port = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 8952;
|
||||||
|
description = ''
|
||||||
|
Port number for remote control operations (uses TLS over TCP).
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
serverCertFile = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
default = "/etc/nsd/nsd_server.pem";
|
||||||
|
description = ''
|
||||||
|
Path to the server self signed certificate, which is used by the server
|
||||||
|
but and by nsd-control. This file is generated by nsd-control-setup.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
serverKeyFile = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
default = "/etc/nsd/nsd_server.key";
|
||||||
|
description = ''
|
||||||
|
Path to the server private key, which is used by the server
|
||||||
|
but not by nsd-control. This file is generated by nsd-control-setup.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
zones = mkOption {
|
zones = mkOption {
|
||||||
type = types.attrsOf zoneOptions;
|
type = types.attrsOf zoneOptions;
|
||||||
default = {};
|
default = {};
|
||||||
example = literalExample ''
|
example = {
|
||||||
{ "serverGroup1" = {
|
"serverGroup1" = {
|
||||||
provideXFR = [ "10.1.2.3 NOKEY" ];
|
provideXFR = [ "10.1.2.3 NOKEY" ];
|
||||||
children = {
|
children = {
|
||||||
"example.com." = {
|
"example.com." = {
|
||||||
data = '''
|
data = ''
|
||||||
$ORIGIN example.com.
|
$ORIGIN example.com.
|
||||||
$TTL 86400
|
$TTL 86400
|
||||||
@ IN SOA a.ns.example.com. admin.example.com. (
|
@ IN SOA a.ns.example.com. admin.example.com. (
|
||||||
...
|
...
|
||||||
''';
|
'';
|
||||||
};
|
};
|
||||||
"example.org." = {
|
"example.org." = {
|
||||||
data = '''
|
data = ''
|
||||||
$ORIGIN example.org.
|
$ORIGIN example.org.
|
||||||
$TTL 86400
|
$TTL 86400
|
||||||
@ IN SOA a.ns.example.com. admin.example.com. (
|
@ IN SOA a.ns.example.com. admin.example.com. (
|
||||||
...
|
...
|
||||||
''';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
"example.net." = {
|
"example.net." = {
|
||||||
provideXFR = [ "10.3.2.1 NOKEY" ];
|
provideXFR = [ "10.3.2.1 NOKEY" ];
|
||||||
data = '''
|
data = ''...'';
|
||||||
...
|
};
|
||||||
''';
|
|
||||||
};
|
};
|
||||||
}
|
|
||||||
'';
|
|
||||||
description = ''
|
description = ''
|
||||||
Define your zones here. Zones can cascade other zones and therefore
|
Define your zones here. Zones can cascade other zones and therefore
|
||||||
inherit settings from parent zones. Look at the definition of
|
inherit settings from parent zones. Look at the definition of
|
||||||
@ -663,7 +672,6 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user