1 { inputs, pkgs, lib, config, hosts, ... }:
3 domain = "autogeree.net";
4 domainID = lib.replaceStrings ["."] ["_"] domain;
5 inherit (builtins) attrValues;
6 inherit (config) networking;
7 inherit (config.security) gnupg;
8 inherit (config.services) knot;
9 inherit (config.users) users;
12 services.knot.zones."${domain}" = {
15 - id: acl_localhost_acme_${domainID}
19 update-owner-match: equal
20 update-owner-name: [_acme-challenge]
22 - id: acl_tsig_acme_${domainID}
26 update-owner-match: equal
27 update-owner-name: [_acme-challenge]
33 serial-policy: increment
35 notify: secondary_gandi
36 notify: secondary_muarf
39 acl: acl_localhost_acme_${domainID}
40 acl: acl_tsig_acme_${domainID}
42 dnssec-policy: ed25519
44 # TODO: increase the TTL once things have settled down
49 ; SOA (Start Of Authority)
51 ${toString inputs.self.lastModified} ; Serial number
54 1000h ; Expire (1000h)
64 @ A ${hosts.mermet.extraArgs.ipv4}
65 mermet A ${hosts.mermet.extraArgs.ipv4}
66 autoconfig A ${hosts.mermet.extraArgs.ipv4}
67 code A ${hosts.mermet.extraArgs.ipv4}
68 git A ${hosts.mermet.extraArgs.ipv4}
69 imap A ${hosts.mermet.extraArgs.ipv4}
70 mail A ${hosts.mermet.extraArgs.ipv4}
71 ns A ${hosts.mermet.extraArgs.ipv4}
72 pop A ${hosts.mermet.extraArgs.ipv4}
73 smtp A ${hosts.mermet.extraArgs.ipv4}
74 submission A ${hosts.mermet.extraArgs.ipv4}
75 www A ${hosts.mermet.extraArgs.ipv4}
76 chomsky A 91.216.110.36
79 ; SPF (Sender Policy Framework)
80 @ 3600 IN SPF "v=spf1 mx ip4:${hosts.mermet.extraArgs.ipv4} -all"
81 @ 3600 IN TXT "v=spf1 mx ip4:${hosts.mermet.extraArgs.ipv4} -all"
87 _git._tcp.git 18000 IN SRV 0 0 9418 git
89 ; CAA (Certificate Authority Authorization)
90 ; DOC: https://blog.qualys.com/ssllabs/2017/03/13/caa-mandated-by-cabrowser-forum
91 @ CAA 128 issue "letsencrypt.org"
94 users.groups.keys.members = [ users.knot.name ];
96 keyFiles = [ gnupg.secrets."knot/tsig/${domain}/acme.conf".path ];
98 security.gnupg.secrets."knot/tsig/${domain}/acme.conf" = {
99 # Generated with: keymgr -t acme_${domainID}
100 user = users.knot.name;
102 systemd.services.knot = {
103 after = [ gnupg.secrets."knot/tsig/${domain}/acme.conf".service ];
104 wants = [ gnupg.secrets."knot/tsig/${domain}/acme.conf".service ];
106 /* Useless since the zone is public
107 services.unbound.settings = {
110 stub-addr = "127.0.0.1@5353";