Просмотр исходного кода

Merge pull request #2430 from hestiacp/fix/2427-installer-mariadb

#2427 Adjust installer due to changes MariaDB
Raphael 4 лет назад
Родитель
Сommit
d74cda34b0
2 измененных файлов с 23 добавлено и 18 удалено
  1. 11 12
      install/hst-install-debian.sh
  2. 12 6
      install/hst-install-ubuntu.sh

+ 11 - 12
install/hst-install-debian.sh

@@ -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
 
 

+ 12 - 6
install/hst-install-ubuntu.sh

@@ -1543,13 +1543,19 @@ if [ "$mysql" = 'yes' ]; then
     mysqladmin -u root password $mpass >> $LOG
     echo -e "[client]\npassword='$mpass'\n" > /root/.my.cnf
     chmod 600 /root/.my.cnf
+    
+    # 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;"
 
-    # 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='';"
 fi