12 domain = "autogeree.net";
13 domainID = lib.replaceStrings [ "." ] [ "_" ] domain;
14 inherit (config.users) groups;
17 networking.nftables.ruleset = ''
19 # ACME DNS-01 challenge and Gandi DNS
20 set output-net-lego-ipv4 {
23 ${hosts.mermet._module.args.ipv4},
24 ${lib.concatMapStringsSep ", " ({ ipv4, ... }: ipv4) (
25 lib.filter (args: args ? "ipv4") info.lebureau.dns.secondary.ns
29 set output-net-lego-ipv6 {
32 ${lib.concatMapStringsSep ", " ({ ipv6, ... }: ipv6) (
33 lib.filter (args: args ? "ipv6") info.lebureau.dns.secondary.ns
39 security.acme.certs."${domain}" = {
40 email = "root+letsencrypt@${domain}";
44 group = groups.acme.name;
46 dnsProvider = "rfc2136";
47 # ns6.gandi.net takes roughly 5min to update
48 # hence lego's RFC2136_PROPAGATION_TIMEOUT=1000
49 #dnsPropagationCheck = false;
50 credentialsFile = pkgs.writeText "acme-credentials-${domain}" ''
51 RFC2136_NAMESERVER=ns.${domain}:53
52 RFC2136_TSIG_ALGORITHM=hmac-sha256.
53 RFC2136_TSIG_KEY=acme_${domainID}
54 RFC2136_PROPAGATION_TIMEOUT=1000
55 RFC2136_POLLING_INTERVAL=30
56 RFC2136_SEQUENCE_INTERVAL=30
57 RFC2136_DNS_TIMEOUT=1000
61 systemd.services."acme-${domain}" = {
62 serviceConfig.LoadCredentialEncrypted = [
63 "${domain}.tsig:${./. + "/${domain}.tsig.cred"}"
65 environment.RFC2136_TSIG_SECRET_FILE = "%d/${domain}.tsig";
66 after = [ "unbound.service" ];