2016-01-12 13:08:43 +01:00
|
|
|
#!/usr/bin/env bash
|
2013-01-11 21:16:42 +01:00
|
|
|
#
|
2013-08-06 21:32:15 +02:00
|
|
|
# Delete the "guest" default user and replace it with a Zulip user
|
2013-01-11 21:16:42 +01:00
|
|
|
# with a real password
|
2016-01-12 13:08:43 +01:00
|
|
|
set -e
|
|
|
|
set -x
|
2013-01-11 21:16:42 +01:00
|
|
|
|
2017-04-19 07:48:40 +02:00
|
|
|
if [ -n "$RABBITMQ_NODE" ]; then
|
|
|
|
RABBITMQ_FLAGS="-n $RABBITMQ_NODE"
|
|
|
|
fi
|
2016-05-08 04:02:32 +02:00
|
|
|
RABBITMQ_USERNAME=$("$(dirname "$0")/../get-django-setting" RABBITMQ_USERNAME)
|
|
|
|
RABBITMQ_PASSWORD=$("$(dirname "$0")/../get-django-setting" RABBITMQ_PASSWORD)
|
2017-04-19 07:48:40 +02:00
|
|
|
sudo rabbitmqctl $RABBITMQ_FLAGS delete_user "$RABBITMQ_USERNAME" || true
|
|
|
|
sudo rabbitmqctl $RABBITMQ_FLAGS delete_user zulip || true
|
|
|
|
sudo rabbitmqctl $RABBITMQ_FLAGS delete_user guest || true
|
|
|
|
sudo rabbitmqctl $RABBITMQ_FLAGS add_user "$RABBITMQ_USERNAME" "$RABBITMQ_PASSWORD"
|
|
|
|
sudo rabbitmqctl $RABBITMQ_FLAGS set_user_tags "$RABBITMQ_USERNAME" administrator
|
|
|
|
sudo rabbitmqctl $RABBITMQ_FLAGS set_permissions -p / "$RABBITMQ_USERNAME" '.*' '.*' '.*'
|