summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@lshift.net>2009-10-29 13:43:03 +0000
committerMatthew Sackman <matthew@lshift.net>2009-10-29 13:43:03 +0000
commit1350dd2c2ec4d353e555cc173a00f95f961b4f5d (patch)
tree8fbce6bc18fd76d0869b871b5955c557bc357efc
parent1291cc279c5cbddc499c762fe46142fb3c885560 (diff)
downloadrabbitmq-server-1350dd2c2ec4d353e555cc173a00f95f961b4f5d.tar.gz
Made the wrappers slightly smarter so that they also detect when they're the rabbitmq user and just pass args straight through in this case (which, after testing, really is the right thing to do). Note that at least on debian, the rabbitmq user has the shell of /bin/false, so shouldn't be able to log in, but even so, either edit that to /bin/sh and then su to rabbitmq and then rabbitmqctl list_queues works, or su rabbitmq -s /bin/sh -c "/usr/sbin/rabbitmqctl list_queues" works. In short, it seems to work.
-rw-r--r--packaging/common/rabbitmq-script-wrapper6
-rw-r--r--packaging/macports/net/rabbitmq-server/files/rabbitmq-script-wrapper4
2 files changed, 7 insertions, 3 deletions
diff --git a/packaging/common/rabbitmq-script-wrapper b/packaging/common/rabbitmq-script-wrapper
index 0c4bd0a8..4c3ff35b 100644
--- a/packaging/common/rabbitmq-script-wrapper
+++ b/packaging/common/rabbitmq-script-wrapper
@@ -44,11 +44,13 @@ cd /var/lib/rabbitmq
SCRIPT=`basename $0`
-if [ `id -u` = 0 ] ; then
+if [ `id -u` == 0 ] ; then
su rabbitmq -s /bin/sh -c "/usr/lib/rabbitmq/bin/${SCRIPT} ${CMDLINE}"
+elif [ `id -u` = `id -u rabbitmq` ] ; then
+ /usr/lib/rabbitmq/bin/${SCRIPT} "$@"
else
/usr/lib/rabbitmq/bin/${SCRIPT}
- echo -e "\nOnly root should run ${SCRIPT}\n"
+ echo -e "\nOnly root or rabbitmq should run ${SCRIPT}\n"
exit 1
fi
diff --git a/packaging/macports/net/rabbitmq-server/files/rabbitmq-script-wrapper b/packaging/macports/net/rabbitmq-server/files/rabbitmq-script-wrapper
index 0d7118c4..80cb7bd5 100644
--- a/packaging/macports/net/rabbitmq-server/files/rabbitmq-script-wrapper
+++ b/packaging/macports/net/rabbitmq-server/files/rabbitmq-script-wrapper
@@ -5,9 +5,11 @@ SCRIPT=`basename $0`
if [ `id -u` = 0 ] ; then
sudo -u rabbitmq -H /usr/lib/rabbitmq/bin/${SCRIPT} "$@"
+elif [ `id -u` = `id -u rabbitmq` ] ; then
+ /usr/lib/rabbitmq/bin/${SCRIPT} "$@"
else
/usr/lib/rabbitmq/bin/${SCRIPT}
- echo -e "\nOnly root should run ${SCRIPT}\n"
+ echo -e "\nOnly root or rabbitmq should run ${SCRIPT}\n"
exit 1
fi