Split notify IPs by v4/6

This commit is contained in:
niten 2023-11-09 10:08:32 -08:00
parent 9b3742b480
commit 601a04b882
2 changed files with 21 additions and 10 deletions

View File

@ -39,11 +39,19 @@ let
default = [ ]; default = [ ];
}; };
notify-ips = mkOption { notify = {
ipv4 = mkOption {
type = listOf str; type = listOf str;
description = "List of IP addresses to notify of changes."; description = "List of IPv4 addresses to notify of changes.";
default = [ ]; default = [ ];
}; };
ipv6 = mkOption {
type = listOf str;
description = "List of IPv6 addresses to notify of changes.";
default = [ ];
};
};
}; };
}; };
@ -102,8 +110,10 @@ in {
nameValuePair "${domain}." { nameValuePair "${domain}." {
dnssec = ksk.key-file != null; dnssec = ksk.key-file != null;
ksk.keyFile = ksk.key-file; ksk.keyFile = ksk.key-file;
provideXFR = map (ns: "${ns}/32 NOKEY") zone.notify-ips; provideXFR = (map (ns: "${ns}/32 NOKEY") zone.notify.ipv4)
notify = map (ns: "${ns} NOKEY") zone.notify-ips; ++ (map (ns: "${ns}/64 NOKEY") zone.notify.ipv6);
notify =
map (ns: "${ns} NOKEY") (zone.notify.ipv4 ++ zone.notify.ipv6);
data = zoneToZonefile { data = zoneToZonefile {
inherit domain; inherit domain;
inherit (cfg) timestamp; inherit (cfg) timestamp;
@ -115,7 +125,7 @@ in {
listToAttrs (map (network: listToAttrs (map (network:
reverseZonefile { reverseZonefile {
inherit domain network; inherit domain network;
inherit (zone) nameservers notify-ips; inherit (zone) nameservers notify;
keyFile = ksk.key-file; keyFile = ksk.key-file;
ipHostMap = cfg.ip-host-map; ipHostMap = cfg.ip-host-map;
serial = cfg.timestamp; serial = cfg.timestamp;

View File

@ -1,6 +1,6 @@
{ pkgs, ... }: { pkgs, ... }:
{ domain, network, nameservers, notify-ips, ipHostMap, serial, keyFile ? null { domain, network, nameservers, notify, ipHostMap, serial, keyFile ? null
, zoneTTL ? 10800, refresh ? 3600, retry ? 1800, expire ? 604800, minimum ? 3600 , zoneTTL ? 10800, refresh ? 3600, retry ? 1800, expire ? 604800, minimum ? 3600
}: }:
@ -54,8 +54,9 @@ let
in nameValuePair "${getNetworkZoneName network}" { in nameValuePair "${getNetworkZoneName network}" {
dnssec = keyFile != null; dnssec = keyFile != null;
ksk.keyFile = keyFile; ksk.keyFile = keyFile;
provideXFR = map (ns: "${ns}/32 NOKEY") notify-ips; provideXFR = (map (ns: "${ns}/32 NOKEY") notify.ipv4)
notify = map (ns: "${ns} NOKEY") notify-ips; ++ (map (ns: "${ns}/64 NOKEY") notify.ipv6);
notify = map (ns: "${ns} NOKEY") (notify.ipv4 ++ notify.ipv6);
data = '' data = ''
$ORIGIN ${getNetworkZoneName network} $ORIGIN ${getNetworkZoneName network}
$TTL ${toString zoneTTL} $TTL ${toString zoneTTL}