]> git.immae.eu Git - perso/Immae/Config/Nix/NUR.git/commitdiff
Make acme-challenge writable
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Fri, 21 Feb 2020 22:27:06 +0000 (23:27 +0100)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Fri, 24 Apr 2020 22:04:49 +0000 (00:04 +0200)
modules/acme2.nix

index 408c098eaa9de71d393a3e4b91948e2fc6a45863..6c6d9a7a4c2211c1fd93d3e10b2de4f82390bf35 100644 (file)
@@ -239,6 +239,17 @@ in
                     PrivateTmp = true;
                     StateDirectory = lpath;
                     StateDirectoryMode = rights;
+                    ExecStartPre =
+                      let
+                        script = pkgs.writeScript "acme-pre-start" ''
+                          #!${pkgs.runtimeShell} -e
+                          mkdir -p '${data.webroot}/.well-known/acme-challenge'
+                          chmod a+w '${data.webroot}/.well-known/acme-challenge'
+                          #doesn't work for multiple concurrent runs
+                          #chown -R '${data.user}:${data.group}' '${data.webroot}/.well-known/acme-challenge'
+                        '';
+                      in
+                        "+${script}";
                     WorkingDirectory = "/var/lib/${lpath}";
                     ExecStart = "${pkgs.simp_le_0_17}/bin/simp_le ${escapeShellArgs cmdline}";
                     ExecStartPost =
@@ -308,6 +319,7 @@ in
         in
           servicesAttr;
 
+      # FIXME: this doesn't work for multiple users
       systemd.tmpfiles.rules =
         flip mapAttrsToList cfg.certs
         (cert: data: "d ${data.webroot}/.well-known/acme-challenge - ${data.user} ${data.group}");