ensure we run plugin commands as root. closes #1768

This commit is contained in:
Michael Hobbs committed 2015-12-22 11:16:25 -08:00
1 parent 32f1bc5396
commit d7b1e38cb7
4 files changed
+36 -5

No files matched your search

+5 -1
View File
@@ -49,12 +49,16 @@ if [[ "${args[0]}" =~ ^--.* ]]; then
fi
! has_tty && DOKKU_QUIET_OUTPUT=1
if [[ $(id -un) != "dokku" && $1 != plugin:*install* && $1 != "plugin:update" ]]; then
if [[ $(id -un) != "dokku" ]] && [[ ! $1 =~ plugin:* ]]; then
export SSH_USER=$(id -un)
sudo -u dokku -E -H $0 "$@"
exit $?
fi
if [[ $(id -un) != "root" && $1 =~ plugin:.* ]]; then
dokku_log_fail "plugin:* commands must be run as root"
fi
if [[ -n "$SSH_ORIGINAL_COMMAND" ]]; then
export -n SSH_ORIGINAL_COMMAND
if [[ $1 =~ config-* ]] || [[ $1 =~ docker-options* ]]; then