Debian Codegraph @

mysql-test/suite/group_replication/include/gr_ssl_tls13_runtime_invalid_configuration.inc

raw
1 #
2 # Validate that Group Replication SSL mode does not work with TLS v1.3 when
3 # an invalid configuration is set at server runtime.
4 #
5 # Steps:
6 # 0. Configure members to use encryption and save defaults.
7 # 1. 2 members group with OpenSSL 1.1.1
8 # Verify that it is not possible to start group replication when :
9 # * TLS version is 1.3
10 # * Intersection of the allowed TLS chipersuites for all the members is
11 # empty.
12 # server1: --tls-version='TLSv1.3'
13 # server1: --tls-ciphersuites='TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384'
14 # server2: --tls-version='TLSv1.3'
15 # server2: --tls-ciphersuites='TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_CCM_SHA256'
16 # Outcome: group will not work.
17 # 2. 2 members group with OpenSSL 1.1.1
18 # Verify that it is not possible to join a node to a group when
19 # TLS v1.3 is allowed but there is no compatible ciphersuite :
20 # * TLS chipersuite of the node is incompatible with the group, therefore
21 # TLS v1.3 is not supported
22 # * SLL cipher of the node is compatible with the group
23 # --tls-version='TLSv1.3'
24 # server1: --tls-ciphersuites='TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384'
25 # server1: --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384'
26 # server2: --tls-ciphersuites='TLS_AES_128_CCM_SHA256'
27 # server2: --ssl-cipher='DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384'
28 # Outcome: group will not work.
29 # 3. Clean up.
30 #
31
32
33 --source include/big_test.inc
34 --source include/have_tlsv13.inc
35 --source include/have_group_replication_plugin.inc
36 --let $rpl_server_count= 2
37 --source include/force_restart.inc
38 --let $rpl_skip_group_replication_start= 1
39 --source include/group_replication.inc
40
41 #check which stack are we using
42 --let $have_mysql_stack= `SELECT @@group_replication_communication_stack LIKE 'MySQL'`
43
44 --echo
45 --echo ############################################################
46 --echo # 0. Configure members to use encryption and save defaults.
47 --let $rpl_connection_name= server1
48 --source include/rpl_connection.inc
49 SET @tls_version_save= @@GLOBAL.tls_version;
50 SET @tls_ciphersuites_save= @@GLOBAL.tls_ciphersuites;
51 SET @ssl_cipher_save= @@GLOBAL.ssl_cipher;
52 SET @group_replication_ssl_mode_save= @@GLOBAL.group_replication_ssl_mode;
53 SET @@GLOBAL.group_replication_ssl_mode= REQUIRED;
54
55 if($have_mysql_stack) {
56 SET @tls_version_recovery_save= @@GLOBAL.group_replication_recovery_tls_version;
57 SET @tls_ciphersuites_recovery_save= @@GLOBAL.group_replication_recovery_tls_ciphersuites;
58 SET @ssl_cipher_recovery_save= @@GLOBAL.group_replication_recovery_ssl_cipher;
59 }
60
61 --let $rpl_connection_name= server2
62 --source include/rpl_connection.inc
63 SET @tls_version_save= @@GLOBAL.tls_version;
64 SET @tls_ciphersuites_save= @@GLOBAL.tls_ciphersuites;
65 SET @ssl_cipher_save= @@GLOBAL.ssl_cipher;
66 SET @group_replication_ssl_mode_save= @@GLOBAL.group_replication_ssl_mode;
67 SET @@GLOBAL.group_replication_ssl_mode= REQUIRED;
68
69 if($have_mysql_stack) {
70 SET @tls_version_recovery_save= @@GLOBAL.group_replication_recovery_tls_version;
71 SET @tls_ciphersuites_recovery_save= @@GLOBAL.group_replication_recovery_tls_ciphersuites;
72 SET @ssl_cipher_recovery_save= @@GLOBAL.group_replication_recovery_ssl_cipher;
73 }
74
75 SET SESSION sql_log_bin= 0;
76 call mtr.add_suppression("\\[GCS\\] Error connecting to all peers. Member join failed. Local port:*");
77 call mtr.add_suppression("\\[GCS\\] The member was unable to join the group.*");
78 call mtr.add_suppression("Timeout on wait for view after joining group");
79 call mtr.add_suppression("Error connecting to the local group communication engine instance");
80 SET SESSION sql_log_bin= 1;
81
82 --echo
83 --echo ############################################################
84 --echo # 1. 2 members group with OpenSSL 1.1.1
85 --echo # Verify that it is not possible to start group replication when :
86 --echo # * TLS version is 1.3
87 --echo # * Intersection of the allowed TLS chipersuites for all the members
88 --echo # is empty.
89 --echo # server1: --tls-version='TLSv1.3'
90 --echo # server1: --tls-ciphersuites='TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384'
91 --echo # server2: --tls-version='TLSv1.3'
92 --echo # server2: --tls-ciphersuites='TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_CCM_SHA256'
93 --echo # Outcome: group will not work.
94
95 --let $rpl_connection_name= server1
96 --source include/rpl_connection.inc
97
98 SET @@GLOBAL.tls_version= 'TLSv1.3';
99 SET @@GLOBAL.tls_ciphersuites= 'TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384';
100 if($have_mysql_stack) {
101 SET @@GLOBAL.group_replication_recovery_tls_version= 'TLSv1.3';
102 SET @@GLOBAL.group_replication_recovery_tls_ciphersuites= 'TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384';
103 }
104 ALTER INSTANCE RELOAD TLS;
105 --source include/start_and_bootstrap_group_replication.inc
106
107 # Try to add 2nd server
108 --let $rpl_connection_name= server2
109 --source include/rpl_connection.inc
110
111 --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
112 --eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
113
114 SET @@GLOBAL.tls_version= 'TLSv1.3';
115 SET @@GLOBAL.tls_ciphersuites= 'TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_CCM_SHA256';
116 if($have_mysql_stack) {
117 SET @@GLOBAL.group_replication_recovery_tls_version= 'TLSv1.3';
118 SET @@GLOBAL.group_replication_recovery_tls_ciphersuites= 'TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_CCM_SHA256';
119 }
120 ALTER INSTANCE RELOAD TLS;
121
122 --error ER_GROUP_REPLICATION_CONFIGURATION
123 START GROUP_REPLICATION;
124
125 if(!$have_mysql_stack) {
126 --let $assert_file = $MYSQLTEST_VARDIR/tmp/gr_ssl_tls13_runtime_invalid_configuration.2.err
127 --let $assert_only_after= .*XCom initialized and ready to accept incoming connections.*
128 --let $assert_select =.*Error connecting using SSL.*
129 --let $assert_match =.*Error connecting using SSL.*
130 --let $assert_text = Found the expected error line in the server log.
131 --source include/assert_grep.inc
132 }
133
134 --let $rpl_connection_name= server1
135 --source include/rpl_connection.inc
136 --source include/stop_group_replication.inc
137
138
139 --echo
140 --echo ############################################################
141 --echo # 2. 2 members group with OpenSSL 1.1.1
142 --echo # Verify that it is not possible to join a node to a group when
143 --echo # TLS v1.3 is allowed but there is no compatible ciphersuite :
144 --echo # * TLS chipersuite of the node is incompatible with the group,
145 --echo # therefore TLS v1.3 is not supported
146 --echo # * SLL cipher of the node is compatible with the group
147 --echo # --tls-version='TLSv1.3'
148 --echo # server1: --tls-ciphersuites='TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384'
149 --echo # server1: --ssl-cipher='ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384'
150 --echo # server2: --tls-ciphersuites='TLS_AES_128_CCM_SHA256'
151 --echo # server2: --ssl-cipher='DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384'
152 --echo # Outcome: group will not work.
153
154 --let $rpl_connection_name= server1
155 --source include/rpl_connection.inc
156
157 SET @@GLOBAL.tls_version= 'TLSv1.3';
158 SET @@GLOBAL.ssl_cipher= 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384';
159 SET @@GLOBAL.tls_ciphersuites= 'TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384';
160 if($have_mysql_stack) {
161 SET @@GLOBAL.group_replication_recovery_tls_version= 'TLSv1.3';
162 SET @@GLOBAL.group_replication_recovery_ssl_cipher= 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384';
163 SET @@GLOBAL.group_replication_recovery_tls_ciphersuites= 'TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384';
164 }
165 ALTER INSTANCE RELOAD TLS;
166 --source include/start_and_bootstrap_group_replication.inc
167
168 # Try to add 2nd server
169 --let $rpl_connection_name= server2
170 --source include/rpl_connection.inc
171
172 --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
173 --eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
174
175 SET @@GLOBAL.tls_version= 'TLSv1.3';
176 SET @@GLOBAL.ssl_cipher= 'DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384';
177 SET @@GLOBAL.tls_ciphersuites = 'TLS_AES_128_CCM_SHA256';
178 if($have_mysql_stack) {
179 SET @@GLOBAL.group_replication_recovery_tls_version= 'TLSv1.3';
180 SET @@GLOBAL.group_replication_recovery_ssl_cipher= 'DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384';
181 SET @@GLOBAL.group_replication_recovery_tls_ciphersuites= 'TLS_AES_128_CCM_SHA256';
182 }
183 ALTER INSTANCE RELOAD TLS;
184
185 --error ER_GROUP_REPLICATION_CONFIGURATION
186 START GROUP_REPLICATION;
187
188 if(!$have_mysql_stack) {
189 --let $assert_file = $MYSQLTEST_VARDIR/tmp/gr_ssl_tls13_runtime_invalid_configuration.2.err
190 --let $assert_only_after= .*XCom initialized and ready to accept incoming connections.*
191 --let $assert_select =.*Error connecting using SSL.*
192 --let $assert_match =.*Error connecting using SSL.*
193 --let $assert_text = Found the expected error line in the server log.
194 --source include/assert_grep.inc
195 }
196
197 --let $rpl_connection_name= server1
198 --source include/rpl_connection.inc
199 --source include/stop_group_replication.inc
200
201
202 --echo
203 --echo ############################################################
204 --echo # 3. Clean up.
205
206 --let $rpl_connection_name= server1
207 --source include/rpl_connection.inc
208 SET @@GLOBAL.group_replication_ssl_mode= @group_replication_ssl_mode_save;
209 SET @@GLOBAL.tls_version= @tls_version_save;
210 SET @@GLOBAL.tls_ciphersuites= @tls_ciphersuites_save;
211 SET @@GLOBAL.ssl_cipher = @ssl_cipher_save;
212 if($have_mysql_stack) {
213 SET @@GLOBAL.group_replication_recovery_tls_version= @tls_version_recovery_save;
214 SET @@GLOBAL.group_replication_recovery_tls_ciphersuites= @tls_ciphersuites_recovery_save;
215 SET @@GLOBAL.group_replication_recovery_ssl_cipher= @ssl_cipher_recovery_save;
216 }
217 ALTER INSTANCE RELOAD TLS;
218
219 --let $rpl_connection_name= server2
220 --source include/rpl_connection.inc
221 SET @@GLOBAL.group_replication_ssl_mode= @group_replication_ssl_mode_save;
222 SET @@GLOBAL.tls_version= @tls_version_save;
223 SET @@GLOBAL.tls_ciphersuites= @tls_ciphersuites_save;
224 SET @@GLOBAL.ssl_cipher = @ssl_cipher_save;
225 if($have_mysql_stack) {
226 SET @@GLOBAL.group_replication_recovery_tls_version= @tls_version_recovery_save;
227 SET @@GLOBAL.group_replication_recovery_tls_ciphersuites= @tls_ciphersuites_recovery_save;
228 SET @@GLOBAL.group_replication_recovery_ssl_cipher= @ssl_cipher_recovery_save;
229 }
230 ALTER INSTANCE RELOAD TLS;
231
232
233 --source include/group_replication_end.inc