From a50644f1817995f60d8c51d2657e880e815a2272 Mon Sep 17 00:00:00 2001 From: Lucas Savva Date: Mon, 13 Apr 2020 23:54:44 +0100 Subject: [PATCH] acme: share accounts between certificates There are strict rate limits on account creation for Let's Encrypt certificates. It is important to reuse credentails when possible. (cherry picked from commit 827d5e6b4448559e3fc13cfbfd122c67497cc43c) --- nixos/modules/security/acme.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nixos/modules/security/acme.nix b/nixos/modules/security/acme.nix index 841de6b3bdd01..4b026b8e1f2ab 100644 --- a/nixos/modules/security/acme.nix +++ b/nixos/modules/security/acme.nix @@ -329,13 +329,14 @@ in User = data.user; Group = data.group; PrivateTmp = true; - StateDirectory = "acme/.lego/${cert} ${lpath}"; + StateDirectory = "acme/.lego/${cert} acme/.lego/accounts ${lpath}"; StateDirectoryMode = if data.allowKeysForGroup then "750" else "700"; WorkingDirectory = spath; # Only try loading the credentialsFile if the dns challenge is enabled EnvironmentFile = if data.dnsProvider != null then data.credentialsFile else null; ExecStart = pkgs.writeScript "acme-start" '' #!${pkgs.runtimeShell} -e + test -L ${spath}/accounts -o -d ${spath}/accounts || ln -s ../accounts ${spath}/accounts ${pkgs.lego}/bin/lego ${renewOpts} || ${pkgs.lego}/bin/lego ${runOpts} ''; ExecStartPost =