Improve MySQL utils configuration checks

Debian 11 and MariaDB 10.5 might not have a /root/.my.cnf
The mytop user can be something else than debian-sys-maint
This commit is contained in:
Jérémy Lecour 2021-09-30 10:37:09 +02:00 committed by Jérémy Lecour
parent 92ef1bff32
commit 0586eefc46
2 changed files with 9 additions and 5 deletions

View file

@ -7,6 +7,7 @@ and this project **does not adhere to [Semantic Versioning](http://semver.org/sp
* Check for bullseye security repository
* Checks for new minifirewall configuration
* Improve MySQL utils configuration checks
### Changed

View file

@ -423,17 +423,20 @@ check_apachemunin() {
check_mysqlutils() {
MYSQL_ADMIN=${MYSQL_ADMIN:-mysqladmin}
if is_installed mysql-server; then
# You can configure MYSQL_ADMIN in evocheck.cf
if ! grep -qs "$MYSQL_ADMIN" /root/.my.cnf; then
failed "IS_MYSQLUTILS" "mysqladmin missing in /root/.my.cnf"
# With Debian 11 and later, root can connect to MariaDB with the socket
if is_debian_wheezy || is_debian_jessie || is_debian_stretch || is_debian_buster; then
# You can configure MYSQL_ADMIN in evocheck.cf
if ! grep -qs "^user *= *${MYSQL_ADMIN}" /root/.my.cnf; then
failed "IS_MYSQLUTILS" "${MYSQL_ADMIN} missing in /root/.my.cnf"
fi
fi
if ! test -x /usr/bin/mytop; then
if ! test -x /usr/local/bin/mytop; then
failed "IS_MYSQLUTILS" "mytop binary missing"
fi
fi
if ! grep -qs debian-sys-maint /root/.mytop; then
failed "IS_MYSQLUTILS" "debian-sys-maint missing in /root/.mytop"
if ! grep -qs '^user *=' /root/.mytop; then
failed "IS_MYSQLUTILS" "credentials missing in /root/.mytop"
fi
fi
}