1 { pkgs, lib, config, servers, ... }:
3 domain = "autogeree.net";
4 domainID = lib.replaceStrings ["."] ["_"] domain;
5 inherit (builtins) attrValues;
6 inherit (builtins.extraBuiltins) pass git;
7 inherit (config) networking;
8 inherit (config.services) knot;
9 inherit (config.users) users groups;
10 # Use the Git commit time of the ${domain}.nix file to set the serial number.
11 # WARNING: the ${domain}.nix must be committed into Git for this to work.
12 # WARNING: this does not take other .nix into account, though they may contribute to the zone's data.
13 serial = domain: toString (git ./. [ "log" "-1" "--format=%ct" "--" (domain + ".nix") ]);
15 "${domain}/acme.conf" = "/var/lib/knot/tsig/${domain}/acme.conf";
19 install.shellHook = ''
20 # Generated with: keymgr -t acme_${domain}
21 pass "servers/mermet/knot/${domain}/acme.conf" |
22 ssh "$target" install -D -m 0400 -o ${users."knot".name} -g root /dev/stdin \
23 ${includes."${domain}/acme.conf"}
26 keyFiles = attrValues includes;
28 services.knot.zones."${domain}" = {
31 - id: acl_localhost_acme_${domainID}
35 update-owner-match: equal
36 update-owner-name: [_acme-challenge.${domain}]
38 - id: acl_tsig_acme_${domainID}
39 address: ${servers.losurdo.ipv4}
43 update-owner-match: equal
44 update-owner-name: [_acme-challenge.${domain}]
50 serial-policy: increment
52 notify: secondary_gandi
53 notify: secondary_muarf
56 acl: acl_localhost_acme_${domainID}
57 acl: acl_tsig_acme_${domainID}
59 dnssec-policy: ed25519
61 # TODO: increase the TTL once things have settled down
66 ; SOA (Start Of Authority)
68 ${serial domain} ; Serial number
71 1000h ; Expire (1000h)
81 @ A ${servers.mermet.ipv4}
82 mermet A ${servers.mermet.ipv4}
83 autoconfig A ${servers.mermet.ipv4}
84 code A ${servers.mermet.ipv4}
85 git A ${servers.mermet.ipv4}
86 imap A ${servers.mermet.ipv4}
87 mail A ${servers.mermet.ipv4}
88 ns A ${servers.mermet.ipv4}
89 pop A ${servers.mermet.ipv4}
90 smtp A ${servers.mermet.ipv4}
91 submission A ${servers.mermet.ipv4}
92 www A ${servers.mermet.ipv4}
93 chomsky A 91.216.110.36
96 ; SPF (Sender Policy Framework)
97 @ 3600 IN SPF "v=spf1 mx ip4:${servers.mermet.ipv4} -all"
98 @ 3600 IN TXT "v=spf1 mx ip4:${servers.mermet.ipv4} -all"
104 _git._tcp.git 18000 IN SRV 0 0 9418 git
106 ; CAA (Certificate Authority Authorization)
107 ; DOC: https://blog.qualys.com/ssllabs/2017/03/13/caa-mandated-by-cabrowser-forum
108 @ CAA 128 issue "letsencrypt.org"
111 /* Useless since the zone is public
112 services.unbound.extraConfig = ''
114 name: "autogeree.net"
115 stub-addr: 127.0.0.1@5353