Debian Codegraph @

mysql-test/suite/group_replication/t/gr_start_gr_with_credentials_2.test

raw
1 ################################################################################
2 # This test case tests START GROUP_REPLICATION command with different
3 # combination of credentials with test_plugin_server.
4 #
5 # Test:
6 # 0. The test requires two servers: M1 and M2.
7 # 1. Bootstrap M1.
8 # Install test authentication plugin.
9 # Create new users.
10 # 2. Reset recovery interval to 1 and count to 2 for M2.
11 # 3. Test credentials as parameter START GR.
12 # Confirm password is not logged.
13 # 4. SSL - Test credentials as parameter START GR.
14 # Confirm password is not logged.
15 # 5. Test wrong credentials.
16 # Confirm password is not logged.
17 # 6. Cleanup.
18 ################################################################################
19
20 --source include/big_test.inc
21 --source include/have_group_replication_xcom_communication_stack.inc
22 --source include/have_group_replication_plugin.inc
23 --let $rpl_skip_group_replication_start= 1
24 --source include/group_replication.inc
25
26 # have_plugin_auth is simply plugin table check
27 # If we load it GR fails, so we post-pone install
28 # Validate plugins
29 --let plugins = PLUGIN_AUTH,GROUP_REPLICATION
30 --source include/check_plugin_dir.inc
31
32
33 --echo
34 --echo # 1. Bootstrap M1.
35 --echo # Install test authentication plugin.
36 --echo # Create new users.
37 --let $rpl_connection_name= server1
38 --source include/rpl_connection.inc
39
40 --replace_result $PLUGIN_AUTH PLUGIN_AUTH
41 --eval INSTALL PLUGIN test_plugin_server SONAME '$PLUGIN_AUTH'
42
43 --source include/start_and_bootstrap_group_replication.inc
44
45 SET SQL_LOG_BIN=0;
46
47 CREATE USER 'plug_user_p' IDENTIFIED WITH 'test_plugin_server' AS 'proxy_user_p';
48 CREATE USER 'plug_user_wp' IDENTIFIED WITH 'test_plugin_server' AS 'proxy_user_wp';
49 CREATE USER 'proxy_user_p' IDENTIFIED BY 'password';
50 CREATE USER 'proxy_user_wp' IDENTIFIED BY '';
51
52 GRANT ALL PRIVILEGES ON *.* TO 'proxy_user_p';
53 GRANT ALL PRIVILEGES ON *.* TO 'proxy_user_wp';
54 GRANT PROXY ON 'proxy_user_p' to 'plug_user_p';
55 GRANT PROXY ON 'proxy_user_wp' to 'plug_user_wp';
56 GRANT REPLICATION SLAVE ON *.* TO 'plug_user_p';
57 GRANT REPLICATION SLAVE ON *.* TO 'plug_user_wp';
58 SET SQL_LOG_BIN=1;
59
60 --echo
61 --echo # 2. Reset recovery interval to 1 and count to 2 for M2.
62 --let $rpl_connection_name= server2
63 --source include/rpl_connection.inc
64
65 SET @old_log_output= @@log_output;
66 SET GLOBAL log_output= 'TABLE,FILE';
67
68 RESET SLAVE ALL FOR CHANNEL 'group_replication_recovery';
69
70 --replace_result $PLUGIN_AUTH PLUGIN_AUTH
71 --eval INSTALL PLUGIN test_plugin_server SONAME '$PLUGIN_AUTH'
72
73 SET @saved_group_replication_recovery_reconnect_interval = @@GLOBAL.group_replication_recovery_reconnect_interval;
74 SET @saved_gr_recovery_retry_count = @@GLOBAL.group_replication_recovery_retry_count;
75
76 SET GLOBAL group_replication_recovery_reconnect_interval= 1;
77 SET GLOBAL group_replication_recovery_retry_count= 2;
78 --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
79 --eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
80
81 --echo
82 --echo # 3. Test credentials as parameter START GR.
83 --echo # Confirm password is not logged.
84
85 ## Credentials with password.
86 SET GLOBAL super_read_only= FALSE;
87 SET SQL_LOG_BIN=0;
88 TRUNCATE mysql.general_log;
89 SET SQL_LOG_BIN=1;
90 START GROUP_REPLICATION USER= 'plug_user_p' , PASSWORD= 'proxy_user_p';
91 --let $group_replication_member_state = ONLINE
92 --source include/gr_wait_for_member_state.inc
93 --source include/stop_group_replication.inc
94 --let $assert_text= Password is not logged.
95 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE "START GROUP_REPLICATION %PASSWORD_=%proxy_user_p%"]" = "0"
96 --source include/assert.inc
97 --let $assert_text= Password is logged as secret.
98 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE "START GROUP_REPLICATION %PASSWORD_=%<secret>%"]" = "1"
99 --source include/assert.inc
100
101 ## Credentials without password(test plugin).
102 SET GLOBAL super_read_only= FALSE;
103 SET SQL_LOG_BIN=0;
104 TRUNCATE mysql.general_log;
105 SET SQL_LOG_BIN=1;
106 START GROUP_REPLICATION USER= 'plug_user_wp' , PASSWORD= 'proxy_user_wp';
107 --let $group_replication_member_state = ONLINE
108 --source include/gr_wait_for_member_state.inc
109 --source include/stop_group_replication.inc
110 --let $assert_text= Password is not logged.
111 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE "START GROUP_REPLICATION %PASSWORD_=%proxy_user_wp%"]" = "0"
112 --source include/assert.inc
113 --let $assert_text= Password is logged as secret.
114 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE "START GROUP_REPLICATION %PASSWORD_=%<secret>%"]" = "1"
115 --source include/assert.inc
116
117 ## Credentials with password and plugin name.
118 SET GLOBAL super_read_only= FALSE;
119 SET SQL_LOG_BIN=0;
120 TRUNCATE mysql.general_log;
121 SET SQL_LOG_BIN=1;
122 START GROUP_REPLICATION USER= 'plug_user_p' , PASSWORD= 'proxy_user_p' , DEFAULT_AUTH= 'auth_test_plugin';
123 --let $group_replication_member_state = ONLINE
124 --source include/gr_wait_for_member_state.inc
125 --source include/stop_group_replication.inc
126 --let $assert_text= Password is not logged.
127 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE "START GROUP_REPLICATION %PASSWORD_=%proxy_user_p%"]" = "0"
128 --source include/assert.inc
129 --let $assert_text= Password is logged as secret.
130 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE "START GROUP_REPLICATION %PASSWORD_=%<secret>%"]" = "1"
131 --source include/assert.inc
132
133 ## Credentials without password and plugin name.
134 SET GLOBAL super_read_only= FALSE;
135 SET SQL_LOG_BIN=0;
136 TRUNCATE mysql.general_log;
137 SET SQL_LOG_BIN=1;
138 START GROUP_REPLICATION USER= 'plug_user_wp' , PASSWORD= 'proxy_user_wp' , DEFAULT_AUTH= 'auth_test_plugin';
139 --let $group_replication_member_state = ONLINE
140 --source include/gr_wait_for_member_state.inc
141 --source include/stop_group_replication.inc
142 --let $assert_text= Password is not logged.
143 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE "START GROUP_REPLICATION %PASSWORD_=%proxy_user_wp%"]" = "0"
144 --source include/assert.inc
145 --let $assert_text= Password is logged as secret.
146 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE "START GROUP_REPLICATION %PASSWORD_=%<secret>%"]" = "1"
147 --source include/assert.inc
148
149 ## Credentials without password and complete credentials.
150 SET GLOBAL super_read_only= FALSE;
151 SET SQL_LOG_BIN=0;
152 TRUNCATE mysql.general_log;
153 SET SQL_LOG_BIN=1;
154 START GROUP_REPLICATION USER= 'plug_user_wp' , PASSWORD= 'proxy_user_wp' , DEFAULT_AUTH= 'auth_test_plugin';
155 --let $group_replication_member_state = ONLINE
156 --source include/gr_wait_for_member_state.inc
157 --source include/stop_group_replication.inc
158 --let $assert_text= Password is not logged.
159 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE "START GROUP_REPLICATION %PASSWORD_=%proxy_user_wp%"]" = "0"
160 --source include/assert.inc
161 --let $assert_text= Password is logged as secret.
162 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE "START GROUP_REPLICATION %PASSWORD_=%<secret>%"]" = "1"
163 --source include/assert.inc
164
165 --echo
166 --echo # 4. SSL - Test credentials as parameter START GR.
167 --echo # Confirm password is not logged.
168
169 SET @group_replication_recovery_use_ssl_save= @@GLOBAL.group_replication_recovery_use_ssl;
170 SET GLOBAL group_replication_recovery_use_ssl= ON;
171
172 SET GLOBAL super_read_only= FALSE;
173 SET SQL_LOG_BIN=0;
174 TRUNCATE mysql.general_log;
175 SET SQL_LOG_BIN=1;
176 START GROUP_REPLICATION USER= 'plug_user_p' , PASSWORD= 'proxy_user_p';
177 --let $group_replication_member_state = ONLINE
178 --source include/gr_wait_for_member_state.inc
179 --source include/stop_group_replication.inc
180 --let $assert_text= Password is not logged.
181 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE "START GROUP_REPLICATION %PASSWORD_=%proxy_user_p%"]" = "0"
182 --source include/assert.inc
183 --let $assert_text= Password is logged as secret.
184 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE "START GROUP_REPLICATION %PASSWORD_=%<secret>%"]" = "1"
185 --source include/assert.inc
186
187 SET GLOBAL super_read_only= FALSE;
188 SET SQL_LOG_BIN=0;
189 TRUNCATE mysql.general_log;
190 SET SQL_LOG_BIN=1;
191 START GROUP_REPLICATION USER= 'plug_user_p' , PASSWORD= 'proxy_user_p' , DEFAULT_AUTH= 'auth_test_plugin';
192 --let $group_replication_member_state = ONLINE
193 --source include/gr_wait_for_member_state.inc
194 --source include/stop_group_replication.inc
195 --let $assert_text= Password is not logged.
196 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE "START GROUP_REPLICATION %PASSWORD_=%proxy_userwp%"]" = "0"
197 --source include/assert.inc
198 --let $assert_text= Password is logged as secret.
199 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE "START GROUP_REPLICATION %PASSWORD_=%<secret>%"]" = "1"
200 --source include/assert.inc
201
202 SET GLOBAL super_read_only= FALSE;
203 SET SQL_LOG_BIN=0;
204 TRUNCATE mysql.general_log;
205 SET SQL_LOG_BIN=1;
206 START GROUP_REPLICATION USER= 'plug_user_wp' , PASSWORD= 'proxy_user_wp' , DEFAULT_AUTH= 'auth_test_plugin';
207 --let $group_replication_member_state = ONLINE
208 --source include/gr_wait_for_member_state.inc
209 --source include/stop_group_replication.inc
210 --let $assert_text= Password is not logged.
211 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE "START GROUP_REPLICATION %PASSWORD_=%proxy_user_wp%"]" = "0"
212 --source include/assert.inc
213 --let $assert_text= Password is logged as secret.
214 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE "START GROUP_REPLICATION %PASSWORD_=%<secret>%"]" = "1"
215 --source include/assert.inc
216
217 SET @@GLOBAL.group_replication_recovery_use_ssl= @group_replication_recovery_use_ssl_save;
218
219 --echo
220 --echo # 5. Test wrong credentials.
221 --echo # Confirm password is not logged.
222
223 ## Wrong password.
224 SET GLOBAL super_read_only= FALSE;
225 SET SQL_LOG_BIN=0;
226 TRUNCATE mysql.general_log;
227 SET SQL_LOG_BIN=1;
228 START GROUP_REPLICATION USER='plug_user_p',PASSWORD='WRONG';
229 --let $group_replication_member_state = ERROR
230 --source include/gr_wait_for_member_state.inc
231 --source include/stop_group_replication.inc
232 --let $assert_text= Password is not logged.
233 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE "START GROUP_REPLICATION %PASSWORD_=%proxy_user_p%"]" = "0"
234 --source include/assert.inc
235 --let $assert_text= Password is logged as secret.
236 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE "START GROUP_REPLICATION %PASSWORD_=%<secret>%"]" = "1"
237 --source include/assert.inc
238
239 ## No passord(test plugin).
240 SET GLOBAL super_read_only= FALSE;
241 SET SQL_LOG_BIN=0;
242 TRUNCATE mysql.general_log;
243 SET SQL_LOG_BIN=1;
244 START GROUP_REPLICATION USER='plug_user_wp';
245 --let $group_replication_member_state = ERROR
246 --source include/gr_wait_for_member_state.inc
247 --source include/stop_group_replication.inc
248 --let $assert_text= Password is not logged.
249 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE "START GROUP_REPLICATION %PASSWORD_=%proxy_user_wp%"]" = "0"
250 --source include/assert.inc
251 --let $assert_text= Password is NOT LOGGED not even secret.
252 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE "START GROUP_REPLICATION %PASSWORD_=%<secret>%"]" = "0"
253 --source include/assert.inc
254
255 ## No user.
256 SET GLOBAL super_read_only= FALSE;
257 SET SQL_LOG_BIN=0;
258 TRUNCATE mysql.general_log;
259 SET SQL_LOG_BIN=1;
260 --error ER_GROUP_REPLICATION_USER_MANDATORY_MSG
261 START GROUP_REPLICATION PASSWORD='wrong';
262 --let $assert_text= Password is not logged.
263 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE "START GROUP_REPLICATION %PASSWORD_=%wrong%"]" = "0"
264 --source include/assert.inc
265 --let $assert_text= Password is logged as secret.
266 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE "START GROUP_REPLICATION %PASSWORD_=%<secret>%"]" = "1"
267 --source include/assert.inc
268
269 ## Wrong authentication plugin.
270 SET GLOBAL super_read_only= FALSE;
271 SET SQL_LOG_BIN=0;
272 TRUNCATE mysql.general_log;
273 SET SQL_LOG_BIN=1;
274 --eval START GROUP_REPLICATION USER='plug_user_p' , PASSWORD='proxy_user_p' , DEFAULT_AUTH='wrong_auth';
275 --let $group_replication_member_state = ONLINE
276 --source include/gr_wait_for_member_state.inc
277 --source include/stop_group_replication.inc
278 --let $assert_text= Password is not logged.
279 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE "START GROUP_REPLICATION %PASSWORD_=%proxy_user_p%"]" = "0"
280 --source include/assert.inc
281 --let $assert_text= Password is logged as secret.
282 --let $assert_cond= "[SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE "START GROUP_REPLICATION %PASSWORD_=%<secret>%"]" = "1"
283 --source include/assert.inc
284
285 --echo
286 --echo # 6. Cleanup.
287
288 CHANGE REPLICATION SOURCE TO SOURCE_USER='root' , SOURCE_PASSWORD='' FOR CHANNEL 'group_replication_recovery';
289 --source include/start_group_replication.inc
290
291 SET SESSION sql_log_bin = 0;
292 call mtr.add_suppression("Replica I/O for channel 'group_replication_recovery': Fatal error: Invalid .* username when attempting to connect to the source server.*");
293 call mtr.add_suppression("There was an error when connecting to the donor server. Please check that group_replication_recovery channel credentials and all MEMBER_HOST column values of performance_schema.replication_group_members table are correct and DNS resolvable.");
294 call mtr.add_suppression("For details please check performance_schema.replication_connection_status table and error log messages of Replica I/O for channel group_replication_recovery.");
295 call mtr.add_suppression("There was an error when connecting to the donor server. Please check that group_replication_recovery channel credentials and all MEMBER_HOST column values of performance_schema.replication_group_members table are correct and DNS resolvable.");
296 call mtr.add_suppression("Maximum number of retries when trying to connect to a donor reached. Aborting group replication incremental recovery.");
297 call mtr.add_suppression("Fatal error during the incremental recovery process of Group Replication. The server will leave the group.");
298 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
299 call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
300 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
301 SET SESSION sql_log_bin = 1;
302
303 SET @@GLOBAL.group_replication_recovery_reconnect_interval = @saved_group_replication_recovery_reconnect_interval;
304 SET @@GLOBAL.group_replication_recovery_retry_count = @saved_gr_recovery_retry_count;
305 SET GLOBAL log_output= @old_log_output;
306 UNINSTALL PLUGIN test_plugin_server;
307
308 --let $rpl_connection_name= server1
309 --source include/rpl_connection.inc
310
311 SET SESSION sql_log_bin = 0;
312
313 call mtr.add_suppression("Wrong password supplied for proxy_user_p");
314 call mtr.add_suppression("Wrong password supplied for proxy_user_wp");
315
316 DROP USER 'plug_user_p';
317 DROP USER 'plug_user_wp';
318 DROP USER 'proxy_user_p';
319 DROP USER 'proxy_user_wp';
320
321 SET SESSION sql_log_bin = 1;
322 UNINSTALL PLUGIN test_plugin_server;
323
324 TRUNCATE mysql.general_log;
325 --source include/group_replication_end.inc