11 domain = "autogeree.net";
12 domainID = lib.replaceStrings [ "." ] [ "_" ] domain;
13 inherit (config) networking;
14 inherit (config.services) knot;
15 inherit (config.users) users groups;
17 # TODO: increase the TTL once things have settled down
22 ; SOA (Start Of Authority)
24 ${toString inputs.self.lastModified} ; Serial number
27 1000h ; Expire (1000h)
33 ${lib.concatMapStringsSep "\n" ({ name, ... }: "@ NS ${name}.") info.lebureau.dns.secondary.ns}
36 @ A ${hosts.mermet._module.args.ipv4}
37 mermet A ${hosts.mermet._module.args.ipv4}
38 autoconfig A ${hosts.mermet._module.args.ipv4}
39 code A ${hosts.mermet._module.args.ipv4}
40 git A ${hosts.mermet._module.args.ipv4}
41 imap A ${hosts.mermet._module.args.ipv4}
42 mail A ${hosts.mermet._module.args.ipv4}
43 ns A ${hosts.mermet._module.args.ipv4}
44 pleroma A ${hosts.mermet._module.args.ipv4}
45 pop A ${hosts.mermet._module.args.ipv4}
46 smtp A ${hosts.mermet._module.args.ipv4}
47 submission A ${hosts.mermet._module.args.ipv4}
48 www A ${hosts.mermet._module.args.ipv4}
49 chomsky A 91.216.110.36
52 ; SPF (Sender Policy Framework)
53 @ 3600 IN SPF "v=spf1 mx ip4:${hosts.mermet._module.args.ipv4} -all"
54 @ 3600 IN TXT "v=spf1 mx ip4:${hosts.mermet._module.args.ipv4} -all"
60 _git._tcp.git 18000 IN SRV 0 0 9418 git
62 ; CAA (Certificate Authority Authorization)
63 ; DOC: https://blog.qualys.com/ssllabs/2017/03/13/caa-mandated-by-cabrowser-forum
64 @ CAA 128 issue "letsencrypt.org; validationmethods=dns-01"
68 #@ CAA 128 issue "letsencrypt.org; validationmethods=dns-01; accounturi=https://acme-v02.api.letsencrypt.org/acme/acct/79737822"
70 services.knot.settingsFreeform = {
71 acl."acl_localhost_acme_${domainID}" = {
72 address = "127.0.0.1";
74 update-owner = "name";
75 update-owner-match = "equal";
76 update-owner-name = [ "_acme-challenge" ];
77 update-type = [ "TXT" ];
79 acl."acl_tsig_acme_${domainID}" = {
80 key = "acme_${domainID}";
82 update-owner = "name";
83 update-owner-match = "equal";
84 update-owner-name = [ "_acme-challenge" ];
85 update-type = [ "TXT" ];
87 acl."acl_lebureau_${domainID}" = {
90 info.lebureau.dns.secondary.transfer.ns1.ipv4
91 info.lebureau.dns.secondary.transfer.ns1.ipv6
92 info.lebureau.dns.secondary.transfer.ns2.ipv4
93 info.lebureau.dns.secondary.transfer.ns2.ipv6
95 key = "lebureau_${domainID}";
97 remote."secondary1_lebureau_${domainID}" = {
99 "${info.lebureau.dns.secondary.transfer.ns1.ipv4}@53"
100 "${info.lebureau.dns.secondary.transfer.ns1.ipv6}@53"
102 key = "lebureau_${domainID}";
104 remote."secondary2_lebureau_${domainID}" = {
106 "${info.lebureau.dns.secondary.transfer.ns2.ipv4}@53"
107 "${info.lebureau.dns.secondary.transfer.ns2.ipv6}@53"
109 key = "lebureau_${domainID}";
112 file = "${domain}.zone";
113 serial-policy = "increment";
114 semantic-checks = true;
116 "secondary1_lebureau_${domainID}"
117 "secondary2_lebureau_${domainID}"
121 "acl_localhost_acme_${domainID}"
122 "acl_tsig_acme_${domainID}"
123 "acl_lebureau_${domainID}"
125 dnssec-signing = true;
126 dnssec-policy = "ed25519";
131 "/run/credentials/knot.service/${domain}.acme.conf"
132 # Generated with: keymgr -t lebureau_${domainID}
133 "/run/credentials/knot.service/${domain}.lebureau.conf"
136 systemd.services.knot = {
140 +${pkgs.coreutils}/bin/install -D -o ${users.knot.name} -g ${groups."knot".name} -m 700 \
141 ${pkgs.writeText "${domain}.zone" zoneData} \
142 /var/lib/knot/zones/${domain}.zone
145 LoadCredentialEncrypted = [
146 "${domain}.acme.conf:${builtins.path { path = ./. + "/${domain}/acme.conf.cred"; }}"
147 "${domain}.lebureau.conf:${builtins.path { path = ./. + "/${domain}/lebureau.conf.cred"; }}"
151 networking.nftables.ruleset = ''
153 set output-net-knot-ipv4 { type ipv4_addr; elements = {
154 ${info.lebureau.dns.secondary.transfer.ns1.ipv4},
155 ${info.lebureau.dns.secondary.transfer.ns2.ipv4}
157 set output-net-knot-ipv6 { type ipv6_addr; elements = {
158 ${info.lebureau.dns.secondary.transfer.ns1.ipv6},
159 ${info.lebureau.dns.secondary.transfer.ns2.ipv6}
164 Useless since the zone is public
165 services.unbound.settings = {
168 stub-addr = "127.0.0.1@5353";