Debian Codegraph @

mysql-test/suite/auth_sec/t/initialize_admin_channel.test

raw
1 --source include/big_test.inc
2
3 --echo #
4 --echo # Bug#31101320 TLS INITIALIZATION FOR ADMIN CHANNEL
5 --echo # SHOULD NOT BE DONE DURING --INITIALIZE
6 --echo #
7
8 let BASEDIR= `select @@basedir`;
9 let DDIR=$MYSQL_TMP_DIR/installdb_test;
10 let MYSQLD_LOG=$MYSQL_TMP_DIR/server.log;
11 let extra_args=--no-defaults --innodb_dedicated_server=OFF --console --loose-skip-sha256_password_auto_generate_rsa_keys --basedir=$BASEDIR --lc-messages-dir=$MYSQL_SHAREDIR;
12 let BOOTSTRAP_SQL=$MYSQL_TMP_DIR/tiny_bootstrap.sql;
13
14 --echo # create bootstrap file
15 write_file $BOOTSTRAP_SQL;
16 CREATE DATABASE test;
17 EOF
18
19 --echo # shut server down
20 --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
21 --shutdown_server
22 --source include/wait_until_disconnected.inc
23 --echo # Server is down
24
25 --echo # -----------------------------------------------------------------------
26 --echo #
27 --echo # Try --initialize
28 --echo #
29
30 --echo # Run the server with --initialize
31 --exec $MYSQLD $extra_args --initialize --datadir=$DDIR --log-error-verbosity=2 > $MYSQLD_LOG 2>&1
32
33 --echo # check for Failed to initialize TSL for channel: mysql_admin. - pattern should not be present.
34 --let $grep_file=$MYSQLD_LOG
35 --let $grep_pattern=Failed to initialize TLS for channel: mysql_admin. See below for the description of exact issue.
36 --let $grep_output=boolean
37 --source include/grep_pattern.inc
38
39 --echo # check for No TLS configuration was given for channel mysql_admin - pattern should not be present.
40 --let $grep_pattern=No TLS configuration was given for channel mysql_admin.*
41 --let $grep_output=boolean
42 --source include/grep_pattern.inc
43
44 --echo # check for Channel mysql_main configured to support TLS - pattern should not be present.
45 --let $grep_pattern=Channel mysql_main configured to support TLS.*
46 --let $grep_output=boolean
47 --source include/grep_pattern.inc
48
49 --echo # check for Channel mysql_admin configured to support TLS - pattern should not be present.
50 --let $grep_pattern=Channel mysql_admin configured to support TLS.*
51 --let $grep_output=boolean
52 --source include/grep_pattern.inc
53
54 --echo # delete mysqld log
55 remove_file $MYSQLD_LOG;
56
57 --echo # delete datadir
58 --force-rmdir $DDIR
59
60 --echo # -----------------------------------------------------------------------
61 --echo #
62 --echo # Try --initialize --admin-address=127.0.0.1
63 --echo #
64
65 --exec $MYSQLD $extra_args --initialize --datadir=$DDIR --log-error-verbosity=2 --admin-address=127.0.0.1 > $MYSQLD_LOG 2>&1
66
67 --echo # check for Failed to initialize TSL for channel: mysql_admin - pattern should not be present.
68 --let $grep_file=$MYSQLD_LOG
69 --let $grep_pattern=Failed to initialize TLS for channel: mysql_admin. See below for the description of exact issue.
70 --let $grep_output=boolean
71 --source include/grep_pattern.inc
72
73 --echo # check for No TLS configuration was given for channel mysql_admin - pattern should not be present.
74 --let $grep_pattern=No TLS configuration was given for channel mysql_admin.*
75 --let $grep_output=boolean
76 --source include/grep_pattern.inc
77
78 --echo # check for Channel mysql_main configured to support TLS - pattern should be not present.
79 --let $grep_pattern=Channel mysql_main configured to support TLS.*
80 --let $grep_output=boolean
81 --source include/grep_pattern.inc
82
83 --echo # check for Channel mysql_admin configured to support TLS - pattern should not be present.
84 --let $grep_pattern=Channel mysql_admin configured to support TLS.*
85 --let $grep_output=boolean
86 --source include/grep_pattern.inc
87
88 --echo # delete mysqld log
89 remove_file $MYSQLD_LOG;
90
91 --echo # delete datadir
92 --force-rmdir $DDIR
93
94 --echo # -----------------------------------------------------------------------
95 --echo #
96 --echo # Try --initialize-insecure
97 --echo #
98
99 --echo # Run the server with --initialize-insecure
100 --exec $MYSQLD $extra_args --initialize-insecure --datadir=$DDIR --log-error-verbosity=2 > $MYSQLD_LOG 2>&1
101
102 --echo # check for Failed to initialize TSL for channel: mysql_admin - pattern should not be present.
103 --let $grep_file=$MYSQLD_LOG
104 --let $grep_pattern=Failed to initialize TLS for channel: mysql_admin. See below for the description of exact issue.
105 --let $grep_output=boolean
106 --source include/grep_pattern.inc
107
108 --echo # check for No TLS configuration was given for channel mysql_admin - pattern should not be present.
109 --let $grep_pattern=No TLS configuration was given for channel mysql_admin.*
110 --let $grep_output=boolean
111 --source include/grep_pattern.inc
112
113 --echo # check for Channel mysql_main configured to support TLS - pattern should not be present.
114 --let $grep_pattern=Channel mysql_main configured to support TLS.*
115 --let $grep_output=boolean
116 --source include/grep_pattern.inc
117
118 --echo # check for Channel mysql_admin configured to support TLS - pattern should not be present.
119 --let $grep_pattern=Channel mysql_admin configured to support TLS.*
120 --let $grep_output=boolean
121 --source include/grep_pattern.inc
122
123 --echo # delete mysqld log
124 remove_file $MYSQLD_LOG;
125
126 --echo # delete datadir
127 --force-rmdir $DDIR
128
129 --echo # -----------------------------------------------------------------------
130 --echo #
131 --echo # Try --initialize-insecure --admin-address=127.0.0.1
132 --echo #
133
134 --exec $MYSQLD $extra_args --initialize-insecure --datadir=$DDIR --log-error-verbosity=2 --admin-address=127.0.0.1 --init-file=$BOOTSTRAP_SQL > $MYSQLD_LOG 2>&1
135
136 --echo # check for Failed to initialize TSL for channel: mysql_admin - pattern should not be present.
137 --let $grep_file=$MYSQLD_LOG
138 --let $grep_pattern=Failed to initialize TLS for channel: mysql_admin. See below for the description of exact issue.
139 --let $grep_output=boolean
140 --source include/grep_pattern.inc
141
142 --echo # check for No TLS configuration was given for channel mysql_admin - pattern should not be present.
143 --let $grep_pattern=No TLS configuration was given for channel mysql_admin.*
144 --let $grep_output=boolean
145 --source include/grep_pattern.inc
146
147 --echo # check for Channel mysql_main configured to support TLS - pattern should not be present.
148 --let $grep_pattern=Channel mysql_main configured to support TLS.*
149 --let $grep_output=boolean
150 --source include/grep_pattern.inc
151
152 --echo # check for Channel mysql_admin configured to support TLS - pattern should not be present.
153 --let $grep_pattern=Channel mysql_admin configured to support TLS.*
154 --let $grep_output=boolean
155 --source include/grep_pattern.inc
156
157 --echo # delete mysqld log
158 remove_file $MYSQLD_LOG;
159
160 --echo # -----------------------------------------------------------------------
161 --echo #
162 --echo # Restart server with --datadir=DDIR
163 --echo #
164
165 --exec echo "restart: --log-error=$MYSQLD_LOG --datadir=$DDIR " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
166 --enable_reconnect
167 --source include/wait_until_connected_again.inc
168
169 --echo # connect as root
170 connect(root_con,localhost,root,,mysql);
171
172 --echo # check for Failed to initialize TSL for channel: mysql_admin - pattern should not be present.
173 --let $grep_file=$MYSQLD_LOG
174 --let $grep_pattern=Failed to initialize TLS for channel: mysql_admin. See below for the description of exact issue.
175 --let $grep_output=boolean
176 --source include/grep_pattern.inc
177
178 --echo # check for No TLS configuration was given for channel mysql_admin - pattern should not be present.
179 --let $grep_pattern=No TLS configuration was given for channel mysql_admin.*
180 --let $grep_output=boolean
181 --source include/grep_pattern.inc
182
183 --echo # check for Channel mysql_main configured to support TLS - pattern should be present.
184 --let $grep_pattern=Channel mysql_main configured to support TLS.*
185 --let $grep_output=boolean
186 --source include/grep_pattern.inc
187
188 --echo # check for Channel mysql_admin configured to support TLS - pattern should not be present.
189 --let $grep_pattern=Channel mysql_admin configured to support TLS.*
190 --let $grep_output=boolean
191 --source include/grep_pattern.inc
192
193 --echo # shut server down
194 --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
195 --shutdown_server
196 --source include/wait_until_disconnected.inc
197 --echo # Server is down
198
199 --echo # close the test connection
200 connection default;
201 disconnect root_con;
202
203 --echo # delete mysqld log
204 remove_file $MYSQLD_LOG;
205
206 --echo # -----------------------------------------------------------------------
207 --echo #
208 --echo # Restart server with --datadir=DDIR --admin-address=127.0.0.1
209 --echo #
210
211 --exec echo "restart:--log-error=$MYSQLD_LOG --datadir=$DDIR --admin-address=127.0.0.1" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
212 --enable_reconnect
213 --source include/wait_until_connected_again.inc
214
215 --echo # connect as root
216 connect(root_con,localhost,root,,mysql);
217
218 --echo # check for Failed to initialize TSL for channel: mysql_admin - pattern should be present.
219 --let $grep_file=$MYSQLD_LOG
220 --let $grep_pattern=Failed to initialize TLS for channel: mysql_admin. See below for the description of exact issue.
221 --let $grep_output=boolean
222 --source include/grep_pattern.inc
223
224 --echo # check for No TLS configuration was given for channel mysql_admin - pattern should be present.
225 --let $grep_pattern=No TLS configuration was given for channel mysql_admin.*
226 --let $grep_output=boolean
227 --source include/grep_pattern.inc
228
229 --echo # check for Channel mysql_main configured to support TLS - pattern should be present.
230 --let $grep_pattern=Channel mysql_main configured to support TLS.*
231 --let $grep_output=boolean
232 --source include/grep_pattern.inc
233
234 --echo # check for Channel mysql_admin configured to support TLS - pattern should not be present.
235 --let $grep_pattern=Channel mysql_admin configured to support TLS.*
236 --let $grep_output=boolean
237 --source include/grep_pattern.inc
238
239
240 --echo # Setting admin certs
241 --disable_query_log
242 --eval SET GLOBAL admin_ssl_ca = '$MYSQL_TEST_DIR/std_data/cacert.pem'
243 --eval SET GLOBAL admin_ssl_cert = '$MYSQL_TEST_DIR/std_data/server-cert.pem'
244 --eval SET GLOBAL admin_ssl_key = '$MYSQL_TEST_DIR/std_data/server-key.pem'
245 --enable_query_log
246 --echo # Configure TLS for admin channel
247 ALTER INSTANCE RELOAD TLS FOR CHANNEL mysql_admin;
248
249 --echo # Connect through admin channel using TLS - should be a success.
250 --echo MYSQL --host=127.0.0.1 --port=MASTER_ADMINPORT --user=root --ssl-mode=REQUIRED -e "SELECT 1"
251 --exec $MYSQL --host=127.0.0.1 --port=$MASTER_ADMINPORT --user=root --ssl-mode=REQUIRED -e "SELECT 1"
252
253 --echo # shut server down
254 --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
255 --shutdown_server
256 --source include/wait_until_disconnected.inc
257 --echo # Server is down
258
259 --echo # close the test connection
260 connection default;
261 disconnect root_con;
262
263 --echo # delete mysqld log
264 remove_file $MYSQLD_LOG;
265
266 --echo # -----------------------------------------------------------------------
267 --echo #
268 --echo # Restart server with --datadir=DDIR --admin-address=127.0.0.1 --skip-ssl
269 --echo #
270
271 --exec echo "restart:--log-error=$MYSQLD_LOG --datadir=$DDIR --admin-address=127.0.0.1 --skip-ssl" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
272 --enable_reconnect
273 --source include/wait_until_connected_again.inc
274
275 --echo # connect as root
276 connect(root_con,localhost,root,,mysql);
277
278 --echo # check for Failed to initialize TSL for channel: mysql_admin - pattern should be present.
279 --let $grep_file=$MYSQLD_LOG
280 --let $grep_pattern=Failed to initialize TLS for channel: mysql_admin. See below for the description of exact issue.
281 --let $grep_output=boolean
282 --source include/grep_pattern.inc
283
284 --echo # check for No TLS configuration was given for channel mysql_admin - pattern should not be present.
285 --let $grep_pattern=No TLS configuration was given for channel mysql_admin.*
286 --let $grep_output=boolean
287 --source include/grep_pattern.inc
288
289 --echo # check for Channel mysql_main configured to support TLS - pattern should not be present.
290 --let $grep_pattern=Channel mysql_main configured to support TLS.*
291 --let $grep_output=boolean
292 --source include/grep_pattern.inc
293
294 --echo # check for Channel mysql_admin configured to support TLS - pattern should not be present.
295 --let $grep_pattern=Channel mysql_admin configured to support TLS.*
296 --let $grep_output=boolean
297 --source include/grep_pattern.inc
298
299 --echo # shut server down
300 --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
301 --shutdown_server
302 --source include/wait_until_disconnected.inc
303 --echo # Server is down
304
305 --echo # close the test connection
306 connection default;
307 disconnect root_con;
308
309 --echo # delete mysqld log
310 remove_file $MYSQLD_LOG;
311
312 --echo # -----------------------------------------------------------------------
313 --echo #
314 --echo # Restart server with --datadir=DDIR --admin-address=127.0.0.1 --admin-ssl*
315 --echo #
316
317 --exec echo "restart:--log-error=$MYSQLD_LOG --datadir=$DDIR --admin-address=127.0.0.1 --admin-ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --admin-ssl-cert=$MYSQL_TEST_DIR/std_data/server-cert.pem --admin-ssl-key=$MYSQL_TEST_DIR/std_data/server-key.pem" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
318 --enable_reconnect
319 --source include/wait_until_connected_again.inc
320
321 --echo # connect as root
322 connect(root_con,localhost,root,,mysql);
323
324 --echo # check for Failed to initialize TSL for channel: mysql_admin - pattern should not be present.
325 --let $grep_file=$MYSQLD_LOG
326 --let $grep_pattern=Failed to initialize TLS for channel: mysql_admin. See below for the description of exact issue.
327 --let $grep_output=boolean
328 --source include/grep_pattern.inc
329
330 --echo # check for No TLS configuration was given for channel mysql_admin - pattern should not be present.
331 --let $grep_pattern=No TLS configuration was given for channel mysql_admin.*
332 --let $grep_output=boolean
333 --source include/grep_pattern.inc
334
335 --echo # check for Channel mysql_main configured to support TLS - pattern should be present.
336 --let $grep_pattern=Channel mysql_main configured to support TLS.*
337 --let $grep_output=boolean
338 --source include/grep_pattern.inc
339
340 --echo # check for Channel mysql_admin configured to support TLS - pattern should be present.
341 --let $grep_pattern=Channel mysql_admin configured to support TLS.*
342 --let $grep_output=boolean
343 --source include/grep_pattern.inc
344
345 --echo # shut server down
346 --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
347 --shutdown_server
348 --source include/wait_until_disconnected.inc
349 --echo # Server is down
350
351 --echo # close the test connection
352 connection default;
353 disconnect root_con;
354
355 --echo # delete mysqld log
356 remove_file $MYSQLD_LOG;
357
358 --echo # delete datadir
359 --force-rmdir $DDIR
360
361 --echo # delete bootstrap file
362 remove_file $BOOTSTRAP_SQL;
363
364 --echo #
365 --echo # Cleanup
366 --echo #
367 --echo # Restarting the server
368 --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
369 --enable_reconnect
370 --source include/wait_until_connected_again.inc