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}" = {
14 - id: acl_localhost_acme_${domainID}
18 update-owner-match: equal
19 update-owner-name: [_acme-challenge, _acme-challenge.hut]
21 - id: acl_tsig_acme_${domainID}
25 update-owner-match: equal
26 update-owner-name: [_acme-challenge, _acme-challenge.hut]
28 - id: acl_tsig_bureau1_${domainID}
29 key: bureau1_${domainID}
32 update-owner-match: equal
33 update-owner-name: [bureau1, lan.losurdo]
34 update-type: [A, AAAA]
39 serial-policy: increment
41 notify: secondary_gandi
43 acl: acl_localhost_acme_${domainID}
44 acl: acl_tsig_acme_${domainID}
45 acl: acl_tsig_bureau1_${domainID}
48 - domain: whoami4.${domain}
50 file: "${pkgs.writeText "whoami4.zone" ''
52 @ SOA ns root.${domain}. (
61 ns A ${hosts.mermet.extraArgs.ipv4}
64 # TODO: increase the TTL once things have settled down
69 ; SOA (Start Of Authority)
71 ${toString inputs.self.lastModified} ; Serial number
74 1000h ; Expire (1000h)
82 ns.whoami4 A ${hosts.mermet.extraArgs.ipv4}
85 @ A ${hosts.mermet.extraArgs.ipv4}
86 mermet A ${hosts.mermet.extraArgs.ipv4}
87 autoconfig A ${hosts.mermet.extraArgs.ipv4}
88 doc A ${hosts.mermet.extraArgs.ipv4}
89 code A ${hosts.mermet.extraArgs.ipv4}
90 git A ${hosts.mermet.extraArgs.ipv4}
91 imap A ${hosts.mermet.extraArgs.ipv4}
92 mail A ${hosts.mermet.extraArgs.ipv4}
93 mails A ${hosts.mermet.extraArgs.ipv4}
94 news A ${hosts.mermet.extraArgs.ipv4}
95 public-inbox A ${hosts.mermet.extraArgs.ipv4}
96 ns A ${hosts.mermet.extraArgs.ipv4}
97 pop A ${hosts.mermet.extraArgs.ipv4}
98 smtp A ${hosts.mermet.extraArgs.ipv4}
99 submission A ${hosts.mermet.extraArgs.ipv4}
100 www A ${hosts.mermet.extraArgs.ipv4}
101 lemoutona5pattes A ${hosts.mermet.extraArgs.ipv4}
102 covid19 A ${hosts.mermet.extraArgs.ipv4}
103 croc A ${hosts.mermet.extraArgs.ipv4}
104 stun A ${hosts.mermet.extraArgs.ipv4}
105 turn A ${hosts.mermet.extraArgs.ipv4}
106 whoami A ${hosts.mermet.extraArgs.ipv4}
107 hut A ${hosts.mermet.extraArgs.ipv4}
108 builds.hut A ${hosts.mermet.extraArgs.ipv4}
109 dispatch.hut A ${hosts.mermet.extraArgs.ipv4}
110 git.hut A ${hosts.mermet.extraArgs.ipv4}
111 hg.hut A ${hosts.mermet.extraArgs.ipv4}
112 hub.hut A ${hosts.mermet.extraArgs.ipv4}
113 lists.hut A ${hosts.mermet.extraArgs.ipv4}
114 meta.hut A ${hosts.mermet.extraArgs.ipv4}
115 man.hut A ${hosts.mermet.extraArgs.ipv4}
116 pages.hut A ${hosts.mermet.extraArgs.ipv4}
117 paste.hut A ${hosts.mermet.extraArgs.ipv4}
118 todo.hut A ${hosts.mermet.extraArgs.ipv4}
120 ; CNAME (Canonical Name)
121 losurdo CNAME bureau1
122 openconcerto CNAME losurdo
126 cryptpad CNAME losurdo
127 cryptpad-api CNAME losurdo
128 cryptpad-files CNAME losurdo
129 cryptpad-sandbox CNAME losurdo
131 freeciv CNAME losurdo
132 nix-serve CNAME losurdo
133 nix-extracache CNAME losurdo
134 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.extraArgs.ipv4} -all"
144 lists.hut 1800 MX 5 mail
147 _git._tcp.git 18000 IN SRV 0 0 9418 git
148 _stun._udp 18000 IN SRV 0 5 3478 stun
149 _xmpp-client._tcp 18000 IN SRV 0 5 5222 xmpp
150 _xmpp-server._tcp 18000 IN SRV 0 5 5269 xmpp
151 _xmpp-server._tcp.salons 18000 IN SRV 0 5 5269 xmpp
153 ; CAA (Certificate Authority Authorization)
154 ; DOC: https://blog.qualys.com/ssllabs/2017/03/13/caa-mandated-by-cabrowser-forum
155 @ CAA 128 issue "letsencrypt.org"
158 users.groups.keys.members = [ users.knot.name ];
161 gnupg.secrets."knot/tsig/${domain}/acme.conf".path
162 gnupg.secrets."knot/tsig/${domain}/bureau1.conf".path
165 security.gnupg.secrets = {
166 "knot/tsig/${domain}/acme.conf" = {
167 # Generated with: keymgr -t acme_${domainID}
168 user = users.knot.name;
170 "knot/tsig/${domain}/bureau1.conf" = {
171 # Generated with: keymgr -t bureau1_${domainID}
172 user = users.knot.name;
175 systemd.services.knot = {
177 gnupg.secrets."knot/tsig/${domain}/acme.conf".service
178 gnupg.secrets."knot/tsig/${domain}/bureau1.conf".service
181 gnupg.secrets."knot/tsig/${domain}/acme.conf".service
182 gnupg.secrets."knot/tsig/${domain}/bureau1.conf".service
185 /* Useless since the zone is public
186 services.unbound.settings = {
189 stub-addr = "127.0.0.1@5353";