1 { inputs, pkgs, lib, config, hosts, ... }:
3 domain = "sourcephile.fr";
4 domainID = lib.replaceStrings ["."] ["_"] domain;
5 inherit (config) networking;
6 inherit (config.security) gnupg;
7 inherit (config.services) knot;
8 inherit (config.users) users;
11 services.knot.zones."${domain}" = {
15 address: 127.0.0.1@1053
17 - id: acl_localhost_acme_${domainID}
21 update-owner-match: equal
22 update-owner-name: [_acme-challenge, _acme-challenge.hut, _acme-challenge.code]
24 - id: acl_tsig_acme_${domainID}
28 update-owner-match: equal
29 update-owner-name: [_acme-challenge]
31 - id: acl_tsig_bureau1_${domainID}
32 key: bureau1_${domainID}
35 update-owner-match: equal
36 update-owner-name: [bureau1, lan.losurdo]
37 update-type: [A, AAAA]
47 serial-policy: increment
49 notify: secondary_gandi
51 acl: acl_localhost_acme_${domainID}
52 acl: acl_tsig_acme_${domainID}
53 acl: acl_tsig_bureau1_${domainID}
58 module: mod-dnsproxy/proxy_iodine
60 - domain: whoami4.${domain}
62 file: "${pkgs.writeText "whoami4.zone" ''
64 @ SOA ns root.${domain}. (
73 ns A ${hosts.mermet._module.args.ipv4}
76 # TODO: increase the TTL once things have settled down
81 ; SOA (Start Of Authority)
83 ${toString inputs.self.lastModified} ; Serial number
86 1000h ; Expire (1000h)
95 ns.whoami4 A ${hosts.mermet._module.args.ipv4}
98 @ A ${hosts.mermet._module.args.ipv4}
99 mermet A ${hosts.mermet._module.args.ipv4}
100 autoconfig A ${hosts.mermet._module.args.ipv4}
101 doc A ${hosts.mermet._module.args.ipv4}
102 git A ${hosts.mermet._module.args.ipv4}
103 imap A ${hosts.mermet._module.args.ipv4}
104 mail A ${hosts.mermet._module.args.ipv4}
105 mails A ${hosts.mermet._module.args.ipv4}
106 news A ${hosts.mermet._module.args.ipv4}
107 public-inbox A ${hosts.mermet._module.args.ipv4}
108 ns A ${hosts.mermet._module.args.ipv4}
109 pop A ${hosts.mermet._module.args.ipv4}
110 smtp A ${hosts.mermet._module.args.ipv4}
111 submission A ${hosts.mermet._module.args.ipv4}
112 www A ${hosts.mermet._module.args.ipv4}
113 lemoutona5pattes A ${hosts.mermet._module.args.ipv4}
114 covid19 A ${hosts.mermet._module.args.ipv4}
115 croc A ${hosts.mermet._module.args.ipv4}
116 stun A ${hosts.mermet._module.args.ipv4}
117 turn A ${hosts.mermet._module.args.ipv4}
118 whoami A ${hosts.mermet._module.args.ipv4}
119 code A ${hosts.mermet._module.args.ipv4}
120 builds.code A ${hosts.mermet._module.args.ipv4}
121 dispatch.code A ${hosts.mermet._module.args.ipv4}
122 git.code A ${hosts.mermet._module.args.ipv4}
123 hg.code A ${hosts.mermet._module.args.ipv4}
124 hub.code A ${hosts.mermet._module.args.ipv4}
125 lists.code A ${hosts.mermet._module.args.ipv4}
126 meta.code A ${hosts.mermet._module.args.ipv4}
127 man.code A ${hosts.mermet._module.args.ipv4}
128 pages.code A ${hosts.mermet._module.args.ipv4}
129 paste.code A ${hosts.mermet._module.args.ipv4}
130 todo.code A ${hosts.mermet._module.args.ipv4}
131 miniflux A ${hosts.mermet._module.args.ipv4}
133 ; CNAME (Canonical Name)
134 losurdo CNAME bureau1
135 openconcerto CNAME losurdo
139 cryptpad CNAME losurdo
140 cryptpad-api CNAME losurdo
141 cryptpad-files CNAME losurdo
142 cryptpad-sandbox CNAME losurdo
144 freeciv CNAME losurdo
145 nix-serve CNAME losurdo
146 nix-extracache CNAME losurdo
147 nix-localcache CNAME lan.losurdo
149 builds.hut CNAME builds.code
150 dispatch.hut CNAME dispatch.code
151 git.hut CNAME git.code
153 hub.hut CNAME hub.code
154 lists.hut CNAME lists.code
155 meta.hut CNAME meta.code
156 man.hut CNAME man.code
157 pages.hut CNAME pages.code
158 paste.hut CNAME paste.code
159 todo.hut CNAME todo.code
162 ; DMARC (Domain-based Message Authentication, Reporting and Conformance)
163 _dmarc 3600 IN TXT "v=DMARC1; p=none; pct=100; rua=mailto:root+dmarc+aggregate@sourcephile.fr; ruf=mailto:root+dmarc+forensic@sourcephile.fr"
165 ; SPF (Sender Policy Framework)
166 @ 3600 IN TXT "v=spf1 mx ip4:${hosts.mermet._module.args.ipv4} -all"
170 lists.code 1800 MX 5 mail
171 todo.code 1800 MX 5 mail
174 _git._tcp.git 18000 IN SRV 0 0 9418 git
175 _stun._udp 18000 IN SRV 0 5 3478 stun
176 _xmpp-client._tcp 18000 IN SRV 0 5 5222 xmpp
177 _xmpp-server._tcp 18000 IN SRV 0 5 5269 xmpp
178 _xmpp-server._tcp.salons 18000 IN SRV 0 5 5269 xmpp
180 ; CAA (Certificate Authority Authorization)
181 ; DOC: https://blog.qualys.com/ssllabs/2017/03/13/caa-mandated-by-cabrowser-forum
182 @ CAA 128 issue "letsencrypt.org"
185 users.groups.keys.members = [ users.knot.name ];
188 gnupg.secrets."knot/tsig/${domain}/acme.conf".path
189 gnupg.secrets."knot/tsig/${domain}/bureau1.conf".path
192 security.gnupg.secrets = {
193 "knot/tsig/${domain}/acme.conf" = {
194 # Generated with: keymgr -t acme_${domainID}
195 user = users.knot.name;
197 "knot/tsig/${domain}/bureau1.conf" = {
198 # Generated with: keymgr -t bureau1_${domainID}
199 user = users.knot.name;
202 systemd.services.knot = {
204 gnupg.secrets."knot/tsig/${domain}/acme.conf".service
205 gnupg.secrets."knot/tsig/${domain}/bureau1.conf".service
208 gnupg.secrets."knot/tsig/${domain}/acme.conf".service
209 gnupg.secrets."knot/tsig/${domain}/bureau1.conf".service
212 /* Useless since the zone is public
213 services.unbound.settings = {
216 stub-addr = "127.0.0.1@5353";