mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2025-04-22 10:19:04 +02:00
Improved password usage in MySQL tools
This commit is contained in:
parent
e211ab5cf4
commit
01fe85c395
@ -223,11 +223,15 @@ check_db_connect_mysql() {
|
|||||||
|
|
||||||
ssl_opts="$(db_tls_params)"
|
ssl_opts="$(db_tls_params)"
|
||||||
|
|
||||||
|
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||||
|
|
||||||
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
|
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
|
||||||
--password="${DB_SERVER_ROOT_PASS}" --silent --connect_timeout=10 $ssl_opts)" ]; do
|
--silent --connect_timeout=10 $ssl_opts)" ]; do
|
||||||
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||||
sleep $WAIT_TIMEOUT
|
sleep $WAIT_TIMEOUT
|
||||||
done
|
done
|
||||||
|
|
||||||
|
unset MYSQL_PWD
|
||||||
}
|
}
|
||||||
|
|
||||||
mysql_query() {
|
mysql_query() {
|
||||||
@ -236,8 +240,12 @@ mysql_query() {
|
|||||||
|
|
||||||
ssl_opts="$(db_tls_params)"
|
ssl_opts="$(db_tls_params)"
|
||||||
|
|
||||||
|
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||||
|
|
||||||
result=$(mysql --silent --skip-column-names -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
|
result=$(mysql --silent --skip-column-names -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
|
||||||
-u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" -e "$query" $ssl_opts)
|
-u ${DB_SERVER_ROOT_USER} -e "$query" $ssl_opts)
|
||||||
|
|
||||||
|
unset MYSQL_PWD
|
||||||
|
|
||||||
echo $result
|
echo $result
|
||||||
}
|
}
|
||||||
@ -284,10 +292,14 @@ create_db_schema_mysql() {
|
|||||||
|
|
||||||
ssl_opts="$(db_tls_params)"
|
ssl_opts="$(db_tls_params)"
|
||||||
|
|
||||||
|
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||||
|
|
||||||
zcat /usr/share/doc/zabbix-proxy-mysql/create.sql.gz | mysql --silent --skip-column-names \
|
zcat /usr/share/doc/zabbix-proxy-mysql/create.sql.gz | mysql --silent --skip-column-names \
|
||||||
-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
|
-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
|
||||||
-u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" $ssl_opts \
|
-u ${DB_SERVER_ROOT_USER} $ssl_opts \
|
||||||
${DB_SERVER_DBNAME} 1>/dev/null
|
${DB_SERVER_DBNAME} 1>/dev/null
|
||||||
|
|
||||||
|
unset MYSQL_PWD
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,11 +217,15 @@ check_db_connect_mysql() {
|
|||||||
|
|
||||||
ssl_opts="$(db_tls_params)"
|
ssl_opts="$(db_tls_params)"
|
||||||
|
|
||||||
|
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||||
|
|
||||||
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
|
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
|
||||||
--password="${DB_SERVER_ROOT_PASS}" --silent --connect_timeout=10 $ssl_opts)" ]; do
|
--silent --connect_timeout=10 $ssl_opts)" ]; do
|
||||||
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||||
sleep $WAIT_TIMEOUT
|
sleep $WAIT_TIMEOUT
|
||||||
done
|
done
|
||||||
|
|
||||||
|
unset MYSQL_PWD
|
||||||
}
|
}
|
||||||
|
|
||||||
mysql_query() {
|
mysql_query() {
|
||||||
@ -230,8 +234,12 @@ mysql_query() {
|
|||||||
|
|
||||||
ssl_opts="$(db_tls_params)"
|
ssl_opts="$(db_tls_params)"
|
||||||
|
|
||||||
|
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||||
|
|
||||||
result=$(mysql --silent --skip-column-names -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
|
result=$(mysql --silent --skip-column-names -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
|
||||||
-u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" -e "$query" $ssl_opts)
|
-u ${DB_SERVER_ROOT_USER} -e "$query" $ssl_opts)
|
||||||
|
|
||||||
|
unset MYSQL_PWD
|
||||||
|
|
||||||
echo $result
|
echo $result
|
||||||
}
|
}
|
||||||
@ -278,10 +286,12 @@ create_db_schema_mysql() {
|
|||||||
|
|
||||||
ssl_opts="$(db_tls_params)"
|
ssl_opts="$(db_tls_params)"
|
||||||
|
|
||||||
|
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||||
zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql --silent --skip-column-names \
|
zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql --silent --skip-column-names \
|
||||||
-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
|
-h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} \
|
||||||
-u ${DB_SERVER_ROOT_USER} --password="${DB_SERVER_ROOT_PASS}" $ssl_opts \
|
-u ${DB_SERVER_ROOT_USER} $ssl_opts \
|
||||||
${DB_SERVER_DBNAME} 1>/dev/null
|
${DB_SERVER_DBNAME} 1>/dev/null
|
||||||
|
unset MYSQL_PWD
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,11 +214,15 @@ check_db_connect() {
|
|||||||
|
|
||||||
ssl_opts="$(db_tls_params)"
|
ssl_opts="$(db_tls_params)"
|
||||||
|
|
||||||
|
export MYSQL_PWD="${DB_SERVER_ROOT_PASS}"
|
||||||
|
|
||||||
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
|
while [ ! "$(mysqladmin ping -h ${DB_SERVER_HOST} -P ${DB_SERVER_PORT} -u ${DB_SERVER_ROOT_USER} \
|
||||||
--password="${DB_SERVER_ROOT_PASS}" --silent --connect_timeout=10 $ssl_opts)" ]; do
|
--silent --connect_timeout=10 $ssl_opts)" ]; do
|
||||||
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
echo "**** MySQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||||
sleep $WAIT_TIMEOUT
|
sleep $WAIT_TIMEOUT
|
||||||
done
|
done
|
||||||
|
|
||||||
|
unset MYSQL_PWD
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_web_server() {
|
prepare_web_server() {
|
||||||
|
Loading…
Reference in New Issue
Block a user