Debian Codegraph @

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

raw
1 ###############################################################################
2 # #
3 # Authorization and authentication of the key-value pair shared between #
4 # the server and the client when server is started with open SSL and client #
5 # is connected with SSL #
6 # #
7 # #
8 # Creation Date: 2012-12-20 #
9 # Author : Tanjot Singh Uppal #
10 # #
11 # #
12 # Description:Test Cases of validates the authentication of the handshake #
13 # information when server started with open SSL and client started with SSL #
14 # #
15 ###############################################################################
16
17
18 let $crllen=`select length(trim(coalesce(@@ssl_crl, ''))) + length(trim(coalesce(@@ssl_crlpath, '')))`;
19 if (!$crllen)
20 {
21 skip Needs OpenSSL;
22 }
23
24
25 # This test will intentionally generate errors in the server error log
26 # when a broken password is inserted into the mysql.user table.
27 # The below suppression is to clear those errors.
28
29 --disable_query_log
30 call mtr.add_suppression(".*Password salt for user.*");
31 --enable_query_log
32
33 --disable_query_log
34 call mtr.add_suppression(".*SSL.*");
35 --enable_query_log
36
37
38 # The default authentication plugin at the server side is mysql_native_password
39
40 --echo
41 --echo
42 --echo ======================================================================================
43 --echo Checking the user access with SSL through user created with mysql_native_password plugin
44 --echo ======================================================================================
45 --echo
46
47 # Creating a user at localhost with mysql_native_password plugin
48
49 --echo Creating a user with the mysql_native_plugin
50
51 CREATE USER 'Tanjotuser1'@'localhost' IDENTIFIED WITH 'mysql_native_password';
52
53 set password for 'Tanjotuser1'@'localhost' = 'abc';
54
55 GRANT ALL on *.* to 'Tanjotuser1'@'localhost';
56
57 # Trying connecting the client with the mysql_native_password user with the SSL credentials.
58
59 --echo **** connecting client using the ssl credentials
60 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem -e "select current_user()"
61
62
63 --echo **** connecting client using the ssl credentials
64 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=mysql_native_password --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem -e "select current_user()"
65
66
67 --echo **** connecting client using the ssl credentials
68 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=sha256_password --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem -e "select current_user()"
69
70
71
72 # Trying connecting the client with the mysql_native_password user with the SSL credentials.
73
74 --echo **** connecting client using the ssl credentials
75 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem -e "select current_user()"
76
77
78 --echo **** connecting client using the ssl credentials
79 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=mysql_native_password --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem -e "select current_user()"
80
81
82 --echo **** connecting client using the ssl credentials
83 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=sha256_password --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem -e "select current_user()"
84
85
86 # Dropping the created users
87
88 DROP USER 'Tanjotuser1'@'localhost';
89
90
91
92 --echo
93 --echo
94 --echo ======================================================================================
95 --echo Checking the user access with SSL through user created with sha256_password plugin
96 --echo ======================================================================================
97 --echo
98
99 # Creating a user at localhost with sha256_password plugin
100
101 --echo Creating a user with the sha256_password plugin
102
103 CREATE USER 'Tanjotuser1'@'localhost' IDENTIFIED WITH 'sha256_password';
104
105 set password for 'Tanjotuser1'@'localhost' = 'abc';
106
107 GRANT ALL on *.* to 'Tanjotuser1'@'localhost';
108
109 # Trying connecting the client with the sha256_password user with the SSL credentials.
110
111 --echo **** connecting client using the ssl credentials
112 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem -e "select current_user()"
113
114
115 --echo **** connecting client using the ssl credentials
116 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=mysql_native_password --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem -e "select current_user()"
117
118
119 --echo **** connecting client using the ssl credentials
120 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=sha256_password --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem -e "select current_user()"
121
122
123
124 # Trying connecting the client with the sha256_password user with the SSL credentials.
125
126 --echo **** connecting client using the ssl credentials
127 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem -e "select current_user()"
128
129
130 --echo **** connecting client using the ssl credentials
131 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=mysql_native_password --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem -e "select current_user()"
132
133
134 --echo **** connecting client using the ssl credentials
135 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=sha256_password --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem -e "select current_user()"
136
137
138 # Dropping the created users
139
140 DROP USER 'Tanjotuser1'@'localhost';
141
142
143
144 --echo
145 --echo
146 --echo =================================================================================================
147 --echo Starting the server with the default authentication sha256_password
148 --echo =================================================================================================
149 --echo
150
151 --echo # Restart server with default-authentication-plugin=sha256_password;
152
153 let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
154 --exec echo "wait" > $restart_file
155 --shutdown_server
156 --source include/wait_until_disconnected.inc
157 -- exec echo "restart:--default-authentication-plugin=sha256_password " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
158 -- enable_reconnect
159 -- source include/wait_until_connected_again.inc
160
161
162 --echo
163 --echo
164 --echo ======================================================================================
165 --echo Checking the user access with SSL through user created with mysql_native_password plugin
166 --echo ======================================================================================
167 --echo
168
169 # Creating a user at localhost with mysql_native_password plugin
170
171 --echo Creating a user with the mysql_old_plugin
172
173 CREATE USER 'Tanjotuser1'@'localhost' IDENTIFIED WITH 'mysql_native_password';
174
175 set password for 'Tanjotuser1'@'localhost' = 'abc';
176
177 GRANT ALL on *.* to 'Tanjotuser1'@'localhost';
178
179 # Trying connecting the client with the mysql_native_password user with the SSL credentials.
180
181 --echo **** connecting client using the ssl credentials
182 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem -e "select current_user()"
183
184
185 --echo **** connecting client using the ssl credentials
186 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=mysql_native_password --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem -e "select current_user()"
187
188
189 --echo **** connecting client using the ssl credentials
190 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=sha256_password --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem -e "select current_user()"
191
192
193
194 # Trying connecting the client with the mysql_native_password user with the SSL credentials.
195
196 --echo **** connecting client using the ssl credentials
197 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem -e "select current_user()"
198
199
200 --echo **** connecting client using the ssl credentials
201 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=mysql_native_password --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem -e "select current_user()"
202
203
204 --echo **** connecting client using the ssl credentials
205 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=sha256_password --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem -e "select current_user()"
206
207
208 # Dropping the created users
209
210 DROP USER 'Tanjotuser1'@'localhost';
211
212
213
214 --echo
215 --echo
216 --echo ======================================================================================
217 --echo Checking the user access with SSL through user created with sha256_password plugin
218 --echo ======================================================================================
219 --echo
220
221 # Creating a user at localhost with sha256_password plugin
222
223 --echo Creating a user with the sha256_plugin
224
225 CREATE USER 'Tanjotuser1'@'localhost' IDENTIFIED WITH 'sha256_password';
226
227 set password for 'Tanjotuser1'@'localhost' = 'abc';
228
229 GRANT ALL on *.* to 'Tanjotuser1'@'localhost';
230
231 # Trying connecting the client with the sha256_password user with the SSL credentials.
232
233 --echo **** connecting client using the ssl credentials
234 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem -e "select current_user()"
235 --echo 2 for GLOBAL Expected
236 --echo 2 for SESSION Expected
237
238
239 --echo **** connecting client using the ssl credentials
240 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=mysql_native_password --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem -e "select current_user()"
241 --echo 2 for GLOBAL Expected
242 --echo 2 for SESSION Expected
243
244 # Below section is hased out till Bug #16048665 is fixed
245
246 #--echo **** connecting client using the ssl credentials
247 #--exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=sha256_password --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem -e "select current_user()"
248 #--echo 2 for GLOBAL Expected
249 #--echo 2 for SESSION Expected
250
251
252 # Trying connecting the client with the sha256_password user with the SSL credentials.
253
254 --echo **** connecting client using the ssl credentials
255 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem -e "select current_user()"
256 --echo 2 for GLOBAL Expected
257 --echo 2 for SESSION Expected
258
259
260 --echo **** connecting client using the ssl credentials
261 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=mysql_native_password --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem -e "select current_user()"
262 --echo 2 for GLOBAL Expected
263 --echo 2 for SESSION Expected
264
265
266 # Below section is hased out till Bug #16048665 is fixed
267
268 #--echo **** connecting client using the ssl credentials
269 #--exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=sha256_password --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem -e "select current_user()"
270 #--echo 2 for GLOBAL Expected
271 #--echo 2 for SESSION Expected
272
273
274 # Dropping the created users
275
276 DROP USER 'Tanjotuser1'@'localhost';
277
278 # Restore default settings in opt file
279 --let $restart_parameters = restart:
280 --source include/restart_mysqld.inc