From 9ade8f6eb774dc7d19d82a070199b5024786b819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Fri, 17 May 2019 01:43:18 +0200 Subject: Use acme directory config rather than hardcoding the value --- nixops/modules/certificates.nix | 14 +++++++------- nixops/modules/ftp.nix | 2 +- nixops/modules/irc.nix | 2 +- nixops/modules/task/default.nix | 6 +++--- nixops/modules/websites/default.nix | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) (limited to 'nixops') diff --git a/nixops/modules/certificates.nix b/nixops/modules/certificates.nix index 9a9974e..72896fd 100644 --- a/nixops/modules/certificates.nix +++ b/nixops/modules/certificates.nix @@ -3,7 +3,7 @@ options.services.myCertificates = { certConfig = lib.mkOption { default = { - webroot = "/var/lib/acme/acme-challenge"; + webroot = "${config.security.acme.directory}/acme-challenge"; email = "ismael@bouya.org"; postRun = '' systemctl reload httpdTools.service httpdInte.service httpdProd.service @@ -29,14 +29,14 @@ systemd.services = lib.attrsets.mapAttrs' (k: v: lib.attrsets.nameValuePair "acme-selfsigned-${k}" (lib.mkBefore { script = (lib.optionalString (builtins.elem "cert.pem" v.plugins) '' - cp $workdir/server.crt /var/lib/acme/${k}/cert.pem - chown '${v.user}:${v.group}' /var/lib/acme/${k}/cert.pem - chmod ${if v.allowKeysForGroup then "750" else "700"} /var/lib/acme/${k}/cert.pem + cp $workdir/server.crt ${config.security.acme.directory}/${k}/cert.pem + chown '${v.user}:${v.group}' ${config.security.acme.directory}/${k}/cert.pem + chmod ${if v.allowKeysForGroup then "750" else "700"} ${config.security.acme.directory}/${k}/cert.pem '') + (lib.optionalString (builtins.elem "chain.pem" v.plugins) '' - cp $workdir/ca.crt /var/lib/acme/${k}/chain.pem - chown '${v.user}:${v.group}' /var/lib/acme/${k}/chain.pem - chmod ${if v.allowKeysForGroup then "750" else "700"} /var/lib/acme/${k}/chain.pem + cp $workdir/ca.crt ${config.security.acme.directory}/${k}/chain.pem + chown '${v.user}:${v.group}' ${config.security.acme.directory}/${k}/chain.pem + chmod ${if v.allowKeysForGroup then "750" else "700"} ${config.security.acme.directory}/${k}/chain.pem '') ; }) ) config.security.acme.certs // { diff --git a/nixops/modules/ftp.nix b/nixops/modules/ftp.nix index 871e9ef..842d2d6 100644 --- a/nixops/modules/ftp.nix +++ b/nixops/modules/ftp.nix @@ -102,7 +102,7 @@ MaxDiskUsage 99 CustomerProof yes TLS 1 - CertFile /var/lib/acme/ftp/full.pem + CertFile ${config.security.acme.directory}/ftp/full.pem ''; in { description = "Pure-FTPd server"; diff --git a/nixops/modules/irc.nix b/nixops/modules/irc.nix index a4f6f93..363bfef 100644 --- a/nixops/modules/irc.nix +++ b/nixops/modules/irc.nix @@ -40,7 +40,7 @@ bitlbee = { accept = 6697; connect = 6667; - cert = "/var/lib/acme/irc/full.pem"; + cert = "${config.security.acme.directory}/irc/full.pem"; }; }; }; diff --git a/nixops/modules/task/default.nix b/nixops/modules/task/default.nix index 426aa68..e1c933f 100644 --- a/nixops/modules/task/default.nix +++ b/nixops/modules/task/default.nix @@ -236,9 +236,9 @@ in { inherit fqdn; listenHost = "::"; pki.manual.ca.cert = "${server_vardir}/keys/ca.cert"; - pki.manual.server.cert = "/var/lib/acme/task/fullchain.pem"; - pki.manual.server.crl = "/var/lib/acme/task/invalid.crl"; - pki.manual.server.key = "/var/lib/acme/task/key.pem"; + pki.manual.server.cert = "${config.security.acme.directory}/task/fullchain.pem"; + pki.manual.server.crl = "${config.security.acme.directory}/task/invalid.crl"; + pki.manual.server.key = "${config.security.acme.directory}/task/key.pem"; requestLimit = 104857600; }; diff --git a/nixops/modules/websites/default.nix b/nixops/modules/websites/default.nix index 5b839af..432ad3c 100644 --- a/nixops/modules/websites/default.nix +++ b/nixops/modules/websites/default.nix @@ -179,7 +179,7 @@ in system.activationScripts = { httpd = '' - install -d -m 0755 /var/lib/acme/acme-challenge + install -d -m 0755 ${config.security.acme.directory}/acme-challenge install -d -m 0750 -o wwwrun -g wwwrun /var/lib/php/sessions install -d -m 0750 -o wwwrun -g wwwrun /var/lib/php/sessions/adminer install -d -m 0750 -o wwwrun -g wwwrun /var/lib/php/tmp/adminer -- cgit v1.2.3