Merge: nixos/nextcloud: Pass OC_PASS and NC_PASS environment variables to nextcloud-occ (#439771)

Changed files
+8 -2
nixos
modules
services
+2 -2
nixos/modules/services/web-apps/nextcloud.md
···
invoked by using the `nextcloud-occ` wrapper that's globally available on a system with Nextcloud enabled.
It requires elevated permissions to become the `nextcloud` user. Given the way the privilege
-
escalation is implemented, parameters passed via the environment to Nextcloud (e.g. `OC_PASS`) are
-
currently ignored.
Custom service units that need to run `nextcloud-occ` either need elevated privileges
or the systemd configuration from `nextcloud-setup.service` (recommended):
···
invoked by using the `nextcloud-occ` wrapper that's globally available on a system with Nextcloud enabled.
It requires elevated permissions to become the `nextcloud` user. Given the way the privilege
+
escalation is implemented, parameters passed via the environment to Nextcloud are
+
currently ignored, except for `OC_PASS` and `NC_PASS`.
Custom service units that need to run `nextcloud-occ` either need elevated privileges
or the systemd configuration from `nextcloud-setup.service` (recommended):
+6
nixos/modules/services/web-apps/nextcloud.nix
···
--wait \
--collect \
--service-type=exec \
--quiet \
${command}
elif [[ "$USER" != nextcloud ]]; then
if [[ -x /run/wrappers/bin/sudo ]]; then
exec /run/wrappers/bin/sudo \
--preserve-env=CREDENTIALS_DIRECTORY \
--user=nextcloud \
${command}
else
exec ${lib.getExe' pkgs.util-linux "runuser"} \
--whitelist-environment=CREDENTIALS_DIRECTORY \
--user=nextcloud \
${command}
fi
···
--wait \
--collect \
--service-type=exec \
+
--setenv OC_PASS \
+
--setenv NC_PASS \
--quiet \
${command}
elif [[ "$USER" != nextcloud ]]; then
if [[ -x /run/wrappers/bin/sudo ]]; then
exec /run/wrappers/bin/sudo \
--preserve-env=CREDENTIALS_DIRECTORY \
+
--preserve-env=OC_PASS \
+
--preserve-env=NC_PASS \
--user=nextcloud \
${command}
else
exec ${lib.getExe' pkgs.util-linux "runuser"} \
--whitelist-environment=CREDENTIALS_DIRECTORY \
+
--whitelist-environment=OC_PASS \
+
--whitelist-environment=NC_PASS \
--user=nextcloud \
${command}
fi