| 1 |
## Test cases for authorization plugins |
| 2 |
|
| 3 |
--source include/xplugin_preamble.inc |
| 4 |
--source include/xplugin_create_user.inc |
| 5 |
|
| 6 |
call mtr.add_suppression("Maximum number of authentication attempts reached, login failed"); |
| 7 |
call mtr.add_suppression("Access denied for user .*"); |
| 8 |
|
| 9 |
## Test starts here |
| 10 |
|
| 11 |
--let $xtest_file= $MYSQL_TMP_DIR/connection_auth_plugin.xpl |
| 12 |
--write_file $xtest_file |
| 13 |
-->quiet |
| 14 |
-->sql |
| 15 |
SELECT user, plugin FROM mysql.user WHERE user = REPLACE(USER(), '@localhost', ''); |
| 16 |
SHOW STATUS LIKE 'Mysqlx_ssl_active'; |
| 17 |
-->endsql |
| 18 |
EOF |
| 19 |
|
| 20 |
CREATE USER xuser_native@localhost |
| 21 |
IDENTIFIED WITH 'mysql_native_password' BY 'native'; |
| 22 |
CREATE USER xuser_sha256@localhost |
| 23 |
IDENTIFIED WITH 'sha256_password' BY 'sha256'; |
| 24 |
GRANT ALL ON *.* TO xuser_native@localhost; |
| 25 |
GRANT ALL ON *.* TO xuser_sha256@localhost; |
| 26 |
|
| 27 |
--let $XBASIC= --file=$xtest_file 2>&1 |
| 28 |
--let $XSSLPARAM= --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256' $XBASIC |
| 29 |
|
| 30 |
--echo Plain connection as x_root (just check) -> success |
| 31 |
--exec $MYSQLXTEST -ux_root $XBASIC |
| 32 |
|
| 33 |
--echo Ssl connection as x_root (just check) -> success |
| 34 |
--exec $MYSQLXTEST -ux_root $XSSLPARAM |
| 35 |
|
| 36 |
--echo Ssl connection by native plugin -> success |
| 37 |
--exec $MYSQLXTEST -uxuser_native -pnative $XSSLPARAM |
| 38 |
|
| 39 |
--echo Plain connection by native plugin -> success |
| 40 |
--exec $MYSQLXTEST -uxuser_native -pnative $XBASIC |
| 41 |
|
| 42 |
--echo Ssl connection by sha256 plugin -> success |
| 43 |
--exec $MYSQLXTEST -uxuser_sha256 -psha256 $XSSLPARAM |
| 44 |
|
| 45 |
--echo Plain connection by sha256 plugin -> fail (ssl is obligatory) |
| 46 |
--exec $MYSQLXTEST --expect-error 2510 -uxuser_sha256 -psha256 $XBASIC |
| 47 |
|
| 48 |
--echo Ssl connection by native plugin -> fail (wrong password) |
| 49 |
--exec $MYSQLXTEST --expect-error ER_ACCESS_DENIED_ERROR -uxuser_native -psha256 $XSSLPARAM |
| 50 |
|
| 51 |
--echo Ssl connection by sha256 plugin -> fail (wrong password) |
| 52 |
--exec $MYSQLXTEST --expect-error ER_ACCESS_DENIED_ERROR -uxuser_sha256 -pnative $XSSLPARAM |
| 53 |
|
| 54 |
## Cleanup |
| 55 |
DROP USER xuser_native@localhost, xuser_sha256@localhost; |
| 56 |
--source ../include/xplugin_cleanup.inc |
| 57 |
|