| 1 |
call mtr.add_suppression('failed to read private_key.pem: 2 "No such file or directory"'); |
| 2 |
call mtr.add_suppression('Authentication requires either RSA keys or secure transport'); |
| 3 |
|
| 4 |
if ($CLIENT_TLS_LIBRARY == "GnuTLS") { |
| 5 |
skip Test requires client library, which is not built with GnuTLS; |
| 6 |
} |
| 7 |
|
| 8 |
source init.inc; |
| 9 |
|
| 10 |
query_vertical select * from information_schema.system_variables where variable_name like 'caching_sha2_password%' order by 1; |
| 11 |
|
| 12 |
--error ER_PASSWD_LENGTH |
| 13 |
create user test3@'%' identified via caching_sha2_password using 'pwd'; |
| 14 |
--error ER_PASSWD_LENGTH |
| 15 |
create user test3@'%' identified via caching_sha2_password using '0000000000000000000000000000000000000000000000000000000000000000000000'; |
| 16 |
|
| 17 |
replace_result $MASTER_MYSOCK MASTER_MYSOCK $MASTER_MYPORT MASTER_MYPORT; |
| 18 |
error 2061; |
| 19 |
connect con1, localhost,test1,pwd,,,,TCP NOSSL; |
| 20 |
replace_result $MASTER_MYSOCK MASTER_MYSOCK $MASTER_MYPORT MASTER_MYPORT; |
| 21 |
error 2061; |
| 22 |
connect con3, localhost,test1,wrong_pwd,,,,TCP NOSSL; |
| 23 |
connect con4, localhost,test2,,,,,TCP NOSSL; |
| 24 |
call checkme(); |
| 25 |
disconnect con4; |
| 26 |
replace_result $MASTER_MYSOCK MASTER_MYSOCK $MASTER_MYPORT MASTER_MYPORT; |
| 27 |
error ER_ACCESS_DENIED_ERROR; |
| 28 |
connect con5, localhost,test2 pwd,,,,,TCP NOSSL; |
| 29 |
|
| 30 |
connection default; |
| 31 |
|
| 32 |
let $restart_parameters= --caching_sha2_password-auto_generate_rsa_keys; |
| 33 |
source include/restart_mysqld.inc; |
| 34 |
select length(variable_value) from information_schema.global_status |
| 35 |
where variable_name like 'caching_sha2_password%'; |
| 36 |
let pubkey=`select variable_value from information_schema.global_status |
| 37 |
where variable_name like 'caching_sha2_password%'`; |
| 38 |
|
| 39 |
let $restart_parameters= --caching_sha2_password-auto_generate_rsa_keys; |
| 40 |
source include/restart_mysqld.inc; |
| 41 |
evalp select variable_value="$pubkey" as 'key did not change' |
| 42 |
from information_schema.global_status |
| 43 |
where variable_name like 'caching_sha2_password%'; |
| 44 |
|
| 45 |
|
| 46 |
# again, this time with keys |
| 47 |
connect con1, localhost,test1,pwd,,,,TCP NOSSL; |
| 48 |
call checkme(); |
| 49 |
disconnect con1; |
| 50 |
connect con2, localhost,test1,pwd,,,,TCP NOSSL; |
| 51 |
call checkme(); |
| 52 |
disconnect con2; |
| 53 |
replace_result $MASTER_MYSOCK MASTER_MYSOCK $MASTER_MYPORT MASTER_MYPORT; |
| 54 |
error ER_ACCESS_DENIED_ERROR; |
| 55 |
connect con3, localhost,test1,wrong_pwd,,,,TCP NOSSL; |
| 56 |
connect con4, localhost,test2,,,,,TCP NOSSL; |
| 57 |
call checkme(); |
| 58 |
disconnect con4; |
| 59 |
replace_result $MASTER_MYSOCK MASTER_MYSOCK $MASTER_MYPORT MASTER_MYPORT; |
| 60 |
error ER_ACCESS_DENIED_ERROR; |
| 61 |
connect con5, localhost,test2 pwd,,,,,TCP NOSSL; |
| 62 |
connection default; |
| 63 |
|
| 64 |
# |
| 65 |
# Compatibility with MySQL password hashes |
| 66 |
# |
| 67 |
create user u1@localhost identified via caching_sha2_password using '$A$005$5dx;X)z |kX]\ZNx7QTrl0oTy2C0/f4bggQMFIDnSDeZ7koLoO417jc9D'; |
| 68 |
create user u2@localhost identified via caching_sha2_password using '$A$005$dL\Zq]<7d[YAbk}x!;^.qMuuUUBmB5aF7x7GsAKZzpb24p94NCCs8qPgwAvwc1'; |
| 69 |
create user u3@localhost identified via caching_sha2_password using '$A$005$L9\ZKiwT''=%dMoqrPGFbywI9G8NecJqiy9D04S2abTLRvD32powG8nIxI9'; |
| 70 |
|
| 71 |
grant execute on test.* to u1@localhost, u2@localhost, u3@localhost; |
| 72 |
|
| 73 |
connect u1,localhost,u1,abcd,,,,TCP NOSSL; |
| 74 |
call checkme(); |
| 75 |
disconnect u1; |
| 76 |
connect u2,localhost,u2,efghi,,,,TCP NOSSL; |
| 77 |
call checkme(); |
| 78 |
disconnect u2; |
| 79 |
connect u3,localhost,u3,xyz,,,,TCP NOSSL; |
| 80 |
call checkme(); |
| 81 |
disconnect u3; |
| 82 |
|
| 83 |
# cleanup |
| 84 |
connection default; |
| 85 |
|
| 86 |
drop user u1@localhost; |
| 87 |
drop user u2@localhost; |
| 88 |
drop user u3@localhost; |
| 89 |
|
| 90 |
let datadir=`select @@datadir`; |
| 91 |
remove_file $datadir/private_key.pem; |
| 92 |
remove_file $datadir/public_key.pem; |
| 93 |
let $restart_parameters=; |
| 94 |
source include/restart_mysqld.inc; |
| 95 |
show status like 'caching_sha2_password%'; |
| 96 |
source fini.inc; |