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._module.args.ipv4}
65 mermet A ${hosts.mermet._module.args.ipv4}
66 autoconfig A ${hosts.mermet._module.args.ipv4}
67 code A ${hosts.mermet._module.args.ipv4}
68 git A ${hosts.mermet._module.args.ipv4}
69 imap A ${hosts.mermet._module.args.ipv4}
70 mail A ${hosts.mermet._module.args.ipv4}
71 ns A ${hosts.mermet._module.args.ipv4}
72 pop A ${hosts.mermet._module.args.ipv4}
73 smtp A ${hosts.mermet._module.args.ipv4}
74 submission A ${hosts.mermet._module.args.ipv4}
75 www A ${hosts.mermet._module.args.ipv4}
76 chomsky A 91.216.110.36
79 ; SPF (Sender Policy Framework)
80 @ 3600 IN SPF "v=spf1 mx ip4:${hosts.mermet._module.args.ipv4} -all"
81 @ 3600 IN TXT "v=spf1 mx ip4:${hosts.mermet._module.args.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 networking.nftables.ruleset = ''
97 set output-net-knot-ipv4 { type ipv4_addr; elements = { 217.70.177.40 }; }
98 set output-net-knot-ipv6 { type ipv6_addr; elements = { 2001:4b98:d:1::40 }; }
101 users.groups.keys.members = [ users.knot.name ];
103 keyFiles = [ gnupg.secrets."knot/tsig/${domain}/acme.conf".path ];
105 security.gnupg.secrets."knot/tsig/${domain}/acme.conf" = {
106 # Generated with: keymgr -t acme_${domainID}
107 user = users.knot.name;
109 systemd.services.knot = {
110 after = [ gnupg.secrets."knot/tsig/${domain}/acme.conf".service ];
111 wants = [ gnupg.secrets."knot/tsig/${domain}/acme.conf".service ];
113 /* Useless since the zone is public
114 services.unbound.settings = {
117 stub-addr = "127.0.0.1@5353";