Set SSH_USER for root commands

Previously, SSH_USER was not set for plugin:* or ssh-keys:add, which
contradicts the user-auth trigger documentation.

Fixes #2700
This commit is contained in:
Jody McIntyre
2017-04-07 12:46:09 -04:00
parent 918bc9efe8
commit 73a84f90c5

8
dokku
View File

@@ -56,8 +56,12 @@ if [[ $(id -un) != "dokku" ]] && [[ ! $1 =~ plugin:* ]] && [[ ! $1 == "ssh-keys:
exit $?
fi
if [[ $(id -un) != "root" && $1 =~ ^plugin:.* && $1 != "plugin:help" && $1 != "plugin:list" ]] || [[ $(id -un) != "root" && $1 == "ssh-keys:add" ]]; then
dokku_log_fail "This command must be run as root"
if [[ $1 =~ ^plugin:.* && $1 != "plugin:help" && $1 != "plugin:list" ]] || [[ $1 == "ssh-keys:add" ]]; then
if [[ $(id -un) != "root" ]]; then
dokku_log_fail "This command must be run as root"
else
export SSH_USER=root
fi
fi
if [[ -n "$SSH_ORIGINAL_COMMAND" ]]; then