From 0586eefc46a8de0ba8474d8d6204be37ebbfea6d Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Thu, 30 Sep 2021 10:37:09 +0200 Subject: [PATCH] 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 --- CHANGELOG | 1 + evocheck.sh | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 70bbf42..1cdd160 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/evocheck.sh b/evocheck.sh index 57fa0f6..8912760 100755 --- a/evocheck.sh +++ b/evocheck.sh @@ -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 }