| 1 |
--source include/not_group_replication_plugin.inc |
| 2 |
source include/master-slave.inc; |
| 3 |
|
| 4 |
# We don't test all types of ssl auth params here since it's a bit hard |
| 5 |
# until problems with OpenSSL 0.9.7 are unresolved |
| 6 |
|
| 7 |
# creating replication user for whom ssl auth is required |
| 8 |
# preparing playground |
| 9 |
connection master; |
| 10 |
SET SQL_LOG_BIN= 0; |
| 11 |
create user replssl@localhost require ssl; |
| 12 |
grant replication slave on *.* to replssl@localhost; |
| 13 |
SET SQL_LOG_BIN= 1; |
| 14 |
create table t1 (t int); |
| 15 |
|
| 16 |
--source include/sync_slave_sql_with_master.inc |
| 17 |
|
| 18 |
#trying to use this user without ssl |
| 19 |
stop slave; |
| 20 |
--source include/wait_for_slave_to_stop.inc |
| 21 |
--replace_column 2 #### |
| 22 |
CHANGE REPLICATION SOURCE to SOURCE_USER='replssl',SOURCE_PASSWORD=''; |
| 23 |
start slave; |
| 24 |
|
| 25 |
#showing that replication don't work |
| 26 |
--let $slave_io_errno= convert_error(ER_ACCESS_DENIED_ERROR) |
| 27 |
--source include/wait_for_slave_io_error.inc |
| 28 |
--source include/stop_slave_sql.inc |
| 29 |
|
| 30 |
#showing that replication could work with ssl params |
| 31 |
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR |
| 32 |
--replace_column 2 #### |
| 33 |
eval CHANGE REPLICATION SOURCE to SOURCE_SSL=1 , SOURCE_SSL_CA ='$MYSQL_TEST_DIR/std_data/cacert.pem', SOURCE_SSL_CERT='$MYSQL_TEST_DIR/std_data/client-cert.pem', SOURCE_SSL_KEY='$MYSQL_TEST_DIR/std_data/client-key.pem', SOURCE_TLS_VERSION='TLSv1.2'; |
| 34 |
start slave; |
| 35 |
--source include/wait_for_slave_to_start.inc |
| 36 |
|
| 37 |
#avoiding unneeded sleeps |
| 38 |
connection master; |
| 39 |
insert into t1 values (1); |
| 40 |
--source include/sync_slave_sql_with_master.inc |
| 41 |
|
| 42 |
#checking that replication is ok |
| 43 |
select * from t1; |
| 44 |
|
| 45 |
#checking show slave status |
| 46 |
let $status_items= Master_SSL_Allowed, Master_SSL_CA_Path, Master_SSL_CA_File, Master_SSL_Cert, Master_SSL_Key, Master_TLS_Version; |
| 47 |
source include/show_slave_status.inc; |
| 48 |
source include/check_slave_is_running.inc; |
| 49 |
|
| 50 |
#checking if replication works without ssl also performing clean up |
| 51 |
stop slave; |
| 52 |
--source include/wait_for_slave_to_stop.inc |
| 53 |
--replace_column 2 #### |
| 54 |
CHANGE REPLICATION SOURCE to SOURCE_USER='root',SOURCE_PASSWORD='', SOURCE_SSL=0; |
| 55 |
start slave; |
| 56 |
--source include/wait_for_slave_to_start.inc |
| 57 |
connection master; |
| 58 |
SET SQL_LOG_BIN= 0; |
| 59 |
drop user replssl@localhost; |
| 60 |
SET SQL_LOG_BIN= 1; |
| 61 |
drop table t1; |
| 62 |
|
| 63 |
--source include/sync_slave_sql_with_master.inc |
| 64 |
source include/show_slave_status.inc; |
| 65 |
source include/check_slave_is_running.inc; |
| 66 |
# End of 4.1 tests |
| 67 |
|
| 68 |
# Start replication with ssl_verify_server_cert turned on |
| 69 |
connection slave; |
| 70 |
stop slave; |
| 71 |
--source include/wait_for_slave_to_stop.inc |
| 72 |
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR |
| 73 |
--replace_column 2 #### |
| 74 |
eval CHANGE REPLICATION SOURCE to |
| 75 |
SOURCE_HOST="localhost", |
| 76 |
SOURCE_SSL=1 , |
| 77 |
SOURCE_SSL_CA ='$MYSQL_TEST_DIR/std_data/cacert.pem', |
| 78 |
SOURCE_SSL_CERT='$MYSQL_TEST_DIR/std_data/client-cert.pem', |
| 79 |
SOURCE_SSL_KEY='$MYSQL_TEST_DIR/std_data/client-key.pem', |
| 80 |
SOURCE_SSL_VERIFY_SERVER_CERT=1; |
| 81 |
start slave; |
| 82 |
--source include/wait_for_slave_to_start.inc |
| 83 |
|
| 84 |
connection master; |
| 85 |
create table t1 (t int); |
| 86 |
insert into t1 values (1); |
| 87 |
|
| 88 |
--source include/sync_slave_sql_with_master.inc |
| 89 |
|
| 90 |
echo on slave; |
| 91 |
#checking that replication is ok |
| 92 |
select * from t1; |
| 93 |
|
| 94 |
#checking show slave status |
| 95 |
source include/show_slave_status.inc; |
| 96 |
--source include/check_slave_is_running.inc |
| 97 |
|
| 98 |
# ==== Clean up ==== |
| 99 |
|
| 100 |
connection master; |
| 101 |
drop table t1; |
| 102 |
--source include/sync_slave_sql_with_master.inc |
| 103 |
|
| 104 |
############################################################################### |
| 105 |
# BUG#18778485 SSL_VERIFY_SERVER_CERT AUTOMATICALLY SETS TO NO POST RESET SLAVE |
| 106 |
# COMMAND |
| 107 |
# |
| 108 |
# Due to the buggy behaviour, a RESET SLAVE command on the slave server |
| 109 |
# reset ssl_verify_server_cert= 0. RESET SLAVE is generally expected to |
| 110 |
# delete slave logs and forget the replicaiton positions. This erroneous |
| 111 |
# behavior was therefore counterintuitive. |
| 112 |
# |
| 113 |
# We test the following: |
| 114 |
# - The behaviour of ssl_verify_server_cert with RESET SLAVE. |
| 115 |
# - Test that neither of STOP SLAVE or START SLAVE affects the value of |
| 116 |
# ssl_verify_server_cert. |
| 117 |
# - Test that CHANGE MASTER with no ssl_verify_server_cert option doesnt |
| 118 |
# affect ssl_verify_server_cert value. |
| 119 |
############################################################################## |
| 120 |
|
| 121 |
--source include/stop_slave.inc |
| 122 |
|
| 123 |
--let $assert_cond= "[SHOW SLAVE STATUS, Master_SSL_Verify_Server_Cert, 1]" = "Yes" |
| 124 |
--let $assert_text= Master_SSL_Verify_Server_Cert should NOT change on STOP SLAVE. |
| 125 |
--source include/assert.inc |
| 126 |
|
| 127 |
--let $log_file= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1) |
| 128 |
--let $log_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1) |
| 129 |
|
| 130 |
RESET SLAVE; |
| 131 |
|
| 132 |
--let $assert_cond= "[SHOW SLAVE STATUS, Master_SSL_Verify_Server_Cert, 1]" = "Yes" |
| 133 |
--let $assert_text= Master_SSL_Verify_Server_Cert should NOT change on RESET SLAVE. |
| 134 |
--source include/assert.inc |
| 135 |
|
| 136 |
--replace_result $MASTER_MYPORT MASTER_MYPORT |
| 137 |
--eval CHANGE REPLICATION SOURCE TO SOURCE_PORT= $MASTER_MYPORT |
| 138 |
|
| 139 |
--let $assert_cond= "[SHOW SLAVE STATUS, Master_SSL_Verify_Server_Cert, 1]" = "Yes" |
| 140 |
--let $assert_text= Master_SSL_Verify_Server_Cert should NOT change on CHANGE MASTER. |
| 141 |
--source include/assert.inc |
| 142 |
|
| 143 |
--source include/start_slave.inc |
| 144 |
--let $assert_cond= "[SHOW SLAVE STATUS, Master_SSL_Verify_Server_Cert, 1]" = "Yes" |
| 145 |
--let $assert_text= Master_SSL_Verify_Server_Cert should NOT change on START SLAVE. |
| 146 |
--source include/assert.inc |
| 147 |
|
| 148 |
--connection master |
| 149 |
--disable_warnings |
| 150 |
DROP TABLE IF EXISTS t1; |
| 151 |
--source include/sync_slave_sql_with_master.inc |
| 152 |
--enable_warnings |
| 153 |
|
| 154 |
--source include/stop_slave.inc |
| 155 |
# Clean change master options. |
| 156 |
--replace_column 2 #### |
| 157 |
CHANGE REPLICATION SOURCE TO |
| 158 |
SOURCE_HOST="127.0.0.1", |
| 159 |
SOURCE_SSL_CA ='', |
| 160 |
SOURCE_SSL_CERT='', |
| 161 |
SOURCE_SSL_KEY='', |
| 162 |
SOURCE_SSL_VERIFY_SERVER_CERT=0, |
| 163 |
SOURCE_SSL=0, |
| 164 |
SOURCE_TLS_VERSION=''; |
| 165 |
|
| 166 |
--let $rpl_only_running_threads= 1 |
| 167 |
--source include/rpl_end.inc |