diff options
author | Anel Husakovic <anel@mariadb.org> | 2021-06-23 13:51:23 +0200 |
---|---|---|
committer | Anel Husakovic <anel@mariadb.org> | 2021-07-06 11:08:57 +0200 |
commit | 3c34332fb862424aef814b9960b27d8b225da2ff (patch) | |
tree | 6abb8f082a864df50052596424df18aa07315c4c | |
parent | e176648efd5607094addd3cc6f9b29f9564f70e3 (diff) | |
download | mariadb-git-3c34332fb862424aef814b9960b27d8b225da2ff.tar.gz |
Try to run and save mysql_secure_installation mtr test
- Note: server was manually started and mtr test is invoked -> so this
is fake test
- It is left with bunch of files:
```
mysql-test/.my.cnf.22917
mysql-test/.my.cnf.23180
mysql-test/.my.cnf.23334
mysql-test/.my.cnf.23582
mysql-test/.my.cnf.32683
mysql-test/.my.cnf.47216
mysql-test/.my.cnf.81379
mysql-test/.my.output.23582
mysql-test/.my.output.32683
mysql-test/.my.output.47216
mysql-test/.my.output.81379
mysql-test/.mysql.22917
mysql-test/.mysql.23180
mysql-test/.mysql.23334
mysql-test/.mysql.23582
mysql-test/.mysql.32683
mysql-test/.mysql.47216
mysql-test/.mysql.81379
```
which should be removed after proper fix
-rw-r--r-- | mysql-test/main/mysql_secure_installation.result | 71 | ||||
-rw-r--r-- | mysql-test/main/mysql_secure_installation.test | 8 | ||||
-rw-r--r-- | scripts/mysql_secure_installation.sh | 2 |
3 files changed, 78 insertions, 3 deletions
diff --git a/mysql-test/main/mysql_secure_installation.result b/mysql-test/main/mysql_secure_installation.result new file mode 100644 index 00000000000..dcf0e084974 --- /dev/null +++ b/mysql-test/main/mysql_secure_installation.result @@ -0,0 +1,71 @@ +SELECT user,host FROM mysql.global_priv ORDER BY user,host; +user host +mariadb.sys localhost +root 127.0.0.1 +root ::1 +root anel +root localhost + +NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB + SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! + +In order to log into MariaDB to secure it, we'll need the current +password for a privileged user. If you've just installed MariaDB, and +haven't set a privileged password yet, you should just press enter here. + +For which user do you want to specify a password (press enter for USERNAME): +Enter current password for user rootnnUSERNAMEnYnsecretnsecretnYnnn (enter for none): +Only privileged user can make changes to mysql DB. +For which user do you want to specify a password (press enter for USERNAME): +.my.output.47113 +1 +OK, successfully used password, moving on... + +User: USERNAME and 1 + +You already have your user account protected (unix_socket auth and password set, or password impossible to use), so you can safely answer 'n'. + +Set the user: USERNAME password? [Y/n] ... skipping. + +By default, a MariaDB installation has an anonymous user, allowing anyone +to log into MariaDB without having to have a user account created for +them. This is intended only for testing, and to make the installation +go a bit smoother. You should remove them before moving into a +production environment. + +Remove anonymous users? [Y/n] ... Success! + +By default, MariaDB comes with a database named 'test' that anyone can +access. This is also intended only for testing, and should be removed +before moving into a production environment. + +Remove test database and access to it? [Y/n] - Dropping test database... + ... Success! + - Removing privileges on test database... + ... Success! + +Normally, root should only be allowed to connect from 'localhost'. This +ensures that someone cannot guess at the root password from the network. + +Disallow root login remotely? [Y/n] ... Success! + +Cleaning up... + +All done! If you've completed all of the above steps, your MariaDB +installation should now be secure. + +Thanks for using MariaDB! +SHOW DATABASES; +Database +information_schema +mtr +mysql +performance_schema +test +SELECT user,host FROM mysql.global_priv ORDER BY user,host; +user host +mariadb.sys localhost +root 127.0.0.1 +root ::1 +root anel +root localhost diff --git a/mysql-test/main/mysql_secure_installation.test b/mysql-test/main/mysql_secure_installation.test index 353a2a700a5..f16a14eeb1e 100644 --- a/mysql-test/main/mysql_secure_installation.test +++ b/mysql-test/main/mysql_secure_installation.test @@ -3,9 +3,13 @@ SELECT user,host FROM mysql.global_priv ORDER BY user,host; --replace_result $USER USERNAME ---exec echo -e "root\n\nbob\nY\nsecret\nsecret\nY\n\n\n" | bash -x -v $MYSQL_SECURE_INSTALLATION -S $MASTER_MYSOCK +# Creating a temporary text file. +--write_file $MYSQL_TMP_DIR/mariadb-secure-installation.txt +root\n\nanel\nY\nsecret\nsecret\nY\n\n\n +EOF + +--exec $MYSQL_SECURE_INSTALLATION < $MYSQL_TMP_DIR/mariadb-secure-installation.txt SHOW DATABASES; SELECT user,host FROM mysql.global_priv ORDER BY user,host; -SELECT 1; diff --git a/scripts/mysql_secure_installation.sh b/scripts/mysql_secure_installation.sh index a2ae5307733..e224def9586 100644 --- a/scripts/mysql_secure_installation.sh +++ b/scripts/mysql_secure_installation.sh @@ -535,7 +535,7 @@ while true ; do else echo "You already have your user account protected (unix_socket auth and password set, or password impossible to use), so you can safely answer 'n'." echo - echo $echo_n "Set the user: $user password? [y/N] $echo_c" + echo $echo_n "Set the user: $user password? [Y/n] $echo_c" defsetpass=N fi read reply |