Debian Codegraph @

mysql-test/suite/x/t/connection_auth_sequence_fatal_error.test

raw
1 ## Test cases for errors returned in authentication sequence
2
3 --source include/xplugin_preamble.inc
4
5 #
6 ## Setup
7 #
8
9 call mtr.add_suppression("Maximum number of authentication attempts reached");
10 call mtr.add_suppression("Access denied for user .*");
11
12 --write_file $MYSQL_TMP_DIR/auth_seq_simple.xpl
13 -->import connection.macro
14
15 newsession seq -;
16 quiet;
17 callmacro Verify_its_xprotocol_connection;
18 callmacro Enable_ssl_on_xprotocol_and_transmision_layer;
19 noquiet;
20
21 -->echo
22 -->echo # First authentication attempt
23 Mysqlx.Session.AuthenticateStart {
24 mech_name: "%AUTH1%"
25 auth_data: "test\0not_existing_user\0invalid_password"
26 }
27 recvtype Mysqlx.Error severity ERROR;
28
29 -->echo
30 -->echo # Second authentication attempt
31 Mysqlx.Session.AuthenticateStart {
32 mech_name: "%AUTH2%"
33 auth_data: "test\0not_existing_user\0invalid_password"
34 }
35 -->recvtype Mysqlx.Error severity ERROR
36
37 -->echo
38 -->echo # Third authentication attempt (last one)
39 Mysqlx.Session.AuthenticateStart {
40 mech_name: "%AUTH3%"
41 auth_data: "test\0not_existing_user\0invalid_password"
42 }
43 -->recvtype Mysqlx.Error severity FATAL
44
45 peerdisc 30000 30000;
46
47 EOF
48
49 --write_file $MYSQL_TMP_DIR/auth_seq_changle.xpl
50 -->import connection.macro
51 newsession seq -;
52 quiet;
53 callmacro Verify_its_xprotocol_connection;
54 callmacro Enable_ssl_on_xprotocol_and_transmision_layer;
55 noquiet;
56
57 -->echo
58 -->echo # First authentication attempt
59 Mysqlx.Session.AuthenticateStart {
60 mech_name: "%AUTH1%"
61 }
62
63 recvtype Mysqlx.Session.AuthenticateContinue be-quiet;
64 echo Mysqlx.Session.AuthenticateContinue {...};
65
66 Mysqlx.Session.AuthenticateContinue {
67 auth_data: "test\0not_existing_user\0invalid_scramble"
68 }
69 recvtype Mysqlx.Error severity ERROR;
70
71
72 -->echo
73 -->echo # Second authentication attempt
74 Mysqlx.Session.AuthenticateStart {
75 mech_name: "%AUTH2%"
76 }
77
78 recvtype Mysqlx.Session.AuthenticateContinue be-quiet;
79 echo Mysqlx.Session.AuthenticateContinue {...};
80
81 Mysqlx.Session.AuthenticateContinue {
82 auth_data: "test\0not_existing_user\0invalid_scramble"
83 }
84 recvtype Mysqlx.Error severity ERROR;
85
86
87 -->echo
88 -->echo # Third authentication attempt (last one)
89 Mysqlx.Session.AuthenticateStart {
90 mech_name: "%AUTH3%"
91 }
92
93 recvtype Mysqlx.Session.AuthenticateContinue be-quiet;
94 echo Mysqlx.Session.AuthenticateContinue {...};
95
96 Mysqlx.Session.AuthenticateContinue {
97 auth_data: "test\0not_existing_user\0invalid_scramble"
98 }
99 recvtype Mysqlx.Error severity FATAL;
100
101
102 peerdisc 30000 30000;
103
104 EOF
105
106 --write_file $MYSQL_TMP_DIR/auth_seq_three_different.xpl
107 -->import connection.macro
108 newsession seq -;
109 quiet;
110 callmacro Verify_its_xprotocol_connection;
111 callmacro Enable_ssl_on_xprotocol_and_transmision_layer;
112 noquiet;
113
114 -->echo
115 -->echo # First authentication attempt
116 Mysqlx.Session.AuthenticateStart {
117 mech_name: "%AUTH1%"
118 }
119
120 recvtype Mysqlx.Session.AuthenticateContinue be-quiet;
121 echo Mysqlx.Session.AuthenticateContinue {...};
122
123 Mysqlx.Session.AuthenticateContinue {
124 auth_data: "test\0not_existing_user\0invalid_scramble"
125 }
126 recvtype Mysqlx.Error severity ERROR;
127
128
129 -->echo
130 -->echo # Second authentication attempt
131 Mysqlx.Session.AuthenticateStart {
132 mech_name: "%AUTH2%"
133 }
134
135 recvtype Mysqlx.Session.AuthenticateContinue be-quiet;
136 echo Mysqlx.Session.AuthenticateContinue {...};
137
138 Mysqlx.Session.AuthenticateContinue {
139 auth_data: "test\0not_existing_user\0invalid_scramble"
140 }
141 recvtype Mysqlx.Error severity ERROR;
142
143
144 -->echo
145 -->echo # Third authentication attempt (last one)
146 Mysqlx.Session.AuthenticateStart {
147 mech_name: "%AUTH3%"
148 auth_data: "test\0not_existing_user\0invalid_password"
149 }
150 -->recvtype Mysqlx.Error severity FATAL
151
152
153 peerdisc 30000 30000;
154
155 EOF
156
157 --write_file $MYSQL_TMP_DIR/auth_seq_invalid_msg.xpl
158 -->import connection.macro
159 callmacro Verify_its_xprotocol_connection;
160 %MESSAGE_NAME% {
161 %MESSAGE_FIELD% : "not meaningful field payload"
162 }
163
164 recvtype Mysqlx.Error severity FATAL;
165 peerdisc 30000 30000;
166 EOF
167
168 --let $MYSQLXTEST=$MYSQLXTEST -uroot --ssl-mode=REQUIRED
169
170
171 #
172 ## Test starts here
173 #
174
175 --echo
176 --echo
177 --echo #
178 --echo ## Execute three "PLAIN" authentications
179 --echo ## checking severity of returned errors (last one must be FATAL)
180 --echo #
181 exec $MYSQLXTEST --file=$MYSQL_TMP_DIR/auth_seq_simple.xpl -v%AUTH1%=PLAIN -v%AUTH2%=PLAIN -v%AUTH3%=PLAIN 2>&1;
182
183 --echo
184 --echo
185 --echo #
186 --echo ## Execute three "SHA256_MEMORY" authentications
187 --echo ## checking severity of returned errors (last one must be FATAL)
188 --echo #
189 exec $MYSQLXTEST --file=$MYSQL_TMP_DIR/auth_seq_changle.xpl -v%AUTH1%=SHA256_MEMORY -v%AUTH2%=SHA256_MEMORY -v%AUTH3%=SHA256_MEMORY 2>&1;
190
191 --echo
192 --echo
193 --echo #
194 --echo ## Execute three mixed authentications
195 --echo ## checking severity of returned errors (last one must be FATAL)
196 --echo #
197 exec $MYSQLXTEST --file=$MYSQL_TMP_DIR/auth_seq_changle.xpl -v%AUTH1%=MYSQL41 -v%AUTH2%=SHA256_MEMORY -v%AUTH3%=MYSQL41 2>&1;
198
199 --echo
200 --echo
201 --echo #
202 --echo ## Execute "SHA256_MEMORY", "MYSQL41", "PLAIN"
203 --echo ## checking severity of returned errors (last one must be FATAL)
204 --echo #
205 exec $MYSQLXTEST --file=$MYSQL_TMP_DIR/auth_seq_three_different.xpl -v%AUTH1%=SHA256_MEMORY -v%AUTH2%=MYSQL41 -v%AUTH3%=PLAIN 2>&1;
206
207
208 --echo
209 --echo
210 --echo #
211 --echo ## Verify that AuthenticateContinue message instead AuthStart
212 --echo ## will trigger FATAL error and disconnection
213 --echo #
214 exec $MYSQLXTEST
215 --file=$MYSQL_TMP_DIR/auth_seq_invalid_msg.xpl
216 -v%MESSAGE_NAME%=Mysqlx.Session.AuthenticateContinue
217 -v%MESSAGE_FIELD%=auth_data
218 --no-auth 2>&1;
219
220 --echo
221 --echo
222 --echo #
223 --echo ## Verify that StmtExecute message instead AuthStart
224 --echo ## will trigger FATAL error and disconnection
225 --echo #
226 exec $MYSQLXTEST
227 --file=$MYSQL_TMP_DIR/auth_seq_invalid_msg.xpl
228 -v%MESSAGE_NAME%=Mysqlx.Sql.StmtExecute
229 -v%MESSAGE_FIELD%=stmt
230 --no-auth 2>&1;
231 #
232 ## Postamble
233 #
234 --source ../include/xplugin_cleanup.inc