diff --git a/system-test/create_user.sh b/system-test/create_user.sh index b8b6064b7..4fac0a098 100755 --- a/system-test/create_user.sh +++ b/system-test/create_user.sh @@ -1,10 +1,15 @@ #!/bin/bash +# The following environment variables are used: +# node_user - A custom user to create +# node_password - The password for the user +# require_ssl - Require SSL for all users except the replication user + mysql --force $1 <& /dev/null DROP USER IF EXISTS '$node_user'@'%'; CREATE USER '$node_user'@'%' IDENTIFIED BY '$node_password'; -GRANT ALL PRIVILEGES ON *.* TO '$node_user'@'%' WITH GRANT OPTION; +GRANT ALL PRIVILEGES ON *.* TO '$node_user'@'%' $require_ssl WITH GRANT OPTION; DROP USER IF EXISTS 'repl'@'%'; CREATE USER 'repl'@'%' IDENTIFIED BY 'repl'; @@ -16,7 +21,7 @@ GRANT ALL ON *.* TO 'repl'@'localhost' WITH GRANT OPTION; DROP USER IF EXISTS 'skysql'@'%'; CREATE USER 'skysql'@'%' IDENTIFIED BY 'skysql'; -GRANT ALL ON *.* TO 'skysql'@'%' WITH GRANT OPTION; +GRANT ALL ON *.* TO 'skysql'@'%' $require_ssl WITH GRANT OPTION; DROP USER IF EXISTS 'skysql'@'localhost'; CREATE USER 'skysql'@'localhost' IDENTIFIED BY 'skysql'; @@ -24,19 +29,19 @@ GRANT ALL ON *.* TO 'skysql'@'localhost' WITH GRANT OPTION; DROP USER IF EXISTS 'maxskysql'@'%'; CREATE USER 'maxskysql'@'%' IDENTIFIED BY 'skysql'; -GRANT ALL ON *.* TO 'maxskysql'@'%' WITH GRANT OPTION; +GRANT ALL ON *.* TO 'maxskysql'@'%' $require_ssl WITH GRANT OPTION; DROP USER IF EXISTS 'maxskysql'@'localhost'; CREATE USER 'maxskysql'@'localhost' IDENTIFIED BY 'skysql'; -GRANT ALL ON *.* TO 'maxskysql'@'localhost' WITH GRANT OPTION; +GRANT ALL ON *.* TO 'maxskysql'@'localhost' $require_ssl WITH GRANT OPTION; DROP USER IF EXISTS 'maxuser'@'%'; CREATE USER 'maxuser'@'%' IDENTIFIED BY 'maxpwd'; -GRANT ALL ON *.* TO 'maxuser'@'%' WITH GRANT OPTION; +GRANT ALL ON *.* TO 'maxuser'@'%' $require_ssl WITH GRANT OPTION; DROP USER IF EXISTS 'maxuser'@'localhost'; CREATE USER 'maxuser'@'localhost' IDENTIFIED BY 'maxpwd'; -GRANT ALL ON *.* TO 'maxuser'@'localhost' WITH GRANT OPTION; +GRANT ALL ON *.* TO 'maxuser'@'localhost' $require_ssl WITH GRANT OPTION; RESET MASTER; EOF diff --git a/system-test/create_user_ssl.sh b/system-test/create_user_ssl.sh index 879c57fd1..2190d3ee8 100755 --- a/system-test/create_user_ssl.sh +++ b/system-test/create_user_ssl.sh @@ -1,8 +1,4 @@ #!/bin/bash -echo "DROP USER '$node_user'@'%'" | sudo mysql $1 -echo "grant all privileges on *.* to '$node_user'@'%' identified by '$node_password' require ssl WITH GRANT OPTION" -echo "grant all privileges on *.* to '$node_user'@'%' identified by '$node_password' require ssl WITH GRANT OPTION" | sudo mysql $1 - -echo "grant all privileges on *.* to 'maxskysql'@'%' identified by 'skysql' require ssl WITH GRANT OPTION" | sudo mysql $1 -echo "grant all privileges on *.* to 'maxuser'@'%' identified by 'maxpwd' require ssl WITH GRANT OPTION" | sudo mysql $1 +export require_ssl="REQUIRE SSL" +./create_user.sh $1