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"
60 #@ CAA 128 issue "letsencrypt.org; validationmethods=dns-01; accounturi=https://acme-v02.api.letsencrypt.org/acme/acct/79737822"
63 services.knot.settingsFreeform = {
64 acl."acl_localhost_acme_${domainID}" = {
65 address = "127.0.0.1";
67 update-owner = "name";
68 update-owner-match = "equal";
69 update-owner-name = [ "_acme-challenge" ];
70 update-type = [ "TXT" ];
72 acl."acl_tsig_acme_${domainID}" = {
73 key = "acme_${domainID}";
75 update-owner = "name";
76 update-owner-match = "equal";
77 update-owner-name = [ "_acme-challenge" ];
78 update-type = [ "TXT" ];
81 file = "${domain}.zone";
82 serial-policy = "increment";
83 semantic-checks = true;
91 "acl_localhost_acme_${domainID}"
92 "acl_tsig_acme_${domainID}"
94 dnssec-signing = false;
95 dnssec-policy = "ed25519";
98 networking.nftables.ruleset = ''
100 set output-net-knot-ipv4 { type ipv4_addr; elements = { ${info.gandi.dns.secondary.axfr.ipv4} }; }
101 set output-net-knot-ipv6 { type ipv6_addr; elements = { ${info.gandi.dns.secondary.axfr.ipv6} }; }
106 "/run/credentials/knot.service/${domain}.acme.conf"
109 systemd.services.knot = {
113 +${pkgs.coreutils}/bin/install -D -o ${users.knot.name} -g ${groups."knot".name} -m 700 \
114 ${pkgs.writeText "${domain}.zone" zoneData} \
115 /var/lib/knot/zones/${domain}.zone
118 LoadCredentialEncrypted = [
119 "${domain}.acme.conf:${./. + "/${domain}/acme.conf.cred"}"
123 /* Useless since the zone is public
124 services.unbound.settings = {
127 stub-addr = "127.0.0.1@5353";