| 1 |
install soname "password_reuse_check"; |
| 2 |
set global password_reuse_check_interval= 0; |
| 3 |
# Default value (sould be unlimited i.e. 0) |
| 4 |
SHOW GLOBAL VARIABLES like "password_reuse_check%"; |
| 5 |
Variable_name Value |
| 6 |
password_reuse_check_interval 0 |
| 7 |
# insert user |
| 8 |
grant select on *.* to user_name@localhost identified by 'test_pwd'; |
| 9 |
grant select on *.* to user_name@localhost identified by 'test_pwd'; |
| 10 |
ERROR HY000: Your password does not satisfy the current policy requirements (password_reuse_check) |
| 11 |
show warnings; |
| 12 |
Level Code Message |
| 13 |
Warning 1819 password_reuse_check: The password was already used |
| 14 |
Error 1819 Your password does not satisfy the current policy requirements (password_reuse_check) |
| 15 |
alter user user_name@localhost identified by 'test_pwd'; |
| 16 |
ERROR HY000: Operation ALTER USER failed for 'user_name'@'localhost' |
| 17 |
show warnings; |
| 18 |
Level Code Message |
| 19 |
Warning 1819 password_reuse_check: The password was already used |
| 20 |
Error 1819 Your password does not satisfy the current policy requirements (password_reuse_check) |
| 21 |
Error 1396 Operation ALTER USER failed for 'user_name'@'localhost' |
| 22 |
# check exparation |
| 23 |
set global password_reuse_check_interval= 10; |
| 24 |
alter user user_name@localhost identified by 'test_pwd'; |
| 25 |
ERROR HY000: Operation ALTER USER failed for 'user_name'@'localhost' |
| 26 |
show warnings; |
| 27 |
Level Code Message |
| 28 |
Warning 1819 password_reuse_check: The password was already used |
| 29 |
Error 1819 Your password does not satisfy the current policy requirements (password_reuse_check) |
| 30 |
Error 1396 Operation ALTER USER failed for 'user_name'@'localhost' |
| 31 |
select hex(hash) from mysql.password_reuse_check_history; |
| 32 |
hex(hash) |
| 33 |
B9F970DE4DA0145F842526C1BC9DBBBDB3EF80FDD7BE98061DAE3D18F492AA37668C07322DD21650C66B48FC78F0EAF6CB08245CC895BFDC43BE6921B07E5240 |
| 34 |
# emulate old password |
| 35 |
update mysql.password_reuse_check_history set time= date_sub(now(), interval |
| 36 |
11 day); |
| 37 |
alter user user_name@localhost identified by 'test_pwd'; |
| 38 |
show warnings; |
| 39 |
Level Code Message |
| 40 |
drop user user_name@localhost; |
| 41 |
show create table mysql.password_reuse_check_history; |
| 42 |
Table Create Table |
| 43 |
password_reuse_check_history CREATE TABLE `password_reuse_check_history` ( |
| 44 |
`hash` binary(64) NOT NULL, |
| 45 |
`time` timestamp NOT NULL DEFAULT current_timestamp(), |
| 46 |
PRIMARY KEY (`hash`), |
| 47 |
KEY `tm` (`time`) |
| 48 |
) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci PAGE_CHECKSUM=1 |
| 49 |
select count(*) from mysql.password_reuse_check_history; |
| 50 |
count(*) |
| 51 |
1 |
| 52 |
drop table mysql.password_reuse_check_history; |
| 53 |
# test error messages |
| 54 |
set global password_reuse_check_interval= 0; |
| 55 |
drop table if exists mysql.password_reuse_check_history; |
| 56 |
Warnings: |
| 57 |
Note 1051 Unknown table 'mysql.password_reuse_check_history' |
| 58 |
# test error messages |
| 59 |
create table mysql.password_reuse_check_history (wrong_structure int); |
| 60 |
grant select on *.* to user_name@localhost identified by 'test_pwd'; |
| 61 |
ERROR HY000: Your password does not satisfy the current policy requirements (password_reuse_check) |
| 62 |
show warnings; |
| 63 |
Level Code Message |
| 64 |
Warning 1105 password_reuse_check:[1054] Unknown column 'hash' in 'INSERT INTO' |
| 65 |
Error 1819 Your password does not satisfy the current policy requirements (password_reuse_check) |
| 66 |
set global password_reuse_check_interval= 10; |
| 67 |
grant select on *.* to user_name@localhost identified by 'test_pwd'; |
| 68 |
ERROR HY000: Your password does not satisfy the current policy requirements (password_reuse_check) |
| 69 |
show warnings; |
| 70 |
Level Code Message |
| 71 |
Warning 1105 password_reuse_check:[1054] Unknown column 'time' in 'WHERE' |
| 72 |
Error 1819 Your password does not satisfy the current policy requirements (password_reuse_check) |
| 73 |
drop table mysql.password_reuse_check_history; |
| 74 |
# |
| 75 |
# MDEV-28838: password_reuse_check plugin mixes username and password |
| 76 |
# |
| 77 |
grant select on *.* to user_name@localhost identified by 'test_pwd'; |
| 78 |
grant select on *.* to user_nam@localhost identified by 'etest_pwd'; |
| 79 |
show warnings; |
| 80 |
Level Code Message |
| 81 |
drop user user_name@localhost; |
| 82 |
drop user user_nam@localhost; |
| 83 |
drop table mysql.password_reuse_check_history; |
| 84 |
grant select on *.* to user_name@localhost identified by 'test_pwd'; |
| 85 |
grant select on *.* to tuser_name@localhos identified by 'test_pwd'; |
| 86 |
show warnings; |
| 87 |
Level Code Message |
| 88 |
drop user user_name@localhost; |
| 89 |
drop user tuser_name@localhos; |
| 90 |
# |
| 91 |
# End of 10.7 tests |
| 92 |
# |
| 93 |
drop table mysql.password_reuse_check_history; |
| 94 |
uninstall plugin password_reuse_check; |