feat: generate the zones directly from teh dns records

This commit is contained in:
silver 2024-07-17 03:00:20 +01:00
parent 2a8a7cc7f4
commit 454e58b085
Signed by: silver
GPG key ID: 54E2C71918E93B74
2 changed files with 107 additions and 81 deletions

View file

@ -14,7 +14,7 @@
# this gets a list of all domains we have records for # this gets a list of all domains we have records for
domains = lib.lists.naturalSort ( domains = lib.lists.naturalSort (
lib.lists.unique ( lib.lists.unique (
lib.lists.forEach records (record: record.domain) lib.lists.forEach records (x: x.domain)
) )
); );
@ -76,8 +76,8 @@
get_config_file = ( get_config_file = (
domain: '' domain: ''
$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 ${nameserver}.${domain}. hostmaster.${domain}. ( @ IN SOA ${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)
@ -87,8 +87,8 @@
) )
; @ stands for teh root domain so teh A record below is where ${domain} points to ; @ stands for teh root domain so teh A record below is where ${domain} points to
@ NS ns1.${domain}. @ NS ns1.skynet.ie.
@ NS ns2.${domain}. @ NS ns2.skynet.ie.
; ------------------------------------------ ; ------------------------------------------
; Server Names (A Records) ; Server Names (A Records)
@ -274,6 +274,7 @@
details_records details_records
++ [ ++ [
{ {
domain = "skynet.ie";
record = "ns1"; record = "ns1";
r_type = "A"; r_type = "A";
value = details_server.ip; value = details_server.ip;
@ -284,6 +285,7 @@
details_records details_records
++ [ ++ [
{ {
domain = "skynet.ie";
record = "ns2"; record = "ns2";
r_type = "A"; r_type = "A";
value = details_server.ip; value = details_server.ip;
@ -351,13 +353,14 @@ in {
"ip daddr ${cfg.server.ip} udp dport 53 counter packets 0 bytes 0 accept" "ip daddr ${cfg.server.ip} udp dport 53 counter packets 0 bytes 0 accept"
]; ];
services.bind.zones = services.bind.zones = lib.attrsets.mergeAttrsList (
(create_entry_zone "csn.ul.ie") # uses teh domains lsited in teh records
// (create_entry_zone "skynet.ie") (lib.lists.forEach domains (domain: (create_entry_zone domain)))
// (create_entry_zone "ulcompsoc.ie") # we have to do a reverse dns
// (create_entry_zone "64-64.99.1.193.in-addr.arpa") ++ [
// (create_entry_zone "conradcollins.net") (create_entry_zone "64-64.99.1.193.in-addr.arpa")
// (create_entry_zone "edelharty.net"); ]
);
environment.etc = environment.etc =
(create_entry_etc "csn.ul.ie" "owned") (create_entry_etc "csn.ul.ie" "owned")

View file

@ -10,74 +10,97 @@
}; };
config = { config = {
skynet.records = [ skynet.records =
{ [
record = "optimus"; {
r_type = "A"; record = "optimus";
value = "193.1.99.90"; r_type = "A";
server = true; value = "193.1.99.90";
} server = true;
{ }
record = "panel.games"; {
r_type = "CNAME"; record = "panel.games";
value = "optimus"; r_type = "CNAME";
} value = "optimus";
{ }
record = "bumblebee"; {
r_type = "A"; record = "bumblebee";
value = "193.1.99.91"; r_type = "A";
server = true; value = "193.1.99.91";
} server = true;
{ }
record = "minecraft.compsoc.games"; {
r_type = "CNAME"; record = "minecraft.compsoc.games";
value = "bumblebee"; r_type = "CNAME";
} value = "bumblebee";
{ }
record = "_minecraft._tcp.minecraft.compsoc.games.skynet.ie."; {
r_type = "SRV"; record = "_minecraft._tcp.minecraft.compsoc.games.skynet.ie.";
value = "0 10 25518 minecraft.compsoc.games.skynet.ie."; r_type = "SRV";
} value = "0 10 25518 minecraft.compsoc.games.skynet.ie.";
{ }
record = "minecraft-classic.compsoc.games"; {
r_type = "CNAME"; record = "minecraft-classic.compsoc.games";
value = "bumblebee"; r_type = "CNAME";
} value = "bumblebee";
{ }
record = "_minecraft._tcp.minecraft-classic.compsoc.games.skynet.ie."; {
r_type = "SRV"; record = "_minecraft._tcp.minecraft-classic.compsoc.games.skynet.ie.";
value = "0 10 25518 minecraft-classic.compsoc.games.skynet.ie."; r_type = "SRV";
} value = "0 10 25518 minecraft-classic.compsoc.games.skynet.ie.";
{ }
record = "minecraft.gsoc.games"; {
r_type = "CNAME"; record = "minecraft.gsoc.games";
value = "bumblebee"; r_type = "CNAME";
} value = "bumblebee";
{ }
record = "_minecraft._tcp.minecraft.gsoc.games.skynet.ie."; {
r_type = "SRV"; record = "_minecraft._tcp.minecraft.gsoc.games.skynet.ie.";
value = "0 10 25521 minecraft.gsoc.games.skynet.ie."; r_type = "SRV";
} value = "0 10 25521 minecraft.gsoc.games.skynet.ie.";
{ }
record = "minecraft.phildeb.games"; {
r_type = "CNAME"; record = "minecraft.phildeb.games";
value = "bumblebee"; r_type = "CNAME";
} value = "bumblebee";
{ }
record = "_minecraft._tcp.minecraft.phildeb.games.skynet.ie."; {
r_type = "SRV"; record = "_minecraft._tcp.minecraft.phildeb.games.skynet.ie.";
value = "0 10 25522 minecraft.phildeb.games.skynet.ie."; r_type = "SRV";
} value = "0 10 25522 minecraft.phildeb.games.skynet.ie.";
{ }
record = "minecraft-aged.compsoc.games"; {
r_type = "CNAME"; record = "minecraft-aged.compsoc.games";
value = "bumblebee"; r_type = "CNAME";
} value = "bumblebee";
{ }
record = "_minecraft._tcp.minecraft-aged.compsoc.games.skynet.ie."; {
r_type = "SRV"; record = "_minecraft._tcp.minecraft-aged.compsoc.games.skynet.ie.";
value = "0 10 25519 minecraft.phildeb.games.skynet.ie."; r_type = "SRV";
} value = "0 10 25519 minecraft.phildeb.games.skynet.ie.";
]; }
]
# non skynet domains
++ [
{
domain = "conradcollins.net";
record = "www";
r_type = "CNAME";
value = "skynet.skynet.ie.";
}
{
domain = "edelharty.net";
record = "www";
r_type = "CNAME";
value = "skynet.skynet.ie.";
}
{
domain = "damienconroy.com";
record = "www";
r_type = "CNAME";
value = "skynet.skynet.ie.";
}
];
}; };
} }