1 { pkgs, lib, config, inputs, hosts, info, ... }:
3 domain = "autogeree.net";
4 domainID = lib.replaceStrings [ "." ] [ "_" ] domain;
5 inherit (config) networking;
6 inherit (config.services) knot;
7 inherit (config.users) users groups;
9 # TODO: increase the TTL once things have settled down
14 ; SOA (Start Of Authority)
16 ${toString inputs.self.lastModified} ; Serial number
19 1000h ; Expire (1000h)
25 @ NS ${info.gandi.dns.secondary.ns.name}.
29 @ A ${hosts.mermet._module.args.ipv4}
30 mermet A ${hosts.mermet._module.args.ipv4}
31 autoconfig A ${hosts.mermet._module.args.ipv4}
32 code A ${hosts.mermet._module.args.ipv4}
33 git A ${hosts.mermet._module.args.ipv4}
34 imap A ${hosts.mermet._module.args.ipv4}
35 mail A ${hosts.mermet._module.args.ipv4}
36 ns A ${hosts.mermet._module.args.ipv4}
37 pleroma A ${hosts.mermet._module.args.ipv4}
38 pop A ${hosts.mermet._module.args.ipv4}
39 smtp A ${hosts.mermet._module.args.ipv4}
40 submission A ${hosts.mermet._module.args.ipv4}
41 www A ${hosts.mermet._module.args.ipv4}
42 chomsky A 91.216.110.36
45 ; SPF (Sender Policy Framework)
46 @ 3600 IN SPF "v=spf1 mx ip4:${hosts.mermet._module.args.ipv4} -all"
47 @ 3600 IN TXT "v=spf1 mx ip4:${hosts.mermet._module.args.ipv4} -all"
53 _git._tcp.git 18000 IN SRV 0 0 9418 git
55 ; CAA (Certificate Authority Authorization)
56 ; DOC: https://blog.qualys.com/ssllabs/2017/03/13/caa-mandated-by-cabrowser-forum
57 @ CAA 128 issue "letsencrypt.org; validationmethods=dns-01; accounturi=https://acme-v02.api.letsencrypt.org/acme/acct/79737822"
61 services.knot.settingsFreeform = {
62 acl."acl_localhost_acme_${domainID}" = {
63 address = "127.0.0.1";
65 update-owner = "name";
66 update-owner-match = "equal";
67 update-owner-name = [ "_acme-challenge" ];
68 update-type = [ "TXT" ];
70 acl."acl_tsig_acme_${domainID}" = {
71 key = "acme_${domainID}";
73 update-owner = "name";
74 update-owner-match = "equal";
75 update-owner-name = [ "_acme-challenge" ];
76 update-type = [ "TXT" ];
79 file = "${domain}.zone";
80 serial-policy = "increment";
81 semantic-checks = true;
89 "acl_localhost_acme_${domainID}"
90 "acl_tsig_acme_${domainID}"
92 dnssec-signing = false;
93 dnssec-policy = "ed25519";
96 networking.nftables.ruleset = ''
98 set output-net-knot-ipv4 { type ipv4_addr; elements = { ${info.gandi.dns.secondary.axfr.ipv4} }; }
99 set output-net-knot-ipv6 { type ipv6_addr; elements = { ${info.gandi.dns.secondary.axfr.ipv6} }; }
104 "/run/credentials/knot.service/${domain}.acme.conf"
107 systemd.services.knot = {
111 +${pkgs.coreutils}/bin/install -D -o ${users.knot.name} -g ${groups."knot".name} -m 700 \
112 ${pkgs.writeText "${domain}.zone" zoneData} \
113 /var/lib/knot/zones/${domain}.zone
116 LoadCredentialEncrypted = [
117 "${domain}.acme.conf:${./. + "/${domain}/acme.conf.cred"}"
121 /* Useless since the zone is public
122 services.unbound.settings = {
125 stub-addr = "127.0.0.1@5353";