1 { pkgs, lib, config, hosts, ... }:
3 domain = "autogeree.net";
4 domainID = lib.replaceStrings ["."] ["_"] domain;
5 inherit (config.security) gnupg;
6 inherit (config.users) users groups;
9 networking.nftables.ruleset = ''
11 # ACME DNS-01 challenge and Gandi DNS
12 set output-net-lego-ipv4 {
15 ${hosts.mermet._module.args.ipv4},
19 set output-net-lego-ipv6 {
27 security.acme.certs."${domain}" = {
28 email = "root+letsencrypt@${domain}";
32 group = groups.acme.name;
34 dnsProvider = "rfc2136";
35 # ns6.gandi.net takes roughly 5min to update
36 # hence lego's RFC2136_PROPAGATION_TIMEOUT=1000
37 #dnsPropagationCheck = false;
38 credentialsFile = gnupg.secrets."lego/${domain}/rfc2136".path;
40 security.gnupg.secrets."lego/${domain}/rfc2136" = {
42 cat - ${pkgs.writeText "env" ''
43 RFC2136_NAMESERVER=ns.${domain}:53
44 RFC2136_TSIG_ALGORITHM=hmac-sha256.
45 RFC2136_TSIG_KEY=acme_${domainID}
46 RFC2136_PROPAGATION_TIMEOUT=1000
47 RFC2136_POLLING_INTERVAL=30
48 RFC2136_SEQUENCE_INTERVAL=30
49 RFC2136_DNS_TIMEOUT=1000
54 systemd.services."acme-${domain}" = {
57 gnupg.secrets."lego/${domain}/rfc2136".service
61 gnupg.secrets."lego/${domain}/rfc2136".service