diff options
Diffstat (limited to 'modules/foundation/www/default.nix')
| -rw-r--r-- | modules/foundation/www/default.nix | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/modules/foundation/www/default.nix b/modules/foundation/www/default.nix index c84e7b4..ef1f8b0 100644 --- a/modules/foundation/www/default.nix +++ b/modules/foundation/www/default.nix @@ -37,15 +37,19 @@ let "favicon.png" = ../../../assets/favicon.png; }; - certificate = domain: dnsProvider: credentialFiles: { + certificate = domain: settings: { ${domain} = { domain = "*.${domain}"; extraDomainNames = [ domain ]; - - inherit dnsProvider credentialFiles; - }; + } // settings; }; + # our zones have wildcard cnames, which lego would follow to + # place the challenge somewhere else. keep it where it belongs. + noCnameFollowing = pkgs.writeText "lego-no-cname" '' + LEGO_DISABLE_CNAME_SUPPORT=true + ''; + # edge addresses of the cdn providers we use, to allow extraction # of the real addresses connecting to us. edgeAddresses = let @@ -124,17 +128,20 @@ in # our certificates are really only used with Nginx group = config.services.nginx.group; reloadServices = [ "nginx.service" ]; + environmentFile = noCnameFollowing; }; # yes, we generate both certificates, even if they are not # used by every machine, but as long as it doesn't cause # any problems... :) certs = mergeAttrsList [ - (certificate "rnrd.eu" "bunny" { - BUNNY_API_KEY_FILE = secrets.bunny-dns.path; + (certificate "rnrd.eu" { + dnsProvider = "bunny"; + credentialFiles.BUNNY_API_KEY_FILE = secrets.bunny-dns.path; }) - (certificate "rnrd.fyi" "cloudflare" { - CLOUDFLARE_DNS_API_TOKEN_FILE = secrets.cloudflare-dns.path; + (certificate "rnrd.fyi" { + dnsProvider = "cloudflare"; + credentialFiles.CLOUDFLARE_DNS_API_TOKEN_FILE = secrets.cloudflare-dns.path; }) ]; }; |
