| 1 |
## XPLUGIN: Following test cases for mysqlx plugin non-ssl connection testing. |
| 2 |
# Created : 21-08-2015 Lalit Choudhary |
| 3 |
|
| 4 |
--echo Preamble |
| 5 |
--source ../include/have_performance_schema_threads.inc |
| 6 |
--source include/xplugin_preamble.inc |
| 7 |
--source include/xplugin_ssl_warnings_suppression.inc |
| 8 |
--source include/xplugin_create_user.inc |
| 9 |
|
| 10 |
SET GLOBAL mysqlx_connect_timeout = 300; |
| 11 |
call mtr.add_suppression("Unsuccessful login attempt"); |
| 12 |
|
| 13 |
# Tests added by QA |
| 14 |
--echo |
| 15 |
--echo ## Non-SSL connection testing for mysqlxtest |
| 16 |
# Started Server with --skip-option. |
| 17 |
|
| 18 |
## Test starts here |
| 19 |
--write_file $MYSQL_TMP_DIR/mysqlx-connection-setup.xpl |
| 20 |
-->sql |
| 21 |
|
| 22 |
CREATE USER user1_mysqlx@localhost |
| 23 |
IDENTIFIED WITH 'mysql_native_password' BY 'auth_string1'; |
| 24 |
CREATE USER user2_mysqlx@localhost |
| 25 |
IDENTIFIED WITH 'mysql_native_password' BY 'auth_string2' |
| 26 |
PASSWORD EXPIRE; |
| 27 |
|
| 28 |
|
| 29 |
# User connection with sha256_password plugin is not supported yet. |
| 30 |
#CREATE USER user3_mysqlx@localhost |
| 31 |
# IDENTIFIED WITH 'sha256_password' BY 'auth_string3'; |
| 32 |
|
| 33 |
CREATE USER user3_mysqlx@localhost |
| 34 |
IDENTIFIED WITH 'mysql_native_password' BY 'auth_string3' |
| 35 |
REQUIRE CIPHER "ECDHE-RSA-AES128-GCM-SHA256" AND |
| 36 |
SUBJECT "/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=Client" |
| 37 |
ISSUER "/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=CA" |
| 38 |
PASSWORD EXPIRE NEVER; |
| 39 |
|
| 40 |
# SSL enabled users |
| 41 |
CREATE USER user4_mysqlx@localhost REQUIRE SSL ACCOUNT LOCK; |
| 42 |
CREATE USER user5_mysqlx@localhost |
| 43 |
IDENTIFIED WITH 'mysql_native_password' BY 'auth_string' |
| 44 |
REQUIRE SSL; |
| 45 |
CREATE USER user6_mysqlx@localhost |
| 46 |
IDENTIFIED WITH 'mysql_native_password' BY 'dwh@#ghd' |
| 47 |
REQUIRE X509; |
| 48 |
|
| 49 |
|
| 50 |
GRANT ALL ON *.* TO user1_mysqlx@localhost; |
| 51 |
GRANT ALL ON *.* TO user2_mysqlx@localhost; |
| 52 |
GRANT ALL ON *.* TO user3_mysqlx@localhost; |
| 53 |
GRANT ALL ON *.* TO user4_mysqlx@localhost; |
| 54 |
GRANT ALL ON *.* TO user5_mysqlx@localhost; |
| 55 |
GRANT ALL ON *.* TO user6_mysqlx@localhost; |
| 56 |
-->endsql |
| 57 |
EOF |
| 58 |
|
| 59 |
--exec $MYSQLXTEST -u x_root --password='' --file=$MYSQL_TMP_DIR/mysqlx-connection-setup.xpl 2>&1 |
| 60 |
|
| 61 |
--write_file $MYSQL_TMP_DIR/mysqlx-connection-info.xpl |
| 62 |
-->sql |
| 63 |
SELECT CONNECTION_TYPE from performance_schema.threads where processlist_command='Query'; |
| 64 |
show status like 'Mysqlx_ssl_version'; |
| 65 |
-->endsql |
| 66 |
EOF |
| 67 |
|
| 68 |
# MYSQLXTEST connections showing connection type should be socket, TCP or SSL/TLS. |
| 69 |
--exec $MYSQLXTEST -u user1_mysqlx --password='auth_string1' --file=$MYSQL_TMP_DIR/mysqlx-connection-info.xpl 2>&1 |
| 70 |
|
| 71 |
# Try connecting with Expired password using user2_mysqlx user. |
| 72 |
--exec $MYSQLXTEST --expect-error ER_MUST_CHANGE_PASSWORD_LOGIN -u user2_mysqlx --password='auth_string2' --file=$MYSQL_TMP_DIR/mysqlx-connection-info.xpl 2>&1 |
| 73 |
|
| 74 |
# Using "connect-expired-password" Option to allow expired password. |
| 75 |
|
| 76 |
--write_file $MYSQL_TMP_DIR/mysqlx-alter-pwd.xpl |
| 77 |
-->sql |
| 78 |
ALTER USER USER() IDENTIFIED BY 'alter-new-auth'; |
| 79 |
-->endsql |
| 80 |
EOF |
| 81 |
|
| 82 |
--write_file $MYSQL_TMP_DIR/mysqlx-set-pwd.xpl |
| 83 |
-->sql |
| 84 |
SET PASSWORD='set-new-auth'; |
| 85 |
-->endsql |
| 86 |
EOF |
| 87 |
|
| 88 |
|
| 89 |
# Testing connection with --connect-expired-password and without SSL options. |
| 90 |
--exec $MYSQLXTEST -u user2_mysqlx --password='auth_string2' --connect-expired-password --file=$MYSQL_TMP_DIR/mysqlx-alter-pwd.xpl 2>&1 |
| 91 |
|
| 92 |
ALTER USER user2_mysqlx@localhost PASSWORD EXPIRE; |
| 93 |
--exec $MYSQLXTEST -u user2_mysqlx --password='alter-new-auth' --connect-expired-password --file=$MYSQL_TMP_DIR/mysqlx-set-pwd.xpl 2>&1 |
| 94 |
|
| 95 |
--exec $MYSQLXTEST -u user2_mysqlx --password='set-new-auth' --connect-expired-password --file=$MYSQL_TMP_DIR/mysqlx-connection-info.xpl 2>&1 |
| 96 |
|
| 97 |
# Expecting error since MYSQLXTEST trying to take connection using ssl option to Non-SSL enabled server. |
| 98 |
--exec $MYSQLXTEST --expect-error ER_X_CAPABILITIES_PREPARE_FAILED -u user2_mysqlx --password='set-new-auth' --ssl-key=$MYSQL_TEST_DIR/std_data/server-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/server-cert.pem --ssl-mode=required --file=$MYSQL_TMP_DIR/mysqlx-connection-info.xpl 2>&1 |
| 99 |
|
| 100 |
--exec $MYSQLXTEST -u user2_mysqlx --password='set-new-auth' --file=$MYSQL_TMP_DIR/mysqlx-set-pwd.xpl 2>&1 |
| 101 |
|
| 102 |
--exec $MYSQLXTEST --expect-error 2510 -u user3_mysqlx --password='auth_string3' --file=$MYSQL_TMP_DIR/mysqlx-connection-info.xpl 2>&1 |
| 103 |
|
| 104 |
--exec $MYSQLXTEST --expect-error ER_ACCOUNT_HAS_BEEN_LOCKED -u user4_mysqlx --password='' --file=$MYSQL_TMP_DIR/mysqlx-connection-info.xpl 2>&1 |
| 105 |
|
| 106 |
# Unlocking user account. |
| 107 |
ALTER USER user4_mysqlx@localhost ACCOUNT UNLOCK; |
| 108 |
|
| 109 |
# Expecting error since ssl required users trying to connect on non-ssl enabled server. |
| 110 |
--exec $MYSQLXTEST --expect-error 2510 -u user4_mysqlx --password='' --file=$MYSQL_TMP_DIR/mysqlx-connection-info.xpl 2>&1 |
| 111 |
|
| 112 |
--exec $MYSQLXTEST --expect-error 2510 -u user5_mysqlx --password='auth_string' --file=$MYSQL_TMP_DIR/mysqlx-connection-info.xpl 2>&1 |
| 113 |
|
| 114 |
--exec $MYSQLXTEST --expect-error 2510 -u user6_mysqlx --password='dwh@#ghd' --file=$MYSQL_TMP_DIR/mysqlx-connection-info.xpl 2>&1 |
| 115 |
|
| 116 |
# Cleanup |
| 117 |
DROP USER user1_mysqlx@localhost, user2_mysqlx@localhost, user3_mysqlx@localhost, |
| 118 |
user4_mysqlx@localhost, user5_mysqlx@localhost, user6_mysqlx@localhost; |
| 119 |
SET GLOBAL mysqlx_connect_timeout= DEFAULT; |
| 120 |
--source ../include/xplugin_cleanup.inc |