Compare commits
2 Commits
3e2d8ef2fc
...
a9abf3d365
Author | SHA1 | Date |
---|---|---|
Astro | a9abf3d365 | |
Astro | 8bc0ce6e15 |
|
@ -324,14 +324,19 @@ in
|
|||
algorithm hmac-sha256;
|
||||
secret "${inputs.zentralwerk-network-key.lib.dyndnsKey}";
|
||||
};
|
||||
|
||||
# allow underscores in dynamic hostnames
|
||||
${lib.concatMapStringsSep "\n" (type: ''
|
||||
check-names ${type} ignore;
|
||||
'') [ "master" "slave" "response" ]}
|
||||
'';
|
||||
});
|
||||
|
||||
systemd.services.dynamic-zones = {
|
||||
systemd.services.create-dynamic-zones = {
|
||||
description = "Creates dynamic zone files";
|
||||
requiredBy = [ "bind.service" ];
|
||||
before = [ "bind.service" ];
|
||||
serviceConfig.Type = "oneshot";
|
||||
# TODO: initial records
|
||||
script = ''
|
||||
mkdir -p /var/db/bind
|
||||
|
||||
|
@ -345,5 +350,28 @@ in
|
|||
)}
|
||||
'';
|
||||
};
|
||||
systemd.services.update-dynamic-zones = {
|
||||
description = "Creates initial records in dynamic zone files";
|
||||
requiredBy = [ "bind.service" ];
|
||||
after = [ "bind.service" ];
|
||||
serviceConfig.Type = "oneshot";
|
||||
path = [ pkgs.dnsutils ];
|
||||
script = ''
|
||||
${lib.concatMapStrings (zone: ''
|
||||
nsupdate -y "hmac-sha256:dyndns:${inputs.zentralwerk-network-key.lib.dyndnsKey}" <<EOF
|
||||
server localhost
|
||||
|
||||
${lib.concatMapStringsSep "\n" ({ name, type, data }: ''
|
||||
delete ${name}.${zone.name}. IN ${type}
|
||||
add ${name}.${zone.name}. 3600 IN ${type} ${data}
|
||||
'') zone.records}
|
||||
|
||||
send
|
||||
EOF
|
||||
'') (
|
||||
builtins.filter ({ dynamic, ... }: dynamic) config.site.dns.localZones
|
||||
)}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue