1 { pkgs, lib, config, inputs, hostName, hosts, ... }:
3 domain = "sourcephile.fr";
4 domainID = lib.replaceStrings [ "." ] [ "_" ] domain;
5 inherit (config) networking;
6 inherit (config.services) knot;
9 services.knot.zones."${domain}" = {
13 address: 127.0.0.1@1053
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]
29 - id: acl_tsig_losurdo_${domainID}
30 key: losurdo_${domainID}
33 update-owner-match: equal
34 update-owner-name: [losurdo, lan.losurdo]
35 update-type: [A, AAAA]
45 serial-policy: increment
47 notify: secondary_gandi
49 acl: acl_localhost_acme_${domainID}
50 acl: acl_tsig_acme_${domainID}
51 acl: acl_tsig_losurdo_${domainID}
56 module: mod-dnsproxy/proxy_iodine
58 - domain: whoami4.${domain}
60 file: "${pkgs.writeText "whoami4.zone" ''
62 @ SOA ns root.${domain}. (
71 ns A ${hosts.mermet._module.args.ipv4}
74 # TODO: increase the TTL once things have settled down
79 ; SOA (Start Of Authority)
81 ${toString inputs.self.lastModified} ; Serial number
84 1000h ; Expire (1000h)
93 ns.whoami4 A ${hosts.mermet._module.args.ipv4}
96 @ A ${hosts.mermet._module.args.ipv4}
97 mermet A ${hosts.mermet._module.args.ipv4}
98 autoconfig A ${hosts.mermet._module.args.ipv4}
99 doc A ${hosts.mermet._module.args.ipv4}
100 git A ${hosts.mermet._module.args.ipv4}
101 imap A ${hosts.mermet._module.args.ipv4}
102 mail A ${hosts.mermet._module.args.ipv4}
103 mails A ${hosts.mermet._module.args.ipv4}
104 news A ${hosts.mermet._module.args.ipv4}
105 public-inbox A ${hosts.mermet._module.args.ipv4}
106 ns A ${hosts.mermet._module.args.ipv4}
107 pop A ${hosts.mermet._module.args.ipv4}
108 smtp A ${hosts.mermet._module.args.ipv4}
109 submission A ${hosts.mermet._module.args.ipv4}
110 www A ${hosts.mermet._module.args.ipv4}
111 lemoutona5pattes A ${hosts.mermet._module.args.ipv4}
112 covid19 A ${hosts.mermet._module.args.ipv4}
113 croc A ${hosts.mermet._module.args.ipv4}
114 stun A ${hosts.mermet._module.args.ipv4}
115 turn A ${hosts.mermet._module.args.ipv4}
116 whoami A ${hosts.mermet._module.args.ipv4}
117 code A ${hosts.mermet._module.args.ipv4}
118 miniflux A ${hosts.mermet._module.args.ipv4}
120 ; CNAME (Canonical Name)
121 openconcerto CNAME losurdo
125 cryptpad CNAME losurdo
126 cryptpad-api CNAME losurdo
127 cryptpad-files CNAME losurdo
128 cryptpad-sandbox CNAME losurdo
130 freeciv CNAME losurdo
131 nix-serve CNAME losurdo
132 nix-extracache CNAME losurdo
133 nix-localcache CNAME lan.losurdo
136 ; DMARC (Domain-based Message Authentication, Reporting and Conformance)
137 _dmarc 3600 IN TXT "v=DMARC1; p=none; pct=100; rua=mailto:root+dmarc+aggregate@sourcephile.fr; ruf=mailto:root+dmarc+forensic@sourcephile.fr"
139 ; SPF (Sender Policy Framework)
140 @ 3600 IN TXT "v=spf1 mx ip4:${hosts.mermet._module.args.ipv4} -all"
143 _git._tcp.git 18000 IN SRV 0 0 9418 git
144 _stun._udp 18000 IN SRV 0 5 3478 stun
145 _xmpp-client._tcp 18000 IN SRV 0 5 5222 xmpp
146 _xmpp-server._tcp 18000 IN SRV 0 5 5269 xmpp
147 _xmpp-server._tcp.salons 18000 IN SRV 0 5 5269 xmpp
149 ; CAA (Certificate Authority Authorization)
150 ; DOC: https://blog.qualys.com/ssllabs/2017/03/13/caa-mandated-by-cabrowser-forum
151 @ CAA 128 issue "letsencrypt.org"
156 "/run/credentials/knot.service/${domain}.acme.conf"
157 # Generated with: keymgr -t losurdo_${domainID}
158 "/run/credentials/knot.service/losurdo.conf"
161 systemd.services.knot = {
163 LoadCredentialEncrypted = [
164 "${domain}.acme.conf:${inputs.self}/hosts/${hostName}/knot/${domain}/acme.conf.cred"
165 "losurdo.conf:${inputs.self}/hosts/${hostName}/knot/${domain}/losurdo.conf.cred"
169 networking.nftables.ruleset = ''
172 set output-net-knot-ipv4 {
174 elements = { 217.70.177.40 }
176 set output-net-knot-ipv6 {
178 elements = { 2001:4b98:d:1::40 }
182 /* Useless since the zone is public
183 services.unbound.settings = {
186 stub-addr = "127.0.0.1@5353";