Don't try to steal NVGs DNS records
This commit is contained in:
+2
-1
@@ -13,7 +13,8 @@ let
|
||||
{
|
||||
"pvv.ntnu.no" = ./zones/pvv.ntnu.no.nix;
|
||||
"pvv.org" = ./zones/pvv.org.nix;
|
||||
"in-addr.arpa" = ./zones/reverse-ipv4.nix;
|
||||
"210.241.129.in-addr.arpa" = ./zones/reverse-ipv4-parent.nix;
|
||||
"128-255.210.241.129.in-addr.arpa" = ./zones/reverse-ipv4.nix;
|
||||
#"reverse-ipv6" = ./zones/reverse-ipv6.nix;
|
||||
};
|
||||
in
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
{ dns, lib, ... }:
|
||||
|
||||
with dns.lib.combinators;
|
||||
{
|
||||
useOrigin = true; # Don't fully qualified names
|
||||
|
||||
SOA = {
|
||||
nameServer = "dvask.pvv.ntnu.no";
|
||||
adminEmail = "drift@pvv.ntnu.no";
|
||||
serial = 2025021701; # TODO: Automate
|
||||
};
|
||||
NS = [
|
||||
"dvask.pvv.ntnu.no"
|
||||
"swix.nvg.ntnu.no"
|
||||
"nn.unintett.no"
|
||||
];
|
||||
|
||||
subdomains = let
|
||||
# $GENERATE 0-127 $ CNAME $.0-127
|
||||
nvgRedirects = builtins.listToAttrs ( builtins.genList (n:
|
||||
{ name = toString n; value.CNAME = [ "${toString n}.0-127" ]; }
|
||||
) 127);
|
||||
|
||||
# $GENERATE 128-255 $ CNAME $.128-255
|
||||
pvvRedirects = builtins.listToAttrs ( builtins.genList (n:
|
||||
{ name = toString (n+128); value.CNAME = [ "${toString (n+128)}.128-255" ]; }
|
||||
) 127);
|
||||
in {
|
||||
# 129.241.210.0/25 delegated to NVGs NS
|
||||
"0-127" = {
|
||||
NS = [
|
||||
"swix.nvg.ntnu.no"
|
||||
"nn.uninett.no"
|
||||
];
|
||||
};
|
||||
|
||||
# 129.241.210.128/25 delegated to PVVs NS
|
||||
"128-255" = {
|
||||
NS = [
|
||||
"dvask.pvv.ntnu.no"
|
||||
"nn.uninett.no"
|
||||
];
|
||||
};
|
||||
} // nvgRedirects // pvvRedirects;
|
||||
}
|
||||
@@ -2,29 +2,30 @@
|
||||
|
||||
with dns.lib.combinators;
|
||||
let
|
||||
pvvv4 = hostPart: "129.241.210.${toString hostPart}";
|
||||
pvvv4Prefix = "129.241.210.";
|
||||
domainSuffix = ".pvv.ntnu.no.";
|
||||
flipV4 = ip: lib.concatStringsSep "." (lib.reverseList (lib.splitString "." ip));
|
||||
|
||||
pvvHostRecords = import ../pvv-subdomains.nix { inherit dns lib; };
|
||||
# Take all the A-records, and flip them to generate opposing PTR records
|
||||
# TODO: Handle duplicates?
|
||||
# Find all the A-records pointing into the PVV-network, and generate the opposing PTR records
|
||||
# TODO: Handle duplicates? Avoid NVG-IPs?
|
||||
pvvHostReverseRecords = builtins.listToAttrs (
|
||||
lib.concatLists (
|
||||
lib.mapAttrsToList ( target: host:
|
||||
lib.map
|
||||
(aRecord: { name = flipV4 aRecord; value.PTR = [ (target + domainSuffix) ]; })
|
||||
(host.A or [])
|
||||
(aRecordKey: let
|
||||
hostOctet = builtins.elemAt (lib.splitString "." aRecordKey) 3;
|
||||
in { name = hostOctet; value.PTR = [ (target + domainSuffix) ]; })
|
||||
(lib.filter (e: lib.hasPrefix pvvv4Prefix e) (host.A or []))
|
||||
) pvvHostRecords
|
||||
)
|
||||
);
|
||||
|
||||
additionalReverseRecords = {
|
||||
"${flipV4 "129.241.210.129"}".PTR = [ "el-swd.nettel.ntnu.no." ]; # Gateway router/switch
|
||||
"129".PTR = [ "el-swd.nettel.ntnu.no." ]; # Gateway router/switch
|
||||
};
|
||||
in
|
||||
{
|
||||
useOrigin = false; # Use fully qualified names
|
||||
useOrigin = true; # Don't use fully qualified names
|
||||
|
||||
SOA = {
|
||||
nameServer = "dvask.pvv.ntnu.no";
|
||||
@@ -36,6 +37,5 @@ in
|
||||
"nn.unintett.no"
|
||||
];
|
||||
|
||||
# Additional
|
||||
subdomains = pvvHostReverseRecords // additionalReverseRecords;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user