Debian Codegraph @

mysql-test/suite/auth_sec/t/server_withssl_client_withoutssl.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 SSL and client #
5 # is connected without 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 SSL and client started without 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 CREATE USER 'Tanjotuser1'@'localhost' IDENTIFIED WITH 'mysql_native_password';
50
51 set password for 'Tanjotuser1'@'localhost' = 'abc';
52
53
54 # Trying connecting the client with the mysql_native_password user with out the SSL credentials.
55
56 --echo **** connecting client using the ssl credentials
57 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc -e "select current_user()"
58
59
60 --echo **** connecting client using the ssl credentials
61 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=mysql_native_password -e "select current_user()"
62
63 --echo **** connecting client using the ssl credentials
64 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=sha256_password -e "select current_user()"
65
66
67 # Trying connecting the client with the mysql_native_password user with out the SSL credentials with.
68
69 --echo **** connecting client using the ssl credentials
70 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc -e "select current_user()"
71
72 --echo **** connecting client using the ssl credentials
73 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=mysql_native_password -e "select current_user()"
74
75 --echo **** connecting client using the ssl credentials
76 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=sha256_password -e "select current_user()"
77
78
79 # Dropping the created users
80
81 DROP USER 'Tanjotuser1'@'localhost';
82
83
84
85 --echo
86 --echo
87 --echo ======================================================================================
88 --echo Checking the user access with SSL through user created with sha256_password plugin
89 --echo ======================================================================================
90 --echo
91
92 # Creating a user at localhost with sha256_password plugin
93
94 --echo Creating a user with the sha256_password
95
96 CREATE USER 'Tanjotuser1'@'localhost' IDENTIFIED WITH 'sha256_password';
97
98 set password for 'Tanjotuser1'@'localhost' = 'abc';
99
100
101 # Trying connecting the client with the sha256_password user with out the SSL credentials.
102
103 --echo **** connecting client using the ssl credentials
104 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc -e "select current_user()"
105
106
107 --echo **** connecting client using the ssl credentials
108 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=mysql_native_password -e "select current_user()"
109
110
111 --echo **** connecting client using the ssl credentials
112 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=sha256_password -e "select current_user()"
113
114
115 # Trying connecting the client with the sha256_password user with out the SSL credentials.
116
117 --echo **** connecting client using the ssl credentials
118 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc -e "select current_user()"
119
120
121 --echo **** connecting client using the ssl credentials
122 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=mysql_native_password -e "select current_user()"
123
124
125 --echo **** connecting client using the ssl credentials
126 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=sha256_password -e "select current_user()"
127
128
129 # Dropping the created users
130
131 DROP USER 'Tanjotuser1'@'localhost';
132
133
134
135 --echo
136 --echo
137 --echo =================================================================================================
138 --echo Starting the server with the default authentication sha256_password
139 --echo =================================================================================================
140 --echo
141
142 --echo # Restart server with default-authentication-plugin=sha256_password;
143
144 let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
145 --exec echo "wait" > $restart_file
146 --shutdown_server
147 --source include/wait_until_disconnected.inc
148 -- exec echo "restart:--default-authentication-plugin=sha256_password " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
149 -- enable_reconnect
150 -- source include/wait_until_connected_again.inc
151
152
153 --echo
154 --echo
155 --echo ======================================================================================
156 --echo Checking the user access with SSL through user created with mysql_native_password plugin
157 --echo ======================================================================================
158 --echo
159
160 # Creating a user at localhost with mysql_native_password plugin
161
162 --echo Creating a user with the mysql_native_password
163
164 CREATE USER 'Tanjotuser1'@'localhost' IDENTIFIED WITH 'mysql_native_password';
165
166 set password for 'Tanjotuser1'@'localhost' = 'abc';
167
168
169 # Trying connecting the client with the mysql_native_password user with out the SSL credentials.
170
171 --echo **** connecting client using the ssl credentials
172 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc -e "select current_user()"
173 --echo 2 for GLOBAL Expected
174 --echo 0 for SESSION Expected
175
176
177 --echo **** connecting client using the ssl credentials
178 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=mysql_native_password -e "select current_user()"
179 --echo 2 for GLOBAL Expected
180 --echo 0 for SESSION Expected
181
182
183 --echo **** connecting client using the ssl credentials
184 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=sha256_password -e "select current_user()"
185 --echo 2 for GLOBAL Expected
186 --echo 0 for SESSION Expected
187
188
189
190 # Trying connecting the client with the mysql_native_password user with out the SSL credentials.
191
192 --echo **** connecting client using the ssl credentials
193 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc -e "select current_user()"
194 --echo 2 for GLOBAL Expected
195 --echo 0 for SESSION Expected
196
197
198 --echo **** connecting client using the ssl credentials
199 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=mysql_native_password -e "select current_user()"
200 --echo 2 for GLOBAL Expected
201 --echo 0 for SESSION Expected
202
203
204 --echo **** connecting client using the ssl credentials
205 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=sha256_password -e "select current_user()"
206 --echo 2 for GLOBAL Expected
207 --echo 0 for SESSION Expected
208
209
210 # Dropping the created users
211
212 DROP USER 'Tanjotuser1'@'localhost';
213
214
215
216 --echo
217 --echo
218 --echo ======================================================================================
219 --echo Checking the user access with SSL through user created with sha256_password plugin
220 --echo ======================================================================================
221 --echo
222
223 # Creating a user at localhost with sha256_password plugin
224
225 --echo Creating a user with the sha256_plugin
226
227 CREATE USER 'Tanjotuser1'@'localhost' IDENTIFIED WITH 'sha256_password';
228
229 set password for 'Tanjotuser1'@'localhost' = 'abc';
230
231 GRANT ALL on *.* to 'Tanjotuser1'@'localhost';
232
233 # Trying connecting the client with the sha256_password user without the SSL credentials.
234
235 --echo **** connecting client using the ssl credentials
236 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc -e "select current_user()"
237 --echo 2 for GLOBAL Expected
238 --echo 2 for SESSION Expected
239
240
241 --echo **** connecting client using the ssl credentials
242 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=mysql_native_password -e "select current_user()"
243 --echo 2 for GLOBAL Expected
244 --echo 2 for SESSION Expected
245
246
247 --echo **** connecting client using the ssl credentials
248 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=sha256_password -e "select current_user()"
249 --echo 2 for GLOBAL Expected
250 --echo 2 for SESSION Expected
251
252
253 # Trying connecting the client with the sha256_password user without the SSL credentials.
254
255 --echo **** connecting client using the ssl credentials
256 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc -e "select current_user()"
257 --echo 2 for GLOBAL Expected
258 --echo 2 for SESSION Expected
259
260
261 --echo **** connecting client using the ssl credentials
262 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=mysql_native_password -e "select current_user()"
263 --echo 2 for GLOBAL Expected
264 --echo 2 for SESSION Expected
265
266
267 --echo **** connecting client using the ssl credentials
268 --exec $MYSQL -uTanjotuser1 -hlocalhost -pabc --default_auth=sha256_password -e "select current_user()"
269 --echo 2 for GLOBAL Expected
270 --echo 2 for SESSION Expected
271
272 # Trying connecting the client with the mysql_native_password user without the SSL credentials.
273
274 # Dropping the created users
275
276 DROP USER 'Tanjotuser1'@'localhost';
277
278 # Restore default settings in opt file and clean up
279 --let $restart_parameters = restart:
280 --source include/restart_mysqld.inc