|
|
@@ -1518,18 +1518,17 @@ if [ "$mysql" = 'yes' ]; then
|
|
|
systemctl start mysql >> $LOG
|
|
|
check_result $? "mariadb start failed"
|
|
|
|
|
|
- # Securing MariaDB installation
|
|
|
- mpass=$(gen_pass)
|
|
|
- mysqladmin -u root password $mpass >> $LOG
|
|
|
- echo -e "[client]\npassword='$mpass'\n" > /root/.my.cnf
|
|
|
- chmod 600 /root/.my.cnf
|
|
|
-
|
|
|
- # Clear MariaDB Test Users and Databases
|
|
|
- mysql -e "DELETE FROM mysql.user WHERE User=''"
|
|
|
- mysql -e "DROP DATABASE test" > /dev/null 2>&1
|
|
|
- mysql -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'"
|
|
|
- mysql -e "DELETE FROM mysql.user WHERE user='';"
|
|
|
- mysql -e "DELETE FROM mysql.user WHERE password='' AND authentication_string='';"
|
|
|
+ # Ater root password
|
|
|
+ mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$mpass'; FLUSH PRIVILEGES;"
|
|
|
+ # Remove root login from remote servers
|
|
|
+ mysql -e "DELETE FROM mysql.global_priv WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
|
|
|
+ # Disable anonymous users
|
|
|
+ mysql -e "DELETE FROM mysql.global_priv WHERE User='';"
|
|
|
+ # Drop test database
|
|
|
+ mysql -e "DROP DATABASE IF EXISTS test"
|
|
|
+ mysql -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%"
|
|
|
+
|
|
|
+ mysql -e "FLUSH PRIVILEGES;"
|
|
|
fi
|
|
|
|
|
|
|