Add/fix reverse ipv4
This commit is contained in:
@@ -13,7 +13,7 @@ let
|
||||
{
|
||||
"pvv.ntnu.no" = ./zones/pvv.ntnu.no.nix;
|
||||
"pvv.org" = ./zones/pvv.org.nix;
|
||||
"reverse-ipv4" = ./zones/reverse-ipv4.nix;
|
||||
"in-addr.arpa" = ./zones/reverse-ipv4.nix;
|
||||
#"reverse-ipv6" = ./zones/reverse-ipv6.nix;
|
||||
};
|
||||
in
|
||||
@@ -27,4 +27,6 @@ stdenvNoCC.mkDerivation {
|
||||
|
||||
''
|
||||
+ (lib.concatMapAttrsStringSep "\n" (name: path: "cp ${path} $out/zones/${name}.zone") zoneConfigs);
|
||||
|
||||
# TODO: Write named.conf to include the zones, set allow-transfer, etc.
|
||||
}
|
||||
|
||||
@@ -2,11 +2,29 @@
|
||||
|
||||
with dns.lib.combinators;
|
||||
let
|
||||
hosts = import ../hosts.nix;
|
||||
ptrdnameSuffix = ".pvv.ntnu.no.";
|
||||
pvvv4 = hostPart: "129.241.210.${toString hostPart}";
|
||||
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?
|
||||
pvvHostReverseRecords = builtins.listToAttrs (
|
||||
lib.concatLists (
|
||||
lib.mapAttrsToList ( target: host:
|
||||
lib.map
|
||||
(aRecord: { name = flipV4 aRecord; value.PTR = [ (target + domainSuffix) ]; })
|
||||
(host.A or [])
|
||||
) pvvHostRecords
|
||||
)
|
||||
);
|
||||
|
||||
additionalReverseRecords = {
|
||||
"${flipV4 "129.241.210.129"}".PTR = [ "el-swd.nettel.ntnu.no." ]; # Gateway router/switch
|
||||
};
|
||||
in
|
||||
{
|
||||
useOrigin = true; # Don't output fully qualified names
|
||||
useOrigin = false; # Use fully qualified names
|
||||
|
||||
SOA = {
|
||||
nameServer = "dvask.pvv.ntnu.no";
|
||||
@@ -18,10 +36,6 @@ in
|
||||
"nn.unintett.no"
|
||||
];
|
||||
|
||||
subdomains = let
|
||||
ptr = ptrdname: { PTR = [ ptrdname ]; };
|
||||
pvvptr = ptrdname: ptr (ptrdname + ptrdnameSuffix);
|
||||
in {
|
||||
"129" = ptr "el-swd.nettel.ntnu.no."; # Gateway router/switch
|
||||
};
|
||||
# Additional
|
||||
subdomains = pvvHostReverseRecords // additionalReverseRecords;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user