22 lines
547 B
Plaintext
22 lines
547 B
Plaintext
|
#!/usr/bin/env bash
|
||
|
|
||
|
set -u
|
||
|
|
||
|
error() {
|
||
|
echo >&2 "error: $*"
|
||
|
exit 1
|
||
|
}
|
||
|
|
||
|
# Make sure only root can run our script
|
||
|
(($( id -u) == 0)) || error "this script must be run as root!"
|
||
|
|
||
|
command -v openssl > /dev/null || error "openssl command not found!"
|
||
|
command -v rabbitmqctl > /dev/null || error "rabbitmqctl command not found!"
|
||
|
|
||
|
typeset -r RMQ_USER="airtime"
|
||
|
typeset -r RMQ_PASSWORD=$(openssl rand -hex 16)
|
||
|
|
||
|
# RabbitMQ
|
||
|
echo "Changing password for rabbitmq user '$RMQ_USER' to '$RMQ_PASSWORD'"
|
||
|
rabbitmqctl change_password "$RMQ_USER" "$RMQ_PASSWORD"
|