Add postgres and rabbitmq password update scripts
This commit is contained in:
parent
579dfe5b9e
commit
d0d21f1bc5
|
@ -0,0 +1,21 @@
|
||||||
|
#!/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 sudo > /dev/null || error "sudo command not found!"
|
||||||
|
command -v openssl > /dev/null || error "openssl command not found!"
|
||||||
|
command -v psql > /dev/null || error "psql command not found!"
|
||||||
|
|
||||||
|
typeset -r DB_USER="airtime"
|
||||||
|
typeset -r DB_PASSWORD=$(openssl rand -hex 16)
|
||||||
|
|
||||||
|
echo "Changing password for database user '$DB_USER' to '$DB_PASSWORD'"
|
||||||
|
sudo -u postgres psql -c "ALTER USER $DB_USER WITH PASSWORD '$DB_PASSWORD';"
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/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"
|
Loading…
Reference in New Issue