| 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 |
call mtr.add_suppression('failed to read private_key.pem: 2 "No such file or directory"'); |
| 4 |
show status like 'caching_sha2_password%'; |
| 5 |
Variable_name Value |
| 6 |
Caching_sha2_password_rsa_public_key |
| 7 |
create user test1@'%' identified via caching_sha2_password using PASSWORD('pwd'); |
| 8 |
create user test2@'%' identified via caching_sha2_password; |
| 9 |
show grants for test2@'%'; |
| 10 |
Grants for test2@% |
| 11 |
GRANT USAGE ON *.* TO `test2`@`%` IDENTIFIED VIA caching_sha2_password |
| 12 |
create procedure checkme() sql security invoker |
| 13 |
select user(), current_user(), variable_value > '' as 'have_ssl' |
| 14 |
from information_schema.session_status |
| 15 |
where variable_name='ssl_cipher'; |
| 16 |
grant execute on test.* to test1@'%', test2@'%'; |
| 17 |
select * from information_schema.system_variables where variable_name like 'caching_sha2_password%' order by 1; |
| 18 |
VARIABLE_NAME CACHING_SHA2_PASSWORD_AUTO_GENERATE_RSA_KEYS |
| 19 |
SESSION_VALUE NULL |
| 20 |
GLOBAL_VALUE OFF |
| 21 |
GLOBAL_VALUE_ORIGIN COMMAND-LINE |
| 22 |
DEFAULT_VALUE ON |
| 23 |
VARIABLE_SCOPE GLOBAL |
| 24 |
VARIABLE_TYPE BOOLEAN |
| 25 |
VARIABLE_COMMENT Auto generate RSA keys at server startup if key paths are not explicitly set and key files are not present at their default locations |
| 26 |
NUMERIC_MIN_VALUE NULL |
| 27 |
NUMERIC_MAX_VALUE NULL |
| 28 |
NUMERIC_BLOCK_SIZE NULL |
| 29 |
ENUM_VALUE_LIST OFF,ON |
| 30 |
READ_ONLY YES |
| 31 |
COMMAND_LINE_ARGUMENT OPTIONAL |
| 32 |
GLOBAL_VALUE_PATH NULL |
| 33 |
VARIABLE_NAME CACHING_SHA2_PASSWORD_DIGEST_ROUNDS |
| 34 |
SESSION_VALUE NULL |
| 35 |
GLOBAL_VALUE 5000 |
| 36 |
GLOBAL_VALUE_ORIGIN COMPILE-TIME |
| 37 |
DEFAULT_VALUE 5000 |
| 38 |
VARIABLE_SCOPE GLOBAL |
| 39 |
VARIABLE_TYPE INT UNSIGNED |
| 40 |
VARIABLE_COMMENT Number of SHA2 rounds to be performed when computing a password hash |
| 41 |
NUMERIC_MIN_VALUE 5000 |
| 42 |
NUMERIC_MAX_VALUE 4095000 |
| 43 |
NUMERIC_BLOCK_SIZE 1 |
| 44 |
ENUM_VALUE_LIST NULL |
| 45 |
READ_ONLY YES |
| 46 |
COMMAND_LINE_ARGUMENT REQUIRED |
| 47 |
GLOBAL_VALUE_PATH NULL |
| 48 |
VARIABLE_NAME CACHING_SHA2_PASSWORD_PRIVATE_KEY_PATH |
| 49 |
SESSION_VALUE NULL |
| 50 |
GLOBAL_VALUE private_key.pem |
| 51 |
GLOBAL_VALUE_ORIGIN COMPILE-TIME |
| 52 |
DEFAULT_VALUE private_key.pem |
| 53 |
VARIABLE_SCOPE GLOBAL |
| 54 |
VARIABLE_TYPE VARCHAR |
| 55 |
VARIABLE_COMMENT A path to the private RSA key used for authentication |
| 56 |
NUMERIC_MIN_VALUE NULL |
| 57 |
NUMERIC_MAX_VALUE NULL |
| 58 |
NUMERIC_BLOCK_SIZE NULL |
| 59 |
ENUM_VALUE_LIST NULL |
| 60 |
READ_ONLY YES |
| 61 |
COMMAND_LINE_ARGUMENT REQUIRED |
| 62 |
GLOBAL_VALUE_PATH NULL |
| 63 |
VARIABLE_NAME CACHING_SHA2_PASSWORD_PUBLIC_KEY_PATH |
| 64 |
SESSION_VALUE NULL |
| 65 |
GLOBAL_VALUE public_key.pem |
| 66 |
GLOBAL_VALUE_ORIGIN COMPILE-TIME |
| 67 |
DEFAULT_VALUE public_key.pem |
| 68 |
VARIABLE_SCOPE GLOBAL |
| 69 |
VARIABLE_TYPE VARCHAR |
| 70 |
VARIABLE_COMMENT A path to the public RSA key used for authentication |
| 71 |
NUMERIC_MIN_VALUE NULL |
| 72 |
NUMERIC_MAX_VALUE NULL |
| 73 |
NUMERIC_BLOCK_SIZE NULL |
| 74 |
ENUM_VALUE_LIST NULL |
| 75 |
READ_ONLY YES |
| 76 |
COMMAND_LINE_ARGUMENT REQUIRED |
| 77 |
GLOBAL_VALUE_PATH NULL |
| 78 |
create user test3@'%' identified via caching_sha2_password using 'pwd'; |
| 79 |
ERROR HY000: Password hash should be 70 characters long |
| 80 |
create user test3@'%' identified via caching_sha2_password using '0000000000000000000000000000000000000000000000000000000000000000000000'; |
| 81 |
ERROR HY000: Invalid password hash |
| 82 |
connect(localhost,test1,pwd,test,MASTER_MYPORT,MASTER_MYSOCK); |
| 83 |
connect con1, localhost,test1,pwd,,,,TCP NOSSL; |
| 84 |
ERROR HY000: Couldn't read RSA public key from server |
| 85 |
connect(localhost,test1,wrong_pwd,test,MASTER_MYPORT,MASTER_MYSOCK); |
| 86 |
connect con3, localhost,test1,wrong_pwd,,,,TCP NOSSL; |
| 87 |
ERROR HY000: Couldn't read RSA public key from server |
| 88 |
connect con4, localhost,test2,,,,,TCP NOSSL; |
| 89 |
call checkme(); |
| 90 |
user() current_user() have_ssl |
| 91 |
test2@localhost test2@% 0 |
| 92 |
disconnect con4; |
| 93 |
connect(localhost,test2 pwd,,test,MASTER_MYPORT,MASTER_MYSOCK); |
| 94 |
connect con5, localhost,test2 pwd,,,,,TCP NOSSL; |
| 95 |
ERROR 28000: Access denied for user 'test2 pwd'@'localhost' (using password: NO) |
| 96 |
connection default; |
| 97 |
# restart: --caching_sha2_password-auto_generate_rsa_keys |
| 98 |
select length(variable_value) from information_schema.global_status |
| 99 |
where variable_name like 'caching_sha2_password%'; |
| 100 |
length(variable_value) |
| 101 |
451 |
| 102 |
# restart: --caching_sha2_password-auto_generate_rsa_keys |
| 103 |
select variable_value="$pubkey" as 'key did not change' |
| 104 |
from information_schema.global_status |
| 105 |
where variable_name like 'caching_sha2_password%'; |
| 106 |
key did not change |
| 107 |
1 |
| 108 |
connect con1, localhost,test1,pwd,,,,TCP NOSSL; |
| 109 |
call checkme(); |
| 110 |
user() current_user() have_ssl |
| 111 |
test1@localhost test1@% 0 |
| 112 |
disconnect con1; |
| 113 |
connect con2, localhost,test1,pwd,,,,TCP NOSSL; |
| 114 |
call checkme(); |
| 115 |
user() current_user() have_ssl |
| 116 |
test1@localhost test1@% 0 |
| 117 |
disconnect con2; |
| 118 |
connect(localhost,test1,wrong_pwd,test,MASTER_MYPORT,MASTER_MYSOCK); |
| 119 |
connect con3, localhost,test1,wrong_pwd,,,,TCP NOSSL; |
| 120 |
ERROR 28000: Access denied for user 'test1'@'localhost' (using password: YES) |
| 121 |
connect con4, localhost,test2,,,,,TCP NOSSL; |
| 122 |
call checkme(); |
| 123 |
user() current_user() have_ssl |
| 124 |
test2@localhost test2@% 0 |
| 125 |
disconnect con4; |
| 126 |
connect(localhost,test2 pwd,,test,MASTER_MYPORT,MASTER_MYSOCK); |
| 127 |
connect con5, localhost,test2 pwd,,,,,TCP NOSSL; |
| 128 |
ERROR 28000: Access denied for user 'test2 pwd'@'localhost' (using password: NO) |
| 129 |
connection default; |
| 130 |
create user u1@localhost identified via caching_sha2_password using '$A$005$5dx;X)z |kX]\ZNx7QTrl0oTy2C0/f4bggQMFIDnSDeZ7koLoO417jc9D'; |
| 131 |
create user u2@localhost identified via caching_sha2_password using '$A$005$dL\Zq]<7d[YAbk}x!;^.qMuuUUBmB5aF7x7GsAKZzpb24p94NCCs8qPgwAvwc1'; |
| 132 |
create user u3@localhost identified via caching_sha2_password using '$A$005$L9\ZKiwT''=%dMoqrPGFbywI9G8NecJqiy9D04S2abTLRvD32powG8nIxI9'; |
| 133 |
grant execute on test.* to u1@localhost, u2@localhost, u3@localhost; |
| 134 |
connect u1,localhost,u1,abcd,,,,TCP NOSSL; |
| 135 |
call checkme(); |
| 136 |
user() current_user() have_ssl |
| 137 |
u1@localhost u1@localhost 0 |
| 138 |
disconnect u1; |
| 139 |
connect u2,localhost,u2,efghi,,,,TCP NOSSL; |
| 140 |
call checkme(); |
| 141 |
user() current_user() have_ssl |
| 142 |
u2@localhost u2@localhost 0 |
| 143 |
disconnect u2; |
| 144 |
connect u3,localhost,u3,xyz,,,,TCP NOSSL; |
| 145 |
call checkme(); |
| 146 |
user() current_user() have_ssl |
| 147 |
u3@localhost u3@localhost 0 |
| 148 |
disconnect u3; |
| 149 |
connection default; |
| 150 |
drop user u1@localhost; |
| 151 |
drop user u2@localhost; |
| 152 |
drop user u3@localhost; |
| 153 |
# restart |
| 154 |
show status like 'caching_sha2_password%'; |
| 155 |
Variable_name Value |
| 156 |
Caching_sha2_password_rsa_public_key |
| 157 |
drop procedure checkme; |
| 158 |
drop user test1@'%'; |
| 159 |
drop user test2@'%'; |