dns: got reverse dns working

This commit is contained in:
silver 2023-06-17 00:59:22 +01:00
parent 6585a3c88a
commit 9b1a936f03
10 changed files with 41 additions and 13 deletions

View file

@ -62,8 +62,8 @@ let
'' ''
$ORIGIN 99.1.193.in-addr.arpa. $ORIGIN 99.1.193.in-addr.arpa.
$TTL 60 ; 1 minute $TTL 60 ; 1 minute
; hostmaster@${domain} is an email address that recieves stuff related to dns ; hostmaster@skynet.ie is an email address that recieves stuff related to dns
@ IN SOA ${cfg.own.nameserver}.${domain}. hostmaster.${domain}. ( @ IN SOA ${cfg.own.nameserver}.skynet.ie. hostmaster.skynet.ie. (
; Serial (YYYYMMDDCC) this has to be updated for each time the record is updated ; Serial (YYYYMMDDCC) this has to be updated for each time the record is updated
${current_date} ${current_date}
600 ; Refresh (10 minutes) 600 ; Refresh (10 minutes)
@ -72,10 +72,10 @@ let
3600 ; Minimum (1 hour) 3600 ; Minimum (1 hour)
) )
@ NS ns1.${domain}. @ NS ns1.skynet.ie.
@ NS ns2.${domain}. @ NS ns2.skynet.ie.
${lib.strings.concatMapStrings (x: x + "." + domain + ".\n") cfg.records.reverse} ${lib.strings.concatMapStrings (x: x + "\n") cfg.records.reverse}
'' ''
); );

View file

@ -96,6 +96,10 @@
"_dmarc TXT v=DMARC1; p=none" "_dmarc TXT v=DMARC1; p=none"
]; ];
skynet_dns.records.reverse = [
"${builtins.substring 9 3 cfg.host.ip} IN PTR ${cfg.sub}.${cfg.domain}."
];
mailserver = { mailserver = {
enable = true; enable = true;
fqdn = "${cfg.sub}.${cfg.domain}"; fqdn = "${cfg.sub}.${cfg.domain}";

View file

@ -36,7 +36,7 @@ in {
]; ];
cname = []; cname = [];
reverse = [ reverse = [
"${builtins.substring 9 3 ip_pub} IN PTR ${name}" "${builtins.substring 9 3 ip_pub} IN PTR ${hostname}."
]; ];
}; };

View file

@ -35,7 +35,7 @@ in {
"${name} A ${ip_pub}" "${name} A ${ip_pub}"
]; ];
reverse = [ reverse = [
"${builtins.substring 9 3 ip_pub} IN PTR ${name}" "${builtins.substring 9 3 ip_pub} IN PTR ${hostname}."
]; ];
}; };

View file

@ -38,7 +38,7 @@ in {
"${name} A ${ip_pub}" "${name} A ${ip_pub}"
]; ];
reverse = [ reverse = [
"${builtins.substring 9 3 ip_pub} IN PTR ${name}" "${builtins.substring 9 3 ip_pub} IN PTR ${hostname}."
]; ];
}; };

View file

@ -38,7 +38,7 @@ in {
"${name} A ${ip_pub}" "${name} A ${ip_pub}"
]; ];
reverse = [ reverse = [
"${builtins.substring 9 3 ip_pub} IN PTR ${name}" "${builtins.substring 9 3 ip_pub} IN PTR ${hostname}."
]; ];
}; };

View file

@ -38,7 +38,7 @@ in {
"${name} A ${ip_pub}" "${name} A ${ip_pub}"
]; ];
reverse = [ reverse = [
"${builtins.substring 9 3 ip_pub} IN PTR ${name}" "${builtins.substring 9 3 ip_pub} IN PTR ${hostname}."
]; ];
}; };

View file

@ -36,7 +36,7 @@ in {
"${name} A ${ip_pub}" "${name} A ${ip_pub}"
]; ];
reverse = [ reverse = [
"${builtins.substring 9 3 ip_pub} IN PTR ${name}" "${builtins.substring 9 3 ip_pub} IN PTR ${hostname}."
]; ];
}; };

View file

@ -66,7 +66,7 @@ in {
#"misc CNAME vendetta" #"misc CNAME vendetta"
]; ];
reverse = [ reverse = [
"${builtins.substring 9 3 ip_pub} IN PTR ${name}" "${builtins.substring 9 3 ip_pub} IN PTR ${hostname}."
]; ];
}; };
@ -95,6 +95,18 @@ in {
else [] else []
) nodes ) nodes
); );
reverse = builtins.concatLists (
lib.attrsets.mapAttrsToList (key: value:
if builtins.hasAttr "skynet_dns" value.config
then (
if value.config.skynet_dns.enable
then value.config.skynet_dns.own.reverse
else value.config.skynet_dns.records.reverse
)
else []
) nodes
);
}; };
}; };

View file

@ -47,7 +47,7 @@ in {
#"misc CNAME vendetta" #"misc CNAME vendetta"
]; ];
reverse = [ reverse = [
"${builtins.substring 9 3 ip_pub} IN PTR ${name}" "${builtins.substring 9 3 ip_pub} IN PTR ${hostname}."
]; ];
}; };
@ -76,6 +76,18 @@ in {
else [] else []
) nodes ) nodes
); );
reverse = builtins.concatLists (
lib.attrsets.mapAttrsToList (key: value:
if builtins.hasAttr "skynet_dns" value.config
then (
if value.config.skynet_dns.enable
then value.config.skynet_dns.own.reverse
else value.config.skynet_dns.records.reverse
)
else []
) nodes
);
}; };
}; };