configure auth-dns to use netbox-fetched data

This commit is contained in:
lilly 2025-02-21 21:15:48 +01:00
parent eab11d4a5b
commit d31677b549
Signed by: lilly
SSH key fingerprint: SHA256:y9T5GFw2A20WVklhetIxG1+kcg/Ce0shnQmbu1LQ37g
2 changed files with 22 additions and 19 deletions

View file

@ -1,26 +1,15 @@
{
pkgs,
lib,
...
}:
let
noc_eh22_internZone = ''
$ORIGIN noc.eh22.intern.
$TTL 3600
; zone management
noc.eh22.intern. IN SOA auth-dns.noc.eh22.intern. noc.eh22.esterhegg.eu. (
1 ; serial (automatically incremented by knot)
7200 ; refresh
3600 ; retry
3600000 ; expire
60 ; negative response caching ttl
)
@ IN NS auth-dns
; A/AAAA records
proxmox IN A 10.31.210.248
auth-dns IN A 10.31.210.253
'';
zones = (
lib.attrsets.mapAttrs' (name: fileType: {
name = name;
value = ../data/zones/${name};
}) (builtins.readDir ../data/zones)
);
knotConf = pkgs.writeText "knot.conf" ''
server:
@ -48,7 +37,15 @@ in
# enable knot authorative dns server
# ref: https://search.nüschtos.de/?query=services.knot
# https://www.knot-dns.cz/docs/3.4/html/configuration.html
environment.etc."knot/zones/noc.eh22.intern.zone".text = noc_eh22_internZone;
environment.etc = (
lib.attrsets.mapAttrs' (name: value: {
name = "knot/zones/noc.eh22.intern.zone";
value = {
source = value;
};
}) zones
);
services.knot = {
enable = true;
settingsFile = knotConf;

View file

@ -69,6 +69,12 @@
id = 300;
subnet = "10.20.25.0/24";
pools = [ { pool = "10.20.25.100 - 10.20.25.254"; } ];
reservations = [
{
hw-address = "bc:24:11:c1:8a:a4";
ip-address = "10.20.25.3";
}
];
}
];
}