diff options
author | Simon MacMullen <simon@lshift.net> | 2008-11-25 17:08:11 +0000 |
---|---|---|
committer | Simon MacMullen <simon@lshift.net> | 2008-11-25 17:08:11 +0000 |
commit | a9f4b665132ecd180480d7034aefe9b27e730cbd (patch) | |
tree | 988ad36f55a138349a5ed66d28c4178de2b231f2 | |
parent | 674ebe7527cc66c6b4c6751cd8c9006d368e73f9 (diff) | |
download | rabbitmq-server-a9f4b665132ecd180480d7034aefe9b27e730cbd.tar.gz |
Only su to rabbitmq if the user is actually root (otherwise they will be prompted for a password which is incomprehensible). If they are not root, allow them to see help but otherwise fail (since if they run the real rabbitmqctl as a normal user it will talk to the wrong rabbit and again confusion will ensue.
-rw-r--r-- | packaging/debs/Debian/debian/rabbitmqctl_wrapper | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/packaging/debs/Debian/debian/rabbitmqctl_wrapper b/packaging/debs/Debian/debian/rabbitmqctl_wrapper index 75b37c0d..32f677f5 100644 --- a/packaging/debs/Debian/debian/rabbitmqctl_wrapper +++ b/packaging/debs/Debian/debian/rabbitmqctl_wrapper @@ -10,5 +10,16 @@ for arg in "$@" ; do done cd / -su rabbitmq -s /bin/sh -c "/usr/lib/rabbitmq/bin/rabbitmqctl ${CMDLINE}" + +if [ ${UID} = 0 ] ; then + su rabbitmq -s /bin/sh -c "/usr/lib/rabbitmq/bin/rabbitmqctl ${CMDLINE}" + +elif [ $# = 0 -o \( $# = 1 -a "$1" = --help \) ] ; then + # Allow normal user to run for the help message + /bin/sh -c "/usr/lib/rabbitmq/bin/rabbitmqctl ${CMDLINE}" + +else + echo "Only root should run $0" + exit 1 +fi |