2024-04-17 22:04:08 +02:00
|
|
|
{ pkgs, lib, config, dns, ... }:
|
2024-03-09 23:22:02 +01:00
|
|
|
let
|
2024-03-10 20:51:05 +01:00
|
|
|
secondary = "185.181.104.96";
|
2024-04-17 22:04:08 +02:00
|
|
|
zonefile = with dns.lib.combinators; pkgs.writeText "rfive.de.zone.txt" (dns.lib.toString "rfive.de" {
|
|
|
|
TTL = 3600;
|
|
|
|
SOA = {
|
|
|
|
nameServer = "ns.rfive.de.";
|
|
|
|
adminEmail = "hostmaster@rfive.de";
|
|
|
|
serial = 2024041709;
|
|
|
|
refresh = 10800;
|
|
|
|
retry = 3600;
|
|
|
|
expire = 604800;
|
|
|
|
minimum = 3600;
|
|
|
|
};
|
|
|
|
NS = [
|
|
|
|
"ns.inwx.de."
|
|
|
|
"ns2.inwx.de."
|
|
|
|
"ns3.inxw.eu."
|
|
|
|
];
|
|
|
|
A = [ "23.88.121.184" ];
|
|
|
|
AAAA = [ "2a01:4f8:c012:49de::1" ];
|
|
|
|
|
|
|
|
CAA = letsEncrypt "ca@rfive.de";
|
|
|
|
|
|
|
|
MX = [{ preference = 1; exchange = "mail.rfive.de."; }];
|
|
|
|
|
|
|
|
TXT = [
|
|
|
|
(spf.soft [ "mx" ])
|
|
|
|
];
|
|
|
|
|
|
|
|
subdomains = lib.attrsets.mergeAttrsList [
|
|
|
|
rec {
|
|
|
|
nuc = {
|
|
|
|
A = [ "141.30.227.6" ];
|
|
|
|
};
|
|
|
|
falkenstein = {
|
|
|
|
A = [ "23.88.121.184" ];
|
|
|
|
AAAA = [ "2a01:4f8:c012:49de::1" ];
|
|
|
|
};
|
|
|
|
ns = falkenstein;
|
|
|
|
mail = falkenstein;
|
|
|
|
_dmarc.TXT = [ "v=DMARC1; p=none; adkim=s; fo=1; rua=mailto:dmarc@rfive.de; ruf=mailto:dmarc@rfive.de" ];
|
|
|
|
_domainkey.subdomains.rspamd.TXT = [ "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDoirUMubro4nlmY6a8JMwK9QB2agAXiJzexDU/7ba6KCggONfoSTfUHlrM/XeM1GG/9oKpngApxDPP97adJuxc8/EELyo4HjTyYD8GBFZhg0AN7V8IPaJ1o5k6dGDk8ZLh41ZCnlAVWkhVSKs5pYtzkrlJIfUSzyuoe8nuFsVe3QIDAQAB" ];
|
|
|
|
|
|
|
|
}
|
|
|
|
(lib.attrsets.genAttrs [ "cache" "chat" "matrix" "seafile" "vault" ] (label: { CNAME = [ "nuc.rfive.de." ]; }))
|
|
|
|
(lib.attrsets.genAttrs [ "purge" "rspamd" "trucks" ] (label: { CNAME = [ "falkenstein.rfive.de." ]; }))
|
|
|
|
];
|
|
|
|
});
|
2024-03-09 23:22:02 +01:00
|
|
|
in
|
2024-03-09 12:38:24 +01:00
|
|
|
{
|
2024-03-09 23:22:02 +01:00
|
|
|
services.bind = rec {
|
2024-03-09 12:38:24 +01:00
|
|
|
enable = true;
|
2024-03-09 23:22:02 +01:00
|
|
|
directory = "/var/lib/bind";
|
2024-03-11 12:40:23 +01:00
|
|
|
extraConfig = ''
|
|
|
|
dnssec-policy "split-keys" {
|
|
|
|
keys {
|
|
|
|
ksk lifetime unlimited algorithm ecdsap256sha256;
|
|
|
|
zsk lifetime 60d algorithm ecdsap256sha256;
|
|
|
|
};
|
|
|
|
publish-safety 1d;
|
|
|
|
retire-safety 1d;
|
|
|
|
};
|
|
|
|
'';
|
2024-03-09 12:38:24 +01:00
|
|
|
zones = {
|
|
|
|
"rfive.de" = {
|
|
|
|
master = true;
|
|
|
|
slaves = [
|
2024-03-10 20:51:05 +01:00
|
|
|
secondary
|
2024-03-09 12:38:24 +01:00
|
|
|
];
|
|
|
|
extraConfig = ''
|
2024-03-10 20:51:05 +01:00
|
|
|
also-notify {${secondary};};
|
2024-03-11 12:40:23 +01:00
|
|
|
dnssec-policy split-keys;
|
2024-03-09 23:22:02 +01:00
|
|
|
inline-signing yes;
|
2024-03-10 19:53:30 +01:00
|
|
|
serial-update-method date;
|
2024-03-09 12:38:24 +01:00
|
|
|
'';
|
2024-03-09 23:22:02 +01:00
|
|
|
file = "${directory}/rfive.de.zone.txt";
|
2024-03-09 12:38:24 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-03-09 23:22:02 +01:00
|
|
|
systemd.services.bind.preStart = ''
|
|
|
|
# copy the file manually to its destination since signing requires a writable directory
|
|
|
|
${pkgs.coreutils}/bin/cp ${zonefile} ${config.services.bind.directory}/rfive.de.zone.txt
|
2024-03-12 17:08:09 +01:00
|
|
|
${pkgs.coreutils}/bin/chown named:named ${config.services.bind.directory}/rfive.de.zone.txt
|
2024-03-09 23:22:02 +01:00
|
|
|
'';
|
2024-03-10 20:51:05 +01:00
|
|
|
networking.firewall.extraInputRules = ''
|
|
|
|
ip saddr ${secondary}/32 tcp dport 53 accept comment "Allow DNS AXFR access from INWX Servers"
|
|
|
|
ip saddr ${secondary}/32 udp dport 53 accept comment "Allow DNS access from INWX Servers"
|
|
|
|
'';
|
2024-03-11 12:40:23 +01:00
|
|
|
environment.systemPackages = with pkgs; [ dig.out ];
|
2024-03-09 12:38:24 +01:00
|
|
|
}
|