| 1 |
################################################################################ |
| 2 |
# Test to verify the SSL Fips mode on the Group replication plugin |
| 3 |
# |
| 4 |
# Test: |
| 5 |
# 0. The test requires two servers: M1 and M2. |
| 6 |
# 1. Setup the first member (M1) with a recovery user that requires SSL with |
| 7 |
# ssl_fips_mode= 'ON'. |
| 8 |
# 2. Start and bootstrap M1. |
| 9 |
# 3. Insert some data and verify that it gives warning for MD5(). |
| 10 |
# 4. Configure joining member (M2) to use SSL and Fips mode options on recovery. |
| 11 |
# Start GR on M2. Check the data is there. |
| 12 |
# 5. Restart M2 with weak cipher with Fips mode ON and verify it does not start. |
| 13 |
# 6. Clean up. |
| 14 |
################################################################################ |
| 15 |
|
| 16 |
--source include/big_test.inc |
| 17 |
--source include/have_group_replication_xcom_communication_stack.inc |
| 18 |
--source include/have_fips.inc |
| 19 |
--source include/have_group_replication_plugin.inc |
| 20 |
--let $rpl_skip_group_replication_start= 1 |
| 21 |
--source include/group_replication.inc |
| 22 |
|
| 23 |
|
| 24 |
--echo # |
| 25 |
--echo # 1. Setup the first member (M1) with a recovery user that requires SSL |
| 26 |
--echo # with ssl_fips_mode= 'ON'. |
| 27 |
--echo # |
| 28 |
--let $rpl_connection_name= server1 |
| 29 |
--source include/rpl_connection.inc |
| 30 |
|
| 31 |
--let $allow_rpl_inited= 1 |
| 32 |
--let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address` |
| 33 |
--let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds` |
| 34 |
--let $restart_parameters=restart:--group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --ssl-fips-mode=ON |
| 35 |
--replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS |
| 36 |
--source include/restart_mysqld.inc |
| 37 |
|
| 38 |
# Needed as we are not using rpl_restart_server.inc |
| 39 |
--let $rpl_server_number= 1 |
| 40 |
--source include/rpl_reconnect.inc |
| 41 |
|
| 42 |
# create a user for replication that requires ssl encryption |
| 43 |
SET SESSION sql_log_bin= 0; |
| 44 |
CREATE USER 'rec_ssl_user'@'%' REQUIRE SSL; |
| 45 |
GRANT replication slave ON *.* TO 'rec_ssl_user'@'%'; |
| 46 |
SET SESSION sql_log_bin= 1; |
| 47 |
|
| 48 |
--echo # |
| 49 |
--echo # 2. Start and bootstrap M1. |
| 50 |
--echo # |
| 51 |
--source include/start_and_bootstrap_group_replication.inc |
| 52 |
|
| 53 |
|
| 54 |
--echo # |
| 55 |
--echo # 3. Insert some data and verify that it gives warning for MD5(). |
| 56 |
--echo # |
| 57 |
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY, hash CHAR(32)) ENGINE=InnoDB; |
| 58 |
|
| 59 |
INSERT INTO t1 VALUES (1, 'test'); |
| 60 |
INSERT INTO t1 VALUES (2, MD5(8)); |
| 61 |
SHOW WARNINGS; |
| 62 |
|
| 63 |
|
| 64 |
--echo # |
| 65 |
--echo # 4. Configure joining member (M2) to use SSL and Fips mode options on recovery. |
| 66 |
--echo # Start GR on M2. Check the data is there. |
| 67 |
--echo # |
| 68 |
--let $rpl_connection_name= server2 |
| 69 |
--source include/rpl_connection.inc |
| 70 |
|
| 71 |
--let $allow_rpl_inited= 1 |
| 72 |
--let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address` |
| 73 |
--let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds` |
| 74 |
--let $restart_parameters=restart:--group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --ssl-fips-mode=ON |
| 75 |
--replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS |
| 76 |
--source include/restart_mysqld.inc |
| 77 |
|
| 78 |
# Needed as we are not using rpl_restart_server.inc |
| 79 |
--let $rpl_server_number= 2 |
| 80 |
--source include/rpl_reconnect.inc |
| 81 |
|
| 82 |
SET @group_replication_recovery_use_ssl_save= @@GLOBAL.group_replication_recovery_use_ssl; |
| 83 |
SET @group_replication_recovery_ssl_ca_save= @@GLOBAL.group_replication_recovery_ssl_ca; |
| 84 |
SET @group_replication_recovery_ssl_cert_save= @@GLOBAL.group_replication_recovery_ssl_cert; |
| 85 |
SET @group_replication_recovery_ssl_key_save= @@GLOBAL.group_replication_recovery_ssl_key; |
| 86 |
SET @group_replication_recovery_ssl_cipher_save= @@GLOBAL.group_replication_recovery_ssl_cipher; |
| 87 |
SET @group_replication_recovery_retry_count_save= @@GLOBAL.group_replication_recovery_retry_count; |
| 88 |
|
| 89 |
--disable_warnings |
| 90 |
CHANGE REPLICATION SOURCE TO SOURCE_USER="rec_ssl_user" FOR CHANNEL "group_replication_recovery"; |
| 91 |
--enable_warnings |
| 92 |
|
| 93 |
SET GLOBAL group_replication_recovery_use_ssl= 1; |
| 94 |
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR |
| 95 |
--eval SET GLOBAL group_replication_recovery_ssl_ca= '$MYSQL_TEST_DIR/std_data/cacert.pem' |
| 96 |
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR |
| 97 |
--eval SET GLOBAL group_replication_recovery_ssl_cert= '$MYSQL_TEST_DIR/std_data/client-cert.pem' |
| 98 |
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR |
| 99 |
--eval SET GLOBAL group_replication_recovery_ssl_key= '$MYSQL_TEST_DIR/std_data/client-key.pem' |
| 100 |
|
| 101 |
--source include/start_group_replication.inc |
| 102 |
|
| 103 |
--echo # |
| 104 |
--echo # Check the data is there |
| 105 |
--echo # |
| 106 |
--let $assert_text= On the recovered member, the table should exist and have 1 elements; |
| 107 |
--let $assert_cond= [select count(*) from t1] = 2; |
| 108 |
--source include/assert.inc |
| 109 |
|
| 110 |
|
| 111 |
--echo # |
| 112 |
--echo # 5. Restart M2 with weak cipher with Fips mode ON and verify it |
| 113 |
--echo # does not start. |
| 114 |
--echo # |
| 115 |
--source include/stop_group_replication.inc |
| 116 |
|
| 117 |
SET SESSION sql_log_bin= 0; |
| 118 |
call mtr.add_suppression("There was an error when connecting to the donor server. Please check that group_replication_recovery channel credentials and all MEMBER_HOST column values of performance_schema.replication_group_members table are correct and DNS resolvable."); |
| 119 |
call mtr.add_suppression("For details please check performance_schema.replication_connection_status table and error log messages of Replica I/O for channel group_replication_recovery."); |
| 120 |
call mtr.add_suppression("Maximum number of retries when trying to connect to a donor reached. Aborting group replication incremental recovery."); |
| 121 |
call mtr.add_suppression("Fatal error during the incremental recovery process of Group Replication. The server will leave the group."); |
| 122 |
call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going."); |
| 123 |
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected."); |
| 124 |
SET SESSION sql_log_bin= 1; |
| 125 |
|
| 126 |
SET GLOBAL group_replication_recovery_ssl_cipher= 'CAMELLIA256-SHA'; |
| 127 |
SET GLOBAL group_replication_recovery_retry_count= 1; |
| 128 |
|
| 129 |
--let $group_replication_start_member_state= ERROR |
| 130 |
--source include/start_group_replication.inc |
| 131 |
|
| 132 |
--source include/stop_group_replication.inc |
| 133 |
|
| 134 |
|
| 135 |
--echo # |
| 136 |
--echo # Clean up |
| 137 |
--echo # |
| 138 |
SET @@GLOBAL.group_replication_recovery_use_ssl= @group_replication_recovery_use_ssl_save; |
| 139 |
SET @@GLOBAL.group_replication_recovery_ssl_ca= @group_replication_recovery_ssl_ca_save; |
| 140 |
SET @@GLOBAL.group_replication_recovery_ssl_cert= @group_replication_recovery_ssl_cert_save; |
| 141 |
SET @@GLOBAL.group_replication_recovery_ssl_key= @group_replication_recovery_ssl_key_save; |
| 142 |
SET @@GLOBAL.group_replication_recovery_ssl_cipher= @group_replication_recovery_ssl_cipher_save; |
| 143 |
SET @@GLOBAL.group_replication_recovery_retry_count= @group_replication_recovery_retry_count_save; |
| 144 |
|
| 145 |
--let $rpl_connection_name= server1 |
| 146 |
--source include/rpl_connection.inc |
| 147 |
SET SESSION sql_log_bin= 0; |
| 148 |
DROP USER 'rec_ssl_user'; |
| 149 |
SET SESSION sql_log_bin= 1; |
| 150 |
|
| 151 |
DROP TABLE t1; |
| 152 |
|
| 153 |
--source include/group_replication_end.inc |
| 154 |
--source include/force_restart.inc |