Debian Codegraph @

mysql-test/suite/group_replication/t/gr_recovery_tlsv13_incompatible_ciphersuites.test

raw
1 ################################################################################
2 # Validate Group Replication behavior when members have disjoint TLS ciphersuites.
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 TLS 1.3 with
7 # a non-default ciphersuite.
8 # 2. Add some data and bootstrap start a group on M1.
9 # 3. Configure a joining member (M2) to use SSL options and a different TLS
10 # ciphersuite on recovery. Member will not be able to join.
11 # 4. Clean up.
12 ################################################################################
13
14 --source include/have_tlsv13.inc
15 --source include/have_group_replication_xcom_communication_stack.inc
16 --source include/have_group_replication_plugin.inc
17 --let $rpl_skip_group_replication_start= 1
18 --source include/group_replication.inc
19
20 --echo #
21 --echo # Setup the first member with a recovery user that requires TLS 1.3
22 --echo #
23
24 --let $rpl_connection_name= server1
25 --source include/rpl_connection.inc
26
27 # create a user for replication that requires ssl encryption
28 SET SESSION sql_log_bin=0;
29 CREATE USER 'rec_ssl_user'@'%' REQUIRE SSL;
30 GRANT replication slave ON *.* TO 'rec_ssl_user'@'%';
31 SET SESSION sql_log_bin=1;
32
33 SET @tls_version_saved= @@GLOBAL.tls_version;
34 SET GLOBAL tls_version='TLSv1.3';
35 SET @tls_ciphersuites_saved= @@GLOBAL.tls_ciphersuites;
36 SET GLOBAL tls_ciphersuites='TLS_AES_128_CCM_8_SHA256';
37 ALTER INSTANCE RELOAD TLS;
38
39 --echo #
40 --echo # Add some data and start the member
41 --echo #
42
43 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
44 INSERT INTO t1 VALUES (1);
45
46 --source include/start_and_bootstrap_group_replication.inc
47
48 --echo #
49 --echo # Configure a joining member to use SSL options and a different TLS
50 --echo # ciphersuite on recovery. Member will not be able to join.
51 --echo #
52
53 --let $rpl_connection_name= server2
54 --source include/rpl_connection.inc
55
56 SET SESSION sql_log_bin= 0;
57 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.");
58 call mtr.add_suppression("Plugin group_replication reported: 'For details please check performance_schema.replication_connection_status table and error log messages of Replica I/O for channel group_replication_recovery.");
59 call mtr.add_suppression("Plugin group_replication reported: 'Maximum number of retries when trying to connect to a donor reached. Aborting group replication incremental recovery.");
60 call mtr.add_suppression("Fatal error during the incremental recovery process of Group Replication. The server will leave the group.");
61 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
62 call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
63 SET SESSION sql_log_bin= 1;
64
65 # Configure TLS on the server to allow GCS connections over TLS
66 SET @tls_version_saved= @@GLOBAL.tls_version;
67 SET GLOBAL tls_version='TLSv1.3';
68 SET @tls_ciphersuites_saved= @@GLOBAL.tls_ciphersuites;
69 SET GLOBAL tls_ciphersuites='TLS_AES_128_CCM_8_SHA256';
70 ALTER INSTANCE RELOAD TLS;
71
72 --disable_warnings
73 CHANGE REPLICATION SOURCE TO SOURCE_USER="rec_ssl_user" FOR CHANNEL "group_replication_recovery";
74 --enable_warnings
75
76 SET @group_replication_recovery_use_ssl_saved= @@GLOBAL.group_replication_recovery_use_ssl;
77 SET GLOBAL group_replication_recovery_use_ssl=1;
78 SET @group_replication_recovery_tls_ciphersuites_saved= @@GLOBAL.group_replication_recovery_tls_ciphersuites;
79 SET GLOBAL group_replication_recovery_tls_ciphersuites='TLS_AES_128_CCM_SHA256';
80
81 SET @group_replication_recovery_retry_count_saved= @@GLOBAL.group_replication_recovery_retry_count;
82 SET GLOBAL group_replication_recovery_retry_count= 1;
83
84 --let $group_replication_start_member_state= ERROR
85 --source include/start_group_replication.inc
86
87 --let $assert_text = incremental recovery connection failed with error CR_SSL_CONNECTION_ERROR
88 --let $assert_cond = "[SELECT LAST_ERROR_NUMBER FROM performance_schema.replication_connection_status where CHANNEL_NAME = \'group_replication_recovery\']" = "2026"
89 --source include/assert.inc
90
91 --source include/stop_group_replication.inc
92
93 --echo #
94 --echo # Clean up
95 --echo #
96 --let $rpl_connection_name= server2
97 --source include/rpl_connection.inc
98 SET @@GLOBAL.tls_version= @tls_version_saved;
99 SET @@GLOBAL.tls_ciphersuites= @tls_ciphersuites_saved;
100 ALTER INSTANCE RELOAD TLS;
101 SET @@GLOBAL.group_replication_recovery_use_ssl= @group_replication_recovery_use_ssl_saved;
102 SET @@GLOBAL.group_replication_recovery_tls_ciphersuites= @group_replication_recovery_tls_ciphersuites_saved;
103 SET @@GLOBAL.group_replication_recovery_retry_count= @group_replication_recovery_retry_count_saved;
104
105 --let $rpl_connection_name= server1
106 --source include/rpl_connection.inc
107 SET @@GLOBAL.tls_version= @tls_version_saved;
108 SET @@GLOBAL.tls_ciphersuites= @tls_ciphersuites_saved;
109 ALTER INSTANCE RELOAD TLS;
110
111 SET SESSION sql_log_bin=0;
112 DROP USER 'rec_ssl_user';
113 SET SESSION sql_log_bin=1;
114
115 DROP TABLE t1;
116
117 --source include/group_replication_end.inc