From 73846b372fe93b5c674ff56e59b2a1dfa70d3d85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Baylac-Jacqu=C3=A9?= Date: Fri, 24 Sep 2021 13:09:37 +0200 Subject: [PATCH] nixos/acme: add webroots to ReadWritePaths Since 7a10478ea7b992ffa1f19f389e53df0fe2aa936d, all /var except /var/lib/acme gets mounted in a read-only fashion. This behavior breaks the existing acme deployments having a webroot set outside of /var/lib/acme. Collecting the webroots and adding them to the paths read/write mounted to the systemd service runtime tree. Fixes #139310 --- nixos/modules/security/acme.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nixos/modules/security/acme.nix b/nixos/modules/security/acme.nix index bcbd17d8e10e..1a5c3592c1f1 100644 --- a/nixos/modules/security/acme.nix +++ b/nixos/modules/security/acme.nix @@ -192,6 +192,14 @@ let ++ data.extraLegoRenewFlags ); + # We need to collect all the ACME webroots to grant them write + # access in the systemd service. + webroots = + lib.remove null + (lib.unique + (builtins.map + (certAttrs: certAttrs.webroot) + (lib.attrValues config.security.acme.certs))); in { inherit accountHash cert selfsignedDeps; @@ -288,6 +296,8 @@ let "acme/.lego/accounts/${accountHash}" ]; + ReadWritePaths = commonServiceConfig.ReadWritePaths ++ webroots; + # Needs to be space separated, but can't use a multiline string because that'll include newlines BindPaths = [ "${accountDir}:/tmp/accounts"