TT#122035 Allow ngcp-synd-db to sync passwords from db01 on Carrier

The bullsyeye-based MariaDB 10.5.9 has invalid root password set by default.
It is not possible to connect DB instance from network, the only option is
to connect DB instance through the socket.

The ngcp-installer calls ngcp-sync-db to replicate db01:3306->prx01:3308
on proxy node for the Carrier case. We have to open networking root access
temporary. ngcp-sync-db will replicate 'root' password from db01 the next moment.

Also update '1>/dev/null 2>/dev/null' to Sipwise style '&>/dev/null'.

Change-Id: I12ff71efdd8283531f03ceaf87345f3cc4e71419
mr9.5.1
Alexander Lutay 5 years ago
parent cb5bedcea4
commit a6dcea5e09

@ -54,7 +54,7 @@ declare -a MYSQL_OPTS=()
MYSQL_OPTS+=("--defaults-extra-file=${SIPWISE_EXTRA_CNF}")
# check connection with sipwise user
if ! mysql "${MYSQL_OPTS[@]}" -e 'SELECT 1;' 1>/dev/null 2>/dev/null ; then
if ! mysql "${MYSQL_OPTS[@]}" -e 'SELECT 1;' &>/dev/null ; then
echo "Error: can't connect to local MariaDB port 3306 using '${SIPWISE_EXTRA_CNF}'" >&2
exit 1
fi
@ -250,6 +250,19 @@ revision_wrapper $(printf '%s\0' *.up | sort -z -n | while IFS= read -r -d "" fi
# for carrier prx* hosts sync master-slave replication for not_replicated statements (if any)
if $RUN_SYNC_DB && ($NOT_REPLICATED_REV_APPLIED || [ -n "$AUTOMATED_INSTALL_MODE" ]); then
# check connection to MariaDB on port 3308 using socket to bypass auth as root has invalid password
if ! mysql -S /run/mysqld/mysqld2.sock -e 'SELECT 1;' &>/dev/null ; then
echo "Error: can't connect to local MariaDB:3308 using socket '/run/mysqld/mysqld2.sock'" >&2
exit 1
fi
# Reset 'root' password temporary to allow ngcp-sync-db replicate all credentials from db01
if ! mysql -S /run/mysqld/mysqld2.sock -e "SET PASSWORD FOR root@localhost = '';" 2>/dev/null ; then
echo "Error: Failed to temporary reset password for user 'root' on MariaDB:3308" >&2
exit 1
fi
if [ -x "$SYNC_DB" ] ; then
PRX_SYNC_DBS="ngcp billing carrier kamailio provisioning prosody mysql"
PRX_IGNORE_TABLES="kamailio.voicemail_spool"

Loading…
Cancel
Save