1 { pkgs, lib, config, inputs, hostName, hosts, ... }:
3 domain = "autogeree.net";
4 domainID = lib.replaceStrings ["."] ["_"] domain;
5 inherit (builtins) attrValues;
6 inherit (config) networking;
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]
21 - id: acl_tsig_acme_${domainID}
25 update-owner-match: equal
26 update-owner-name: [_acme-challenge]
32 serial-policy: increment
34 notify: secondary_gandi
35 #notify: secondary_muarf
38 acl: acl_localhost_acme_${domainID}
39 acl: acl_tsig_acme_${domainID}
41 dnssec-policy: ed25519
43 # TODO: increase the TTL once things have settled down
48 ; SOA (Start Of Authority)
50 ${toString inputs.self.lastModified} ; Serial number
53 1000h ; Expire (1000h)
63 @ A ${hosts.mermet._module.args.ipv4}
64 mermet A ${hosts.mermet._module.args.ipv4}
65 autoconfig A ${hosts.mermet._module.args.ipv4}
66 code A ${hosts.mermet._module.args.ipv4}
67 git A ${hosts.mermet._module.args.ipv4}
68 imap A ${hosts.mermet._module.args.ipv4}
69 mail A ${hosts.mermet._module.args.ipv4}
70 ns A ${hosts.mermet._module.args.ipv4}
71 pop A ${hosts.mermet._module.args.ipv4}
72 smtp A ${hosts.mermet._module.args.ipv4}
73 submission A ${hosts.mermet._module.args.ipv4}
74 www A ${hosts.mermet._module.args.ipv4}
75 chomsky A 91.216.110.36
78 ; SPF (Sender Policy Framework)
79 @ 3600 IN SPF "v=spf1 mx ip4:${hosts.mermet._module.args.ipv4} -all"
80 @ 3600 IN TXT "v=spf1 mx ip4:${hosts.mermet._module.args.ipv4} -all"
86 _git._tcp.git 18000 IN SRV 0 0 9418 git
88 ; CAA (Certificate Authority Authorization)
89 ; DOC: https://blog.qualys.com/ssllabs/2017/03/13/caa-mandated-by-cabrowser-forum
90 @ CAA 128 issue "letsencrypt.org"
93 networking.nftables.ruleset = ''
96 set output-net-knot-ipv4 { type ipv4_addr; elements = { 217.70.177.40 }; }
97 set output-net-knot-ipv6 { type ipv6_addr; elements = { 2001:4b98:d:1::40 }; }
102 "/run/credentials/knot.service/${domain}.acme.conf"
105 systemd.services.knot.serviceConfig = {
106 LoadCredentialEncrypted = [
107 "${domain}.acme.conf:${inputs.self}/hosts/${hostName}/${domain}/acme.conf.cred"
110 /* Useless since the zone is public
111 services.unbound.settings = {
114 stub-addr = "127.0.0.1@5353";