Skip to content

Commit 8fae60d

Browse files
author
Krzysztof Horszczaruk
committed
Bug#36808636 System accounts are not converted to non legacy auth plugin during upgrade
modify scripts/mysql_system_tables_fix.sql script (UPDATE mysql.user statement) add MTR test Change-Id: I172a9957ae35a15713d0fda266aecd380572e47a
1 parent e1d07e1 commit 8fae60d

File tree

3 files changed

+92
-0
lines changed

3 files changed

+92
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#
2+
# Bug#36808636 System accounts are not converted to non legacy auth plugin during upgrade
3+
#
4+
5+
# prep a'la 5.7 system accounts
6+
UPDATE mysql.user SET plugin='mysql_native_password', authentication_string='*THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE' WHERE user='mysql.sys';
7+
UPDATE mysql.user SET plugin='mysql_native_password', authentication_string='*THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE' WHERE user='mysql.session';
8+
9+
# check sys-accounts use mysql_native_password
10+
# expected: mysql_native_password *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE Y
11+
SELECT user,plugin,authentication_string,account_locked FROM mysql.user WHERE USER='mysql.sys';
12+
user plugin authentication_string account_locked
13+
mysql.sys mysql_native_password *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE Y
14+
SELECT user,plugin,authentication_string,account_locked FROM mysql.user WHERE USER='mysql.session';
15+
user plugin authentication_string account_locked
16+
mysql.session mysql_native_password *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE Y
17+
18+
# restart the server and enforce the upgrade
19+
# restart:--upgrade=FORCE --log-error=MYSQLD_LOG
20+
21+
# check for ERROR pattern in server log
22+
# expected: pattern not found
23+
Pattern "\[ERROR\]" not found
24+
25+
# check sys-accounts are upgraded to caching_sha2_password
26+
# expected: caching_sha2_password $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED Y
27+
SELECT user,plugin,authentication_string,account_locked FROM mysql.user WHERE USER='mysql.sys';
28+
user plugin authentication_string account_locked
29+
mysql.sys caching_sha2_password $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED Y
30+
SELECT user,plugin,authentication_string,account_locked FROM mysql.user WHERE USER='mysql.session';
31+
user plugin authentication_string account_locked
32+
mysql.session caching_sha2_password $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED Y
33+
34+
# End of tests
+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#
2+
# Bug#36808636 System accounts are not converted to non legacy auth plugin during upgrade
3+
#
4+
5+
--echo #
6+
--echo # Bug#36808636 System accounts are not converted to non legacy auth plugin during upgrade
7+
--echo #
8+
9+
# prep a'la 5.7 system accounts
10+
--echo
11+
--echo # prep a'la 5.7 system accounts
12+
UPDATE mysql.user SET plugin='mysql_native_password', authentication_string='*THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE' WHERE user='mysql.sys';
13+
UPDATE mysql.user SET plugin='mysql_native_password', authentication_string='*THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE' WHERE user='mysql.session';
14+
15+
# check sys-accounts use mysql_native_password
16+
--echo
17+
--echo # check sys-accounts use mysql_native_password
18+
--echo # expected: mysql_native_password *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE Y
19+
SELECT user,plugin,authentication_string,account_locked FROM mysql.user WHERE USER='mysql.sys';
20+
SELECT user,plugin,authentication_string,account_locked FROM mysql.user WHERE USER='mysql.session';
21+
22+
--let $MYSQLD_LOG= $MYSQLTEST_VARDIR/log/mysql_upgrade_test.log
23+
24+
# restart the server and enforce the upgrade
25+
--echo
26+
--echo # restart the server and enforce the upgrade
27+
--replace_result $MYSQLD_LOG MYSQLD_LOG
28+
--let $restart_parameters = restart:--upgrade=FORCE --log-error=$MYSQLD_LOG
29+
--let $wait_counter= 10000
30+
--source include/restart_mysqld.inc
31+
32+
# check for [ERROR] pattern in server log
33+
--echo
34+
--echo # check for ERROR pattern in server log
35+
--echo # expected: pattern not found
36+
--let SEARCH_FILE= $MYSQLD_LOG
37+
--let SEARCH_PATTERN= \[ERROR\]
38+
--source include/search_pattern.inc
39+
40+
# clean log
41+
--remove_file $MYSQLD_LOG
42+
43+
# check sys-accounts are upgraded to cahcing_sha2_password
44+
--echo
45+
--echo # check sys-accounts are upgraded to caching_sha2_password
46+
--echo # expected: caching_sha2_password \$A\$005\$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED Y
47+
SELECT user,plugin,authentication_string,account_locked FROM mysql.user WHERE USER='mysql.sys';
48+
SELECT user,plugin,authentication_string,account_locked FROM mysql.user WHERE USER='mysql.session';
49+
50+
# end of test, no cleanup needed
51+
--echo
52+
--echo # End of tests

scripts/mysql_system_tables_fix.sql

+6
Original file line numberDiff line numberDiff line change
@@ -1626,3 +1626,9 @@ FROM mysql.user WHERE Reload_priv = 'Y' AND @hadFlushPrivilegesPriv = 0;
16261626

16271627
-- SET_USER_ID is removed dynamic privilege, revoke all grants of it.
16281628
DELETE FROM global_grants WHERE PRIV = 'SET_USER_ID';
1629+
1630+
-- Bug#36808636 System accounts are not converted to non legacy auth plugin during upgrade
1631+
-- Convert authentication of 'mysql.sys' and 'mysql.sessioon' users
1632+
-- from mysql_native_password into caching_sha2_password.
1633+
UPDATE mysql.user SET plugin='caching_sha2_password', authentication_string='$A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED' WHERE user='mysql.sys';
1634+
UPDATE mysql.user SET plugin='caching_sha2_password', authentication_string='$A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED' WHERE user='mysql.session';

0 commit comments

Comments
 (0)