]> Git — Sourcephile - sourcephile-nix.git/blob - servers/mermet/knot/autogeree.net.nix
nginx: add robots.txt for gitweb
[sourcephile-nix.git] / servers / mermet / knot / autogeree.net.nix
1 { pkgs, lib, config, ... }:
2 let
3 inherit (builtins.extraBuiltins) pass git;
4 inherit (pkgs.lib) unlinesAttrs types;
5 inherit (config) networking;
6 inherit (config.services) knot;
7 inherit (config) users;
8 # Use the Git commit time of the ${domain}.nix file to set the serial number.
9 # WARNING: the ${domain}.nix must be committed into Git for this to work.
10 # WARNING: this does not take other .nix into account, though they may contribute to the zone's data.
11 serial = domain: toString (git ./. [ "log" "-1" "--format=%ct" "--" (domain + ".nix") ]);
12 mermetIPv4 = "80.67.180.129";
13 domain = "autogeree.net";
14 in
15 {
16 security.acme.certs."${domain}" = {
17 email = "root+letsencrypt@${domain}";
18 extraDomains = {
19 "*.${domain}" = null;
20 };
21 group = users.groups.acme.name;
22 allowKeysForGroup = true;
23 keyType = "rsa4096";
24 dnsProvider = "rfc2136";
25 credentialsFile = pkgs.writeText "credentials" ''
26 RFC2136_NAMESERVER=127.0.0.1:5353
27 LEGO_EXPERIMENTAL_CNAME_SUPPORT=1
28 '';
29 };
30 services.knot.zones."${domain}" = {
31 conf = ''
32 acl:
33 - id: acl_acme_challenge_autogeree_net
34 address: 127.0.0.1
35 action: update
36 update-owner: name
37 update-owner-match: equal
38 update-owner-name: [_acme-challenge.${domain}]
39 update-type: [TXT]
40
41 zone:
42 - domain: ${domain}
43 file: ${domain}.zone
44 serial-policy: increment
45 semantic-checks: on
46 notify: secondary_gandi
47 notify: secondary_muarf
48 acl: acl_gandi
49 acl: acl_muarf
50 acl: acl_acme_challenge_autogeree_net
51 dnssec-signing: off
52 dnssec-policy: ed25519
53 '';
54 # TODO: increase the TTL once things have settled down
55 data = ''
56 $ORIGIN ${domain}.
57 $TTL 500
58
59 ; SOA (Start Of Authority)
60 @ SOA ns admin (
61 ${serial domain} ; Serial number
62 24h ; Refresh
63 15m ; Retry
64 1000h ; Expire (1000h)
65 1d ; Negative caching
66 )
67
68 ; NS (Name Server)
69 @ NS ns
70 @ NS ns6.gandi.net.
71 @ NS ns0.muarf.org.
72
73 ; A (DNS -> IPv4)
74 @ A ${mermetIPv4}
75 mermet A ${mermetIPv4}
76 autoconfig A ${mermetIPv4}
77 code A ${mermetIPv4}
78 git A ${mermetIPv4}
79 imap A ${mermetIPv4}
80 mail A ${mermetIPv4}
81 ns A ${mermetIPv4}
82 pop A ${mermetIPv4}
83 smtp A ${mermetIPv4}
84 submission A ${mermetIPv4}
85 www A ${mermetIPv4}
86 chomsky A 91.216.110.36
87 alpes A 195.88.84.51
88
89 ; SPF (Sender Policy Framework)
90 @ 3600 IN SPF "v=spf1 mx ip4:${mermetIPv4} -all"
91 @ 3600 IN TXT "v=spf1 mx ip4:${mermetIPv4} -all"
92
93 ; MX (Mail eXchange)
94 @ 180 MX 5 mail
95
96 ; SRV (SeRVice)
97 _git._tcp.git 18000 IN SRV 0 0 9418 git
98
99 ; CAA (Certificate Authority Authorization)
100 ; DOC: https://blog.qualys.com/ssllabs/2017/03/13/caa-mandated-by-cabrowser-forum
101 @ CAA 128 issue "letsencrypt.org"
102 '';
103 };
104 /* Useless since the zone is public
105 services.unbound.extraConfig = ''
106 stub-zone:
107 name: "autogeree.net"
108 stub-addr: 127.0.0.1@5353
109 '';
110 */
111 }