···
# Only try loading the credentialsFile if the dns challenge is enabled
EnvironmentFile = mkIf useDns data.credentialsFile;
368
+
Environment = mkIf useDns
369
+
(mapAttrsToList (k: v: ''"${k}=%d/${k}"'') data.credentialFiles);
371
+
LoadCredential = mkIf useDns
372
+
(mapAttrsToList (k: v: "${k}:${v}") data.credentialFiles);
# Run as root (Prefixed with +)
ExecStartPost = "+" + (pkgs.writeShellScript "acme-postrun" ''
cd /var/lib/acme/${escapeShellArg cert}
···
<https://go-acme.github.io/lego/dns/> for the corresponding dnsProvider.
example = "/var/src/secrets/example.org-route53-api-token";
628
+
credentialFiles = mkOption {
629
+
type = types.attrsOf (types.path);
630
+
inherit (defaultAndText "credentialFiles" {}) default defaultText;
631
+
description = lib.mdDoc ''
632
+
Environment variables suffixed by "_FILE" to set for the cert's service
633
+
for your selected dnsProvider.
634
+
To find out what values you need to set, consult the documentation at
635
+
<https://go-acme.github.io/lego/dns/> for the corresponding dnsProvider.
636
+
This allows to securely pass credential files to lego by leveraging systemd
639
+
example = literalExpression ''
641
+
"RFC2136_TSIG_SECRET_FILE" = "/run/secrets/tsig-secret-example.org";
dnsPropagationCheck = mkOption {
···
One of `security.acme.certs.${cert}.dnsProvider`,
`security.acme.certs.${cert}.webroot`, or
`security.acme.certs.${cert}.listenHTTP` must be provided.
957
+
assertion = all (hasSuffix "_FILE") (attrNames data.credentialFiles);
959
+
Option `security.acme.certs.${cert}.credentialFiles` can only be
960
+
used for variables suffixed by "_FILE".