Debian Codegraph @

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

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