mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-11 18:32:23 +08:00
nixos/nextcloud: Pass OC_PASS and NC_PASS environment variables to nextcloud-occ
(cherry picked from commit ba24e7fa23)
This commit is contained in:
committed by
github-actions[bot]
parent
debc5f2cfc
commit
9a0dee2e9c
@@ -65,8 +65,8 @@ The management command [`occ`](https://docs.nextcloud.com/server/stable/admin_ma
|
||||
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.
|
||||
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):
|
||||
|
||||
@@ -165,17 +165,23 @@ let
|
||||
--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
|
||||
|
||||
Reference in New Issue
Block a user