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;
7 inherit (config.users) users;
10 services.knot.zones."${domain}" = {
14 address: 127.0.0.1@1053
16 - id: acl_localhost_acme_${domainID}
20 update-owner-match: equal
21 update-owner-name: [_acme-challenge, _acme-challenge.hut, _acme-challenge.code]
23 - id: acl_tsig_acme_${domainID}
27 update-owner-match: equal
28 update-owner-name: [_acme-challenge]
30 - id: acl_tsig_losurdo_${domainID}
31 key: losurdo_${domainID}
34 update-owner-match: equal
35 update-owner-name: [losurdo, lan.losurdo]
36 update-type: [A, AAAA]
46 serial-policy: increment
48 notify: secondary_gandi
50 acl: acl_localhost_acme_${domainID}
51 acl: acl_tsig_acme_${domainID}
52 acl: acl_tsig_losurdo_${domainID}
57 module: mod-dnsproxy/proxy_iodine
59 - domain: whoami4.${domain}
61 file: "${pkgs.writeText "whoami4.zone" ''
63 @ SOA ns root.${domain}. (
72 ns A ${hosts.mermet._module.args.ipv4}
75 # TODO: increase the TTL once things have settled down
80 ; SOA (Start Of Authority)
82 ${toString inputs.self.lastModified} ; Serial number
85 1000h ; Expire (1000h)
94 ns.whoami4 A ${hosts.mermet._module.args.ipv4}
97 @ A ${hosts.mermet._module.args.ipv4}
98 mermet A ${hosts.mermet._module.args.ipv4}
99 autoconfig A ${hosts.mermet._module.args.ipv4}
100 doc A ${hosts.mermet._module.args.ipv4}
101 git A ${hosts.mermet._module.args.ipv4}
102 imap A ${hosts.mermet._module.args.ipv4}
103 mail A ${hosts.mermet._module.args.ipv4}
104 mails A ${hosts.mermet._module.args.ipv4}
105 news A ${hosts.mermet._module.args.ipv4}
106 public-inbox A ${hosts.mermet._module.args.ipv4}
107 ns A ${hosts.mermet._module.args.ipv4}
108 pop A ${hosts.mermet._module.args.ipv4}
109 smtp A ${hosts.mermet._module.args.ipv4}
110 submission A ${hosts.mermet._module.args.ipv4}
111 www A ${hosts.mermet._module.args.ipv4}
112 lemoutona5pattes A ${hosts.mermet._module.args.ipv4}
113 covid19 A ${hosts.mermet._module.args.ipv4}
114 croc A ${hosts.mermet._module.args.ipv4}
115 stun A ${hosts.mermet._module.args.ipv4}
116 turn A ${hosts.mermet._module.args.ipv4}
117 whoami A ${hosts.mermet._module.args.ipv4}
118 code A ${hosts.mermet._module.args.ipv4}
119 builds.code A ${hosts.mermet._module.args.ipv4}
120 dispatch.code A ${hosts.mermet._module.args.ipv4}
121 git.code A ${hosts.mermet._module.args.ipv4}
122 hg.code A ${hosts.mermet._module.args.ipv4}
123 hub.code A ${hosts.mermet._module.args.ipv4}
124 lists.code A ${hosts.mermet._module.args.ipv4}
125 meta.code A ${hosts.mermet._module.args.ipv4}
126 man.code A ${hosts.mermet._module.args.ipv4}
127 pages.code A ${hosts.mermet._module.args.ipv4}
128 paste.code A ${hosts.mermet._module.args.ipv4}
129 todo.code A ${hosts.mermet._module.args.ipv4}
130 miniflux A ${hosts.mermet._module.args.ipv4}
132 ; CNAME (Canonical Name)
133 openconcerto CNAME losurdo
137 cryptpad CNAME losurdo
138 cryptpad-api CNAME losurdo
139 cryptpad-files CNAME losurdo
140 cryptpad-sandbox CNAME losurdo
142 freeciv CNAME losurdo
143 nix-serve CNAME losurdo
144 nix-extracache CNAME losurdo
145 nix-localcache CNAME lan.losurdo
147 builds.hut CNAME builds.code
148 dispatch.hut CNAME dispatch.code
149 git.hut CNAME git.code
151 hub.hut CNAME hub.code
152 lists.hut CNAME lists.code
153 meta.hut CNAME meta.code
154 man.hut CNAME man.code
155 pages.hut CNAME pages.code
156 paste.hut CNAME paste.code
157 todo.hut CNAME todo.code
160 ; DMARC (Domain-based Message Authentication, Reporting and Conformance)
161 _dmarc 3600 IN TXT "v=DMARC1; p=none; pct=100; rua=mailto:root+dmarc+aggregate@sourcephile.fr; ruf=mailto:root+dmarc+forensic@sourcephile.fr"
163 ; SPF (Sender Policy Framework)
164 @ 3600 IN TXT "v=spf1 mx ip4:${hosts.mermet._module.args.ipv4} -all"
168 lists.code 1800 MX 5 mail
169 todo.code 1800 MX 5 mail
172 _git._tcp.git 18000 IN SRV 0 0 9418 git
173 _stun._udp 18000 IN SRV 0 5 3478 stun
174 _xmpp-client._tcp 18000 IN SRV 0 5 5222 xmpp
175 _xmpp-server._tcp 18000 IN SRV 0 5 5269 xmpp
176 _xmpp-server._tcp.salons 18000 IN SRV 0 5 5269 xmpp
178 ; CAA (Certificate Authority Authorization)
179 ; DOC: https://blog.qualys.com/ssllabs/2017/03/13/caa-mandated-by-cabrowser-forum
180 @ CAA 128 issue "letsencrypt.org"
185 "/run/credentials/knot.service/${domain}.acme.conf"
186 # Generated with: keymgr -t losurdo_${domainID}
187 "/run/credentials/knot.service/losurdo.conf"
190 systemd.services.knot = {
192 LoadCredentialEncrypted = [
193 "${domain}.acme.conf:${inputs.self}/hosts/${hostName}/${domain}/acme.conf.cred"
194 "losurdo.conf:${inputs.self}/hosts/${hostName}/${domain}/losurdo.conf.cred"
198 networking.nftables.ruleset = ''
201 set output-net-knot-ipv4 {
203 elements = { 217.70.177.40 }
205 set output-net-knot-ipv6 {
207 elements = { 2001:4b98:d:1::40 }
211 /* Useless since the zone is public
212 services.unbound.settings = {
215 stub-addr = "127.0.0.1@5353";