1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410
|
################################################################################
# This test case aims to verify if the changes made to the START REPLICA command
# in the context of the WL#4143 work as specified. The following properties
# are verified:
#
# 0 - This aims at checking syntax.
#
# 1 - If START REPLICA works with regular users and different combinations
# of USER and PASSWORD.
#
# 2 - If START REPLICA USER=xxxx PASSWORD=yyyy works with pluggable users
# and different combinations of DEFAULT_AUTH and PLUGIN_DIR.
# It is always required to provide a password when pluggable users are
# used. The password is the name of the proxy user.
#
# 3 - If START REPLICA works with pluggable users defined in the master info
# repository.
#
# 4 - The warning message "Sending passwords in plain text without SSL/TLS is"
# extremely insecure" is not printed out if a SSL connection is in use.
################################################################################
--source include/not_group_replication_plugin.inc
--source include/have_plugin_auth.inc
--source include/master-slave.inc
################################################################################
# 1. Prepare the environment
################################################################################
SET SQL_LOG_BIN=0;
--sorted_result
SELECT user, plugin FROM mysql.user WHERE user NOT IN ('root', 'mysql.sys','mysql.session', 'mysql.infoschema');
CREATE USER 'plug_user_p' IDENTIFIED WITH 'test_plugin_server' AS 'proxy_user_p';
CREATE USER 'plug_user_wp' IDENTIFIED WITH 'test_plugin_server' AS 'proxy_user_wp';
CREATE USER 'proxy_user_p' IDENTIFIED BY 'password';
CREATE USER 'proxy_user_wp' IDENTIFIED BY '';
CREATE USER 'regular_user_p' IDENTIFIED BY 'password';
CREATE USER 'regular_user_wp' IDENTIFIED BY '';
--sorted_result
SELECT user, plugin FROM mysql.user WHERE user NOT IN ('root', 'mysql.sys','mysql.session', 'mysql.infoschema');
GRANT PROXY ON proxy_user_p to plug_user_p;
GRANT PROXY ON proxy_user_wp to plug_user_wp;
GRANT REPLICATION SLAVE ON *.* TO proxy_user_p;
GRANT REPLICATION SLAVE ON *.* TO proxy_user_wp;
GRANT REPLICATION SLAVE ON *.* TO regular_user_p;
GRANT REPLICATION SLAVE ON *.* TO regular_user_wp;
SET SQL_LOG_BIN=1;
###############################################################################
# 2. Test if different type of users can connect when CHANGE MASTER
# START REPLICA are specified
###############################################################################
--connection slave
--let $slave_io_errno= 2059
--let $show_slave_io_error= 0
#
# Check Property 0
#
--source include/stop_slave.inc
--replace_column 2 ####
CHANGE REPLICATION SOURCE TO SOURCE_USER= 'DOES NOT EXIST', SOURCE_PASSWORD = 'DOES NOT EXIST', SOURCE_SSL = 1;
--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
--error ER_SQLTHREAD_WITH_SECURE_REPLICA
--eval START REPLICA SQL_THREAD USER= 'regular_user_p' PASSWORD= 'password'
--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
--error ER_SQLTHREAD_WITH_SECURE_REPLICA
--eval START REPLICA SQL_THREAD USER= 'regular_user_p' PASSWORD= 'password' DEFAULT_AUTH= 'auth_test_plugin'
--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
--error ER_SQLTHREAD_WITH_SECURE_REPLICA
--eval START REPLICA SQL_THREAD USER= 'regular_user_p' PASSWORD= 'password' DEFAULT_AUTH= 'auth_test_plugin' PLUGIN_DIR= '$PLUGIN_AUTH_DIR'
--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
--replace_column 2 ####
--eval START REPLICA IO_THREAD USER= 'regular_user_p' PASSWORD= 'password'
--source include/wait_for_slave_io_to_start.inc
--source include/stop_slave_io.inc
--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
--replace_column 2 ####
--eval START REPLICA IO_THREAD USER= 'regular_user_p' PASSWORD= 'password' DEFAULT_AUTH= 'auth_test_plugin'
--source include/wait_for_slave_io_to_start.inc
--source include/stop_slave_io.inc
--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
--replace_column 2 ####
--eval START REPLICA IO_THREAD USER= 'regular_user_p' PASSWORD= 'password' DEFAULT_AUTH= 'auth_test_plugin' PLUGIN_DIR= '$PLUGIN_AUTH_DIR'
--source include/wait_for_slave_io_to_start.inc
--source include/stop_slave_io.inc
--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
--replace_column 2 ####
--eval START REPLICA IO_THREAD, SQL_THREAD USER= 'regular_user_p' PASSWORD= 'password'
--source include/wait_for_slave_io_to_start.inc
--source include/stop_slave_io.inc
--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
--replace_column 2 ####
--eval START REPLICA IO_THREAD, SQL_THREAD USER= 'regular_user_p' PASSWORD= 'password' DEFAULT_AUTH= 'auth_test_plugin'
--source include/wait_for_slave_io_to_start.inc
--source include/stop_slave_io.inc
--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
--replace_column 2 ####
--eval START REPLICA IO_THREAD, SQL_THREAD USER= 'regular_user_p' PASSWORD= 'password' DEFAULT_AUTH= 'auth_test_plugin' PLUGIN_DIR= '$PLUGIN_AUTH_DIR'
--source include/wait_for_slave_io_to_start.inc
--source include/stop_slave_io.inc
#
# Check Property 1.
#
--source include/stop_slave.inc
--replace_column 2 ####
CHANGE REPLICATION SOURCE TO SOURCE_USER= 'DOES NOT EXIST', SOURCE_PASSWORD = 'DOES NOT EXIST';
--replace_column 2 ####
--eval START REPLICA USER= 'regular_user_p' PASSWORD= 'password'
--source include/wait_for_slave_to_start.inc
--source include/check_slave_is_running.inc
#
# Check Property 1.
#
--source include/stop_slave.inc
--replace_column 2 ####
CHANGE REPLICATION SOURCE TO SOURCE_USER= 'DOES NOT EXIST', SOURCE_PASSWORD = 'DOES NOT EXIST';
--replace_column 2 ####
--eval START REPLICA USER= 'regular_user_wp' PASSWORD= ''
--source include/wait_for_slave_to_start.inc
--source include/check_slave_is_running.inc
#
# Check Property 1.
#
--source include/stop_slave.inc
--replace_column 2 ####
CHANGE REPLICATION SOURCE TO SOURCE_USER= 'DOES NOT EXIST', SOURCE_PASSWORD = 'DOES NOT EXIST';
--replace_column 2 ####
--eval START REPLICA USER= 'regular_user_p' PASSWORD= 'password'
--source include/wait_for_slave_to_start.inc
--source include/check_slave_is_running.inc
#
# Check Property 1.
#
--source include/stop_slave.inc
--replace_column 2 ####
CHANGE REPLICATION SOURCE TO SOURCE_USER= 'DOES NOT EXIST', SOURCE_PASSWORD = 'DOES NOT EXIST';
--replace_column 2 ####
--eval START REPLICA USER= 'regular_user_wp' PASSWORD= ''
--source include/wait_for_slave_to_start.inc
--source include/check_slave_is_running.inc
#
# Check Property 1.
#
--source include/stop_slave.inc
--replace_column 2 ####
CHANGE REPLICATION SOURCE TO SOURCE_USER= 'DOES NOT EXIST', SOURCE_PASSWORD = 'DOES NOT EXIST';
--replace_column 2 ####
--eval START REPLICA USER= 'regular_user_wp'
--source include/wait_for_slave_to_start.inc
--source include/check_slave_is_running.inc
#
# Check Property 2.
#
--source include/stop_slave.inc
--replace_result $MASTER_MYSOCK MASTER_MYSOCK $PLUGIN_AUTH_OPT PLUGIN_AUTH_OPT
--replace_column 2 ####
CHANGE REPLICATION SOURCE TO SOURCE_USER= 'DOES NOT EXIST', SOURCE_PASSWORD = 'DOES NOT EXIST';
--replace_column 2 ####
--eval START REPLICA USER= 'plug_user_p' PASSWORD= 'proxy_user_p'
--source include/wait_for_slave_to_start.inc
--source include/check_slave_is_running.inc
#
# Check Property 2.
#
--source include/stop_slave.inc
--replace_result $MASTER_MYSOCK MASTER_MYSOCK $PLUGIN_AUTH_OPT PLUGIN_AUTH_OPT
--replace_column 2 ####
CHANGE REPLICATION SOURCE TO SOURCE_USER= 'DOES NOT EXIST', SOURCE_PASSWORD = 'DOES NOT EXIST';
--replace_column 2 ####
--eval START REPLICA USER= 'plug_user_wp' PASSWORD= 'proxy_user_wp'
--source include/wait_for_slave_to_start.inc
--source include/check_slave_is_running.inc
#
# Check Property 2.
#
--source include/stop_slave.inc
--replace_column 2 ####
CHANGE REPLICATION SOURCE TO SOURCE_USER= 'DOES NOT EXIST', SOURCE_PASSWORD = 'DOES NOT EXIST';
--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
--replace_column 2 ####
--eval START REPLICA USER= 'plug_user_p' PASSWORD= 'proxy_user_p' PLUGIN_DIR= '$PLUGIN_AUTH_DIR'
--source include/wait_for_slave_to_start.inc
--source include/check_slave_is_running.inc
#
# Check Property 2.
#
--source include/stop_slave.inc
--replace_column 2 ####
CHANGE REPLICATION SOURCE TO SOURCE_USER= 'DOES NOT EXIST', SOURCE_PASSWORD = 'DOES NOT EXIST';
--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
--replace_column 2 ####
--eval START REPLICA USER= 'plug_user_wp' PASSWORD= 'proxy_user_wp' PLUGIN_DIR= '$PLUGIN_AUTH_DIR'
--source include/wait_for_slave_to_start.inc
--source include/check_slave_is_running.inc
#
# Check Property 2.
#
--source include/stop_slave.inc
--replace_column 2 ####
CHANGE REPLICATION SOURCE TO SOURCE_USER= 'DOES NOT EXIST', SOURCE_PASSWORD = 'DOES NOT EXIST';
--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
--replace_column 2 ####
--eval START REPLICA USER= 'plug_user_p' PASSWORD= 'proxy_user_p' DEFAULT_AUTH= 'auth_test_plugin'
--source include/wait_for_slave_to_start.inc
--source include/check_slave_is_running.inc
#
# Check Property 2.
#
--source include/stop_slave.inc
--replace_column 2 ####
CHANGE REPLICATION SOURCE TO SOURCE_USER= 'DOES NOT EXIST', SOURCE_PASSWORD = 'DOES NOT EXIST';
--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
--replace_column 2 ####
--eval START REPLICA USER= 'plug_user_wp' PASSWORD= 'proxy_user_wp' DEFAULT_AUTH= 'auth_test_plugin'
--source include/wait_for_slave_to_start.inc
--source include/check_slave_is_running.inc
#
# Check Property 2.
#
--source include/stop_slave.inc
--replace_column 2 ####
CHANGE REPLICATION SOURCE TO SOURCE_USER= 'DOES NOT EXIST', SOURCE_PASSWORD = 'DOES NOT EXIST';
--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
--replace_column 2 ####
--eval START REPLICA USER= 'plug_user_p' PASSWORD= 'proxy_user_p' DEFAULT_AUTH= 'auth_test_plugin' PLUGIN_DIR= '$PLUGIN_AUTH_DIR'
--source include/wait_for_slave_to_start.inc
--source include/check_slave_is_running.inc
#
# Check Property 2.
#
--source include/stop_slave.inc
--replace_column 2 ####
CHANGE REPLICATION SOURCE TO SOURCE_USER= 'DOES NOT EXIST', SOURCE_PASSWORD = 'DOES NOT EXIST';
--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
--replace_column 2 ####
--eval START REPLICA USER= 'plug_user_wp' PASSWORD= 'proxy_user_wp' DEFAULT_AUTH= 'auth_test_plugin' PLUGIN_DIR= '$PLUGIN_AUTH_DIR'
--source include/wait_for_slave_to_start.inc
--source include/check_slave_is_running.inc
#
# Check Property 3.
#
--source include/stop_slave.inc
--replace_column 2 ####
CHANGE REPLICATION SOURCE TO SOURCE_USER= 'plug_user_p', SOURCE_PASSWORD= 'proxy_user_p', SOURCE_SSL = 1;
--source include/start_slave.inc
--source include/check_slave_is_running.inc
#
# Check Property 3.
#
--source include/stop_slave.inc
--replace_column 2 ####
CHANGE REPLICATION SOURCE TO SOURCE_USER= 'plug_user_wp', SOURCE_PASSWORD= 'proxy_user_wp';
--source include/start_slave.inc
--source include/check_slave_is_running.inc
#
# Check Property 4
#
--connection slave
CREATE USER 'ssl_user' IDENTIFIED BY '' REQUIRE SSL;
GRANT ALL ON *.* TO ssl_user;
--source include/stop_slave.inc
--replace_result $SLAVE_MYPORT SLAVE_MYPORT
connect (con_ssl,127.0.0.1,ssl_user,,test,$SLAVE_MYPORT,,SSL);
--connection con_ssl
--replace_column 2 ####
CHANGE REPLICATION SOURCE TO SOURCE_USER= 'root', SOURCE_PASSWORD = '' , SOURCE_SSL = 0;
--source include/start_slave.inc
--source include/stop_slave.inc
--eval START REPLICA USER= 'root' PASSWORD= ''
--source include/wait_for_slave_to_start.inc
--source include/check_slave_is_running.inc
#
# Bug#13410464: FOR START REPLICA .. PASSWORD=<PASSWORD>, THE PASSWORD IS LOGGED IN PLAIN TEXT
#
SET @old_log_output= @@log_output;
SET GLOBAL log_output= 'TABLE,FILE';
call mtr.add_suppression(".*Invalid .* username when attempting to connect to the source server.*");
--disable_warnings
--source include/stop_slave.inc
TRUNCATE mysql.general_log;
START REPLICA PASSWORD='secret';
--let $slave_io_errno=13117
--source include/wait_for_slave_io_error.inc
--let $slave_io_errno= convert_error(ER_REPLICA_FATAL_ERROR)
--source include/stop_slave.inc
TRUNCATE mysql.general_log;
START REPLICA USER='root' PASSWORD='secret';
--let $rewritten= `SELECT REPLACE(argument,"= <secret>","= '<secret>'") FROM mysql.general_log WHERE argument LIKE "%PASSWORD = <secret>"`
# execute it to see if the rewrite generated a (syntatically) valid command
--let $slave_io_errno= 2061
--source include/wait_for_slave_io_error.inc
--source include/stop_slave_sql.inc
--eval $rewritten
--let $slave_io_errno= 2061
--source include/wait_for_slave_io_error.inc
--source include/stop_slave_sql.inc
TRUNCATE mysql.general_log;
--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
--eval START REPLICA IO_THREAD USER='root' PASSWORD='secret' DEFAULT_AUTH= 'auth_test_plugin' PLUGIN_DIR= '$PLUGIN_AUTH_DIR'
--let $rewritten= `SELECT REPLACE(argument,"= <secret>","= '<secret>'") FROM mysql.general_log WHERE argument LIKE "%PASSWORD = <secret>%"`
# execute it to see if the rewrite generated a (syntatically) valid command
--let $slave_io_errno= 2061
--source include/wait_for_slave_io_error.inc
--source include/stop_slave_sql.inc
--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
--eval $rewritten
--let $slave_io_errno= 2061
--source include/wait_for_slave_io_error.inc
--source include/stop_slave_sql.inc
TRUNCATE mysql.general_log;
--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
--eval START REPLICA IO_THREAD, SQL_THREAD USER='root' PASSWORD='secret' DEFAULT_AUTH= 'auth_test_plugin' PLUGIN_DIR= '$PLUGIN_AUTH_DIR'
--let $rewritten= `SELECT REPLACE(argument,"= <secret>","= '<secret>'") FROM mysql.general_log WHERE argument LIKE "%PASSWORD = <secret>%"`
# execute it to see if the rewrite generated a (syntatically) valid command
--let $slave_io_errno= 2061
--source include/wait_for_slave_io_error.inc
--source include/stop_slave_sql.inc
--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
--eval $rewritten
--let $slave_io_errno= 2061
--source include/wait_for_slave_io_error.inc
--source include/stop_slave_sql.inc
TRUNCATE mysql.general_log;
--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
--eval START REPLICA IO_THREAD, SQL_THREAD UNTIL SOURCE_LOG_FILE='dummy-log.000001', SOURCE_LOG_POS=116 USER='root' PASSWORD='secret' DEFAULT_AUTH= 'auth_test_plugin' PLUGIN_DIR= '$PLUGIN_AUTH_DIR'
--let $rewritten= `SELECT REPLACE(argument,"= <secret>","= '<secret>'") FROM mysql.general_log WHERE argument LIKE "%PASSWORD = <secret>%"`
# execute it to see if the rewrite generated a (syntatically) valid command
--let $slave_io_errno= 2061
--source include/wait_for_slave_io_error.inc
--source include/stop_slave_sql.inc
--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
--eval $rewritten
--let $slave_io_errno= 2061
--source include/wait_for_slave_io_error.inc
--source include/stop_slave_sql.inc
TRUNCATE mysql.general_log;
--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
--eval START REPLICA IO_THREAD, SQL_THREAD UNTIL RELAY_LOG_FILE='dummy-log.000001', RELAY_LOG_POS=116 USER='root' PASSWORD='secret' DEFAULT_AUTH= 'auth_test_plugin' PLUGIN_DIR= '$PLUGIN_AUTH_DIR'
--let $rewritten= `SELECT REPLACE(argument,"= <secret>","= '<secret>'") FROM mysql.general_log WHERE argument LIKE "%PASSWORD = <secret>%"`
# execute it to see if the rewrite generated a (syntatically) valid command
--let $slave_io_errno= 2061
--source include/wait_for_slave_io_error.inc
--source include/stop_slave_sql.inc
--replace_result $PLUGIN_AUTH_DIR PLUGIN_AUTH_DIR
--eval $rewritten
--let $slave_io_errno= 2061
--source include/wait_for_slave_io_error.inc
--source include/stop_slave_sql.inc
--enable_warnings
SET GLOBAL log_output= @old_log_output;
TRUNCATE mysql.general_log;
--source include/start_slave.inc
################################################################################
# 3. Clean the environment
################################################################################
--connection master
SET SQL_LOG_BIN=0;
DROP USER plug_user_p, plug_user_wp, regular_user_p, regular_user_wp, proxy_user_p, proxy_user_wp;
SET SQL_LOG_BIN=1;
--connection slave
DROP USER ssl_user;
disconnect con_ssl;
--source include/rpl_end.inc
|