Debian Codegraph @

mysql-test/suite/rpl/t/rpl_tlsv13.test

raw
1 ################################################################################
2 # Base test to verify the basic TLS 1.3 support on Asynchronous Replication.
3 #
4 # Test:
5 # 0. The test requires two servers: M1 and M2.
6 # 1. Check replication with TLSv1.3 and some default ciphersuite.
7 # 2. Check replication with TLSv1.3 and a non-default ciphersuite.
8 # 3. RESET SLAVE does not clean MASTER_TLS_CIPHERSUITES.
9 # 4. Check replication with TLSv1.3 and different ciphersuite on master
10 # and slave will fail.
11 # 5. Check replication with TLSv1.3 and empty ciphersuite on slave will
12 # fail.
13 # 6. Clean up.
14 ################################################################################
15 --source include/not_group_replication_plugin.inc
16 --source include/have_tlsv13.inc
17 --source include/have_slave_repository_type_table.inc
18 --let $rpl_multi_source= 1
19 --let $rpl_skip_start_slave= 1
20 --let $rpl_privilege_checks_user_grant_option = 1
21 --source include/set_privilege_checks_user_as_system_user.inc
22 --source include/master-slave.inc
23
24 --echo ########################################################################
25 --echo # 1. Check replication with TLSv1.3 and some default ciphersuite.
26 SET SESSION sql_log_bin=0;
27 CREATE USER 'replssl'@'%' IDENTIFIED BY 'password' REQUIRE SSL;
28 GRANT REPLICATION SLAVE ON *.* TO 'replssl'@'%';
29 SET SESSION sql_log_bin=1;
30
31 SET @tls_version_saved= @@GLOBAL.tls_version;
32 SET GLOBAL tls_version='TLSv1.3';
33 ALTER INSTANCE RELOAD TLS;
34
35 --source include/rpl_connection_slave.inc
36 --replace_result $MASTER_MYPORT MASTER_PORT
37 --eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_PORT=$MASTER_MYPORT, SOURCE_USER='replssl', SOURCE_PASSWORD='password', SOURCE_SSL=1 FOR CHANNEL 'my_channel'
38 --let $rpl_channel_name= 'my_channel'
39 --source include/start_slave.inc
40
41 --let $tls_ciphersuites= query_get_value(SELECT TLS_CIPHERSUITES FROM performance_schema.replication_connection_configuration where CHANNEL_NAME = 'my_channel', TLS_CIPHERSUITES, 1)
42 --let $assert_text = TLS_CIPHERSUITES has the default NULL value
43 --let $assert_cond = "$tls_ciphersuites" = "NULL"
44 --source include/assert.inc
45
46 --echo ########################################################################
47 --echo # 2. Check replication with TLSv1.3 and a non-default ciphersuite.
48 --let $rpl_channel_name= 'my_channel'
49 --source include/stop_slave.inc
50
51 --source include/rpl_connection_master.inc
52 SET @tls_ciphersuites_saved= @@GLOBAL.tls_ciphersuites;
53 SET GLOBAL tls_ciphersuites='TLS_AES_128_GCM_SHA256';
54 ALTER INSTANCE RELOAD TLS;
55
56 --source include/rpl_connection_slave.inc
57 CHANGE REPLICATION SOURCE TO SOURCE_TLS_CIPHERSUITES='TLS_AES_128_GCM_SHA256' FOR CHANNEL 'my_channel';
58 --source include/start_slave.inc
59
60 --let $assert_text = TLS_CIPHERSUITES has the value TLS_AES_128_GCM_SHA256
61 --let $assert_cond = "[SELECT TLS_CIPHERSUITES FROM performance_schema.replication_connection_configuration where CHANNEL_NAME = \'my_channel\']" = "TLS_AES_128_GCM_SHA256"
62 --source include/assert.inc
63
64 --echo ########################################################################
65 --echo # 3. RESET SLAVE does not clean MASTER_TLS_CIPHERSUITES.
66 --source include/rpl_connection_slave.inc
67 --let $rpl_channel_name= 'my_channel'
68 --source include/stop_slave.inc
69
70 RESET SLAVE FOR CHANNEL 'my_channel';
71
72 --let $assert_text = TLS_CIPHERSUITES has the value TLS_AES_128_GCM_SHA256
73 --let $assert_cond = "[SELECT TLS_CIPHERSUITES FROM performance_schema.replication_connection_configuration where CHANNEL_NAME = \'my_channel\']" = "TLS_AES_128_GCM_SHA256"
74 --source include/assert.inc
75
76 --echo ########################################################################
77 --echo # 4. Check replication with TLSv1.3 and different ciphersuite on master
78 --echo # and slave will fail.
79 CHANGE REPLICATION SOURCE TO SOURCE_TLS_CIPHERSUITES='TLS_AES_128_CCM_8_SHA256', SOURCE_RETRY_COUNT=1 FOR CHANNEL 'my_channel';
80 START SLAVE IO_THREAD FOR CHANNEL 'my_channel';
81
82 #CR_SSL_CONNECTION_ERROR
83 --let $slave_io_errno= 2026
84 --source include/wait_for_slave_io_error.inc
85
86 --echo ########################################################################
87 --echo # 5. Check replication with TLSv1.3 and empty ciphersuite on slave will
88 --echo # fail.
89 --source include/rpl_connection_master.inc
90 SET @@GLOBAL.tls_ciphersuites= @tls_ciphersuites_saved;
91 ALTER INSTANCE RELOAD TLS;
92
93 --source include/rpl_connection_slave.inc
94 CHANGE REPLICATION SOURCE TO SOURCE_TLS_CIPHERSUITES='' FOR CHANNEL 'my_channel';
95 --let $assert_text = TLS_CIPHERSUITES has the value ""
96 --let $assert_cond = "[SELECT TLS_CIPHERSUITES FROM performance_schema.replication_connection_configuration where CHANNEL_NAME = \'my_channel\']" = ""
97 --source include/assert.inc
98
99 START SLAVE IO_THREAD FOR CHANNEL 'my_channel';
100 #CR_SSL_CONNECTION_ERROR
101 --let $slave_io_errno= 2026
102 --source include/wait_for_slave_io_error.inc
103
104 --echo ########################################################################
105 --echo # 6. Clean-up.
106 # Clean error state.
107 --source include/rpl_connection_slave.inc
108 CHANGE REPLICATION SOURCE TO SOURCE_TLS_CIPHERSUITES=NULL FOR CHANNEL 'my_channel';
109
110 --let $tls_ciphersuites= query_get_value(SELECT TLS_CIPHERSUITES FROM performance_schema.replication_connection_configuration where CHANNEL_NAME = 'my_channel', TLS_CIPHERSUITES, 1)
111 --let $assert_text = TLS_CIPHERSUITES has the default NULL value
112 --let $assert_cond = "$tls_ciphersuites" = "NULL"
113 --source include/assert.inc
114
115 --source include/start_slave.inc
116 --source include/stop_slave.inc
117
118 --source include/rpl_connection_master.inc
119 SET @@GLOBAL.tls_version= @tls_version_saved;
120 SET @@GLOBAL.tls_ciphersuites= @tls_ciphersuites_saved;
121 ALTER INSTANCE RELOAD TLS;
122
123 SET SESSION sql_log_bin=0;
124 DROP USER 'replssl';
125 SET SESSION sql_log_bin=1;
126
127 --let $rpl_skip_sync= 1
128 --source include/rpl_end.inc
129
130 --source include/rpl_connection_slave.inc
131 RESET SLAVE ALL FOR CHANNEL 'my_channel';