Files
PVV-DNS/zones/reverse-ipv4.nix
T
David Kaasen 3df1e763bc
Build and test / build (push) Successful in 53s
Build and test / test (push) Successful in 30s
Build and test / deploy (push) Successful in 31s
Punktum i SOA ogsaa.
2026-05-14 14:01:24 +02:00

45 lines
1.1 KiB
Nix

{ dns, lib, ... }:
with dns.lib.combinators;
let
pvvv4Prefix = "129.241.210.";
domainSuffix = ".pvv.ntnu.no.";
pvvHostRecords = import ../pvv-host-forwards.nix { inherit dns lib; };
# Find all the A-records pointing into the PVV subnet, and generate the opposing PTR records
# TODO: Handle duplicates? Avoid NVG-IPs?
pvvHostReverseRecords = builtins.listToAttrs (
lib.concatLists (
lib.mapAttrsToList (
target: host:
lib.map (aRecordKey: {
name = lib.removePrefix pvvv4Prefix aRecordKey;
value.PTR = [ (target + domainSuffix) ];
}) (lib.filter (e: lib.hasPrefix pvvv4Prefix e) (host.A or [ ]))
) pvvHostRecords
)
);
additionalReverseRecords = {
"129".PTR = [ "el-swd.nettel.ntnu.no." ]; # Gateway router/switch
};
in
{
useOrigin = true; # Don't output fully qualified names
TTL = 60 * 60;
SOA = {
nameServer = "dvask.pvv.ntnu.no.";
adminEmail = "drift@pvv.ntnu.no";
serial = 1970010101; # Placeholder, replaced in deploy step
};
NS = [
"dvask.pvv.ntnu.no."
"nn.uninett.no."
];
subdomains = pvvHostReverseRecords // additionalReverseRecords;
}