Skip to content

Commit af072cf

Browse files
committed
nixos/nextcloud: Remove --preserve-env in sudo
This helps supporting sudo-rs, which currently does not implement the --preserve-env flag and probably won't so in the foreseeable future [1]. The replacement just sets both environment variables behind the sudo invocation with env, as sudo-rs also doesn't implement env var lists. The OC_PASS variable is dropped, as it is seemingly unused and would leak through this approach through /proc. [1] trifectatechfoundation/sudo-rs#129
1 parent cfdae65 commit af072cf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

nixos/modules/services/web-apps/nextcloud.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ let
9191
cd ${webroot}
9292
sudo=exec
9393
if [[ "$USER" != nextcloud ]]; then
94-
sudo='exec /run/wrappers/bin/sudo -u nextcloud --preserve-env=NEXTCLOUD_CONFIG_DIR --preserve-env=OC_PASS'
94+
sudo='exec /run/wrappers/bin/sudo -u nextcloud'
9595
fi
96-
export NEXTCLOUD_CONFIG_DIR="${datadir}/config"
97-
$sudo \
96+
$sudo ${pkgs.coreutils}/bin/env \
97+
NEXTCLOUD_CONFIG_DIR="${datadir}/config" \
9898
${phpCli} \
9999
occ "$@"
100100
'';

0 commit comments

Comments
 (0)