nixos-config/zones/chir.rs.nix

176 lines
8.7 KiB
Nix

{ dns ? (import (builtins.fetchTarball "https://github.com/DarkKirb/dns.nix/archive/master.zip")).outputs, zoneTTL ? 3600 }:
with dns.lib.combinators;
let
inherit (builtins) hasAttr;
merge = a: b: (a // b) // (if ((hasAttr "subdomains" a) && (hasAttr "subdomains" b)) then { subdomains = (a.subdomains // b.subdomains); } else { });
zoneBase = {
A = [
(ttl zoneTTL (a "138.201.155.128"))
];
AAAA = [
(ttl zoneTTL (aaaa "2a01:4f8:1c17:d953:b4e1:8ff:e658:6f49"))
];
SSHFP = [
{
algorithm = "rsa";
mode = "sha1";
fingerprint = "97b910c37194cd98e7edca2d68104f4531721c22";
ttl = zoneTTL;
}
{
algorithm = "rsa";
mode = "sha256";
fingerprint = "7915470f9275116889d5ca1fdbea20416d8372636c3d63653b272308608cf70f";
ttl = zoneTTL;
}
{
algorithm = "ed25519";
mode = "sha1";
fingerprint = "1aff467e745a8d68ba032dd3d54597e10d31ccf8";
ttl = zoneTTL;
}
{
algorithm = "ed25519";
mode = "sha256";
fingerprint = "e6dcdb73dc381ee2b354528cdaf8552364e75c34316d7e0c9819801daea5c951";
ttl = zoneTTL;
}
];
subdomains = {
_tcp.subdomains."*".TLSA = [
{
certUsage = "dane-ee";
selector = "spki";
match = "sha256";
certificate = "0b85bd8fd152ed8b29a25e7fd69c083138a7bd35d79aea62c111efcf17ede23f";
ttl = zoneTTL;
}
];
_udp.subdomains."*".TLSA = [
{
certUsage = "dane-ee";
selector = "spki";
match = "sha256";
certificate = "0b85bd8fd152ed8b29a25e7fd69c083138a7bd35d79aea62c111efcf17ede23f";
ttl = zoneTTL;
}
];
};
HTTPS = [
{
svcPriority = 1;
targetName = ".";
alpn = [ "http/1.1" "h2" ];
ipv4hint = [ "138.201.155.128" ];
ipv6hint = [ "2a01:4f8:1c17:d953:b4e1:8ff:e658:6f49" ];
ttl = zoneTTL;
}
];
CAA = [
{
issuerCritical = false;
tag = "issue";
value = "letsencrypt.org";
ttl = zoneTTL;
}
{
issuerCritical = false;
tag = "issuewild";
value = "letsencrypt.org";
ttl = zoneTTL;
}
{
issuerCritical = false;
tag = "iodef";
value = "mailto:lotte@chir.rs";
ttl = zoneTTL;
}
];
};
createZone = merge zoneBase;
zone = createZone {
SOA = {
nameServer = "ns1.darkkirb.de.";
adminEmail = "lotte@chir.rs";
serial = 1;
};
NS = [
"ns1.darkkirb.de."
"ns2.darkkirb.de."
];
MX = [
(ttl zoneTTL (mx.mx 10 "mail.chir.rs."))
];
SRV = [
{
service = "submission";
proto = "tcp";
port = 587;
target = "mail.chir.rs.";
}
{
service = "imap";
proto = "tcp";
port = 143;
target = "mail.chir.rs.";
}
{
service = "imaps";
proto = "tcp";
port = 993;
target = "mail.chir.rs.";
}
{
service = "pop3";
proto = "tcp";
port = 110;
target = "mail.chir.rs.";
}
{
service = "pop3s";
proto = "tcp";
port = 995;
target = "mail.chir.rs.";
}
];
TXT = [
(ttl zoneTTL (txt "v=spf1 ip4:138.201.155.128 ip6:2a01:4f8:1c17:d953/64 -all"))
];
subdomains = {
_openpgpkey.subdomains."54b3cc365051676b4d96f469a59f31d12776c4891502822dfbe8a6b2" = {
OPENPGPKEY = [
"mQINBGE+CesBEADFhPrY5u3OYM/cYfJHXzdIkFLRaJq/pDda7wkBxSQcsa9E14wbR4CdBYc1OMjH6mJbNhTRxgTcrcV3MamZ8+ZykW1/t7l9dqADBcAprTGDB4pzTk3ZBDMezFZCJfGcBqHhvEQIwde+AHaTGnxO3jrbOBKxVEE++99/x5uCvnW9XXQAidJO44+wRWKamYa/F25zLsf4Yvx/8xJUcA+BozblHJcw3i1SCFqc3UiIs2gnsCe8QvcneomGpNVkfsptBUb7dPaOGEH29ERdjLXqBPlnTRLOTYRtMBDIya6Q+htpckJSsF5h7NqRXRP+ssVYG2CLOU30qvR7aQFkMFhL60lwYVJpJ5oXnwdlwEt3AROvVEEb66K2YrLS9WNRdWlQ4PuAppP8E/e3gZApVOwZAtFSZ1Yk4L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uLuoSKKScbZ0w3EKJkxCvwFGAGBvpvWqzTAYb4OElKZr3lUZ3E66mxcDTPzP9kNA1n2RWMfwuIkzwkbfTYFaQO3PDKIpu2lmKMzSH4hW2CDoGicezIzShXGEd2qXUZw98Qu5zew2/mVLQjGGjlJtaRtjTEGYR4KtyvSzxITsnZEAuQNmWKBjrXpJLR6JmC5Cgr1zu8yo8BMd/wI3s7821tn+Pp+1sYeY9W/hKzF6SFG+9Eejpkvrf23pjflM24rehpR+2judWtLZIXDLTC8jVUYsGDPRl4ai+E+dZtFABX22DggziHYvx3d9cmhrW3NgmhMaazSMyEFWOW2ksPmnsByNu0jB7TsRx13V9WXft0hSMd2CfvHGmWy1uApq7XmEZo+VLZmFHMEnuG7pDXpdSDmrGfemmbDI77yRecq49iTpLfd2xwoZ5F/tKR9sC/NhCi4JoniKYN59y3fhDvt+8iG4afEpqEI0XFhNL7fhO/yoCKk+uRuNQ7ESFoRGpD3sHtPGapCPIE6S2zeGm1BVLORLhqFZgL"
];
};
_dmarc.TXT = [
(ttl zoneTTL (txt "v=DMARC1; p=reject; rua=mailto:postmaster@chir.rs;"))
];
_domainkey.subdomains.mail.TXT = [
(ttl zoneTTL (txt "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDTZvuDWFmZOOMr9pogMK5lFBjV3nRAjUpFv3o0d4KhbRW/zVrOOdfdt83F6zSLzUqrxSOG3uKVG+J0KR4kX4BbYflSLZ++y91C0Uu5d+o3A8Y/z2vUSe5YVt44I
aDQoPCCpuWEYyqKIEaKGXNFPvlsO6y551biM3raNjq5kEpb3wIDAQAB"))
];
_keybase.TXT = [
(ttl zoneTTL (txt "keybase-site-verification=r044cwg0wOTW-ws35BA5MMRLNwjdTNJ4uOu6kgdTopI"))
];
www = createZone { };
api = createZone { };
git = createZone { };
mail = createZone { };
int = delegateTo [
"ns1.darkkirb.de"
"ns2.darkkirb.de"
] // {
DS = [{
keyTag = 35133;
algorithm = "ecdsap256sha256";
digestType = "sha-256";
digest = "668D4621260ADD9CE5B272A84ADE20E92FC43CBC59893A5843FA8ED8A356DB2B";
}];
};
};
};
in
dns.lib.toString "chir.rs" zone