|
| 1 | +CREATE DATABASE test_user_db; |
| 2 | +SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; |
| 3 | +user plugin authentication_string |
| 4 | +========== test 1.1.3.2 ==================================== |
| 5 | +CREATE USER plug_user IDENTIFIED WITH test_plugin_server AS 'plug_dest'; |
| 6 | +CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; |
| 7 | +GRANT PROXY ON plug_dest TO plug_user; |
| 8 | +current_user() |
| 9 | +plug_dest@% |
| 10 | +user() |
| 11 | +plug_user@localhost |
| 12 | +Tables_in_test_user_db |
| 13 | +t1 |
| 14 | +REVOKE PROXY ON plug_dest FROM plug_user; |
| 15 | +ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES) |
| 16 | +DROP USER plug_user,plug_dest; |
| 17 | +GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user |
| 18 | +IDENTIFIED WITH test_plugin_server AS 'plug_dest'; |
| 19 | +GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd'; |
| 20 | +GRANT PROXY ON plug_dest TO plug_user; |
| 21 | +SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; |
| 22 | +user plugin authentication_string |
| 23 | +plug_dest |
| 24 | +plug_user test_plugin_server plug_dest |
| 25 | +1) |
| 26 | +current_user() |
| 27 | +plug_dest@% |
| 28 | +user() |
| 29 | +plug_user@localhost |
| 30 | +Tables_in_test_user_db |
| 31 | +t1 |
| 32 | +REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_user' |
| 33 | + IDENTIFIED WITH test_plugin_server AS 'plug_dest'; |
| 34 | +2) |
| 35 | +current_user() |
| 36 | +plug_dest@% |
| 37 | +user() |
| 38 | +plug_user@localhost |
| 39 | +Tables_in_test_user_db |
| 40 | +t1 |
| 41 | +REVOKE PROXY ON plug_dest FROM plug_user; |
| 42 | +3) |
| 43 | +ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES) |
| 44 | +DROP USER plug_user,plug_dest; |
| 45 | +GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user |
| 46 | +IDENTIFIED WITH test_plugin_server AS 'plug_dest'; |
| 47 | +CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; |
| 48 | +1) |
| 49 | +ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES) |
| 50 | +GRANT PROXY ON plug_dest TO plug_user; |
| 51 | +2) |
| 52 | +current_user() |
| 53 | +plug_dest@% |
| 54 | +user() |
| 55 | +plug_user@localhost |
| 56 | +Tables_in_test_user_db |
| 57 | +t1 |
| 58 | +REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_user' |
| 59 | + IDENTIFIED WITH test_plugin_server AS 'plug_dest'; |
| 60 | +DROP USER plug_user,plug_dest; |
| 61 | +========== test 1.2 ======================================== |
| 62 | +GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user |
| 63 | +IDENTIFIED WITH test_plugin_server AS 'plug_dest'; |
| 64 | +CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; |
| 65 | +GRANT PROXY ON plug_dest TO plug_user; |
| 66 | +current_user() |
| 67 | +plug_dest@% |
| 68 | +user() |
| 69 | +plug_user@localhost |
| 70 | +RENAME USER plug_dest TO new_dest; |
| 71 | +ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES) |
| 72 | +GRANT PROXY ON new_dest TO plug_user; |
| 73 | +ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES) |
| 74 | +SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; |
| 75 | +user plugin authentication_string |
| 76 | +new_dest |
| 77 | +plug_user test_plugin_server plug_dest |
| 78 | +DROP USER plug_user,new_dest; |
| 79 | +CREATE USER plug_user |
| 80 | +IDENTIFIED WITH test_plugin_server AS 'plug_dest'; |
| 81 | +CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; |
| 82 | +ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES) |
| 83 | +GRANT PROXY ON plug_dest TO plug_user; |
| 84 | +current_user() |
| 85 | +plug_dest@% |
| 86 | +user() |
| 87 | +plug_user@localhost |
| 88 | +RENAME USER plug_dest TO new_dest; |
| 89 | +ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES) |
| 90 | +GRANT PROXY ON new_dest TO plug_user; |
| 91 | +ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES) |
| 92 | +SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; |
| 93 | +user plugin authentication_string |
| 94 | +new_dest |
| 95 | +plug_user test_plugin_server plug_dest |
| 96 | +DROP USER plug_user,new_dest; |
| 97 | +CREATE USER plug_user |
| 98 | +IDENTIFIED WITH test_plugin_server AS 'plug_dest'; |
| 99 | +CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; |
| 100 | +GRANT PROXY ON plug_dest TO plug_user; |
| 101 | +connect(plug_user,localhost,plug_user,plug_dest); |
| 102 | +select USER(),CURRENT_USER(); |
| 103 | +USER() CURRENT_USER() |
| 104 | +plug_user@localhost plug_dest@% |
| 105 | +connection default; |
| 106 | +disconnect plug_user; |
| 107 | +RENAME USER plug_user TO new_user; |
| 108 | +connect(plug_user,localhost,new_user,plug_dest); |
| 109 | +select USER(),CURRENT_USER(); |
| 110 | +USER() CURRENT_USER() |
| 111 | +new_user@localhost plug_dest@% |
| 112 | +connection default; |
| 113 | +SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; |
| 114 | +user plugin authentication_string |
| 115 | +new_user test_plugin_server plug_dest |
| 116 | +plug_dest |
| 117 | +disconnect plug_user; |
| 118 | +UPDATE mysql.user SET user='plug_user' WHERE user='new_user'; |
| 119 | +FLUSH PRIVILEGES; |
| 120 | +SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; |
| 121 | +user plugin authentication_string |
| 122 | +plug_dest |
| 123 | +plug_user test_plugin_server plug_dest |
| 124 | +DROP USER plug_dest,plug_user; |
| 125 | +========== test 1.3 ======================================== |
| 126 | +CREATE USER plug_user |
| 127 | +IDENTIFIED WITH test_plugin_server AS 'plug_dest'; |
| 128 | +CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; |
| 129 | +GRANT PROXY ON plug_dest TO plug_user; |
| 130 | +connect(plug_user,localhost,plug_user,plug_dest); |
| 131 | +select USER(),CURRENT_USER(); |
| 132 | +USER() CURRENT_USER() |
| 133 | +plug_user@localhost plug_dest@% |
| 134 | +connection default; |
| 135 | +disconnect plug_user; |
| 136 | +SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; |
| 137 | +user plugin authentication_string |
| 138 | +plug_dest |
| 139 | +plug_user test_plugin_server plug_dest |
| 140 | +UPDATE mysql.user SET user='new_user' WHERE user='plug_user'; |
| 141 | +FLUSH PRIVILEGES; |
| 142 | +SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; |
| 143 | +user plugin authentication_string |
| 144 | +new_user test_plugin_server plug_dest |
| 145 | +plug_dest |
| 146 | +UPDATE mysql.user SET authentication_string='new_dest' WHERE user='new_user'; |
| 147 | +FLUSH PRIVILEGES; |
| 148 | +SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; |
| 149 | +user plugin authentication_string |
| 150 | +new_user test_plugin_server new_dest |
| 151 | +plug_dest |
| 152 | +UPDATE mysql.user SET plugin='new_plugin_server' WHERE user='new_user'; |
| 153 | +FLUSH PRIVILEGES; |
| 154 | +SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; |
| 155 | +user plugin authentication_string |
| 156 | +new_user new_plugin_server new_dest |
| 157 | +plug_dest |
| 158 | +connect(plug_user,localhost,new_user,new_dest); |
| 159 | +ERROR HY000: Plugin 'new_plugin_server' is not loaded |
| 160 | +UPDATE mysql.user SET plugin='test_plugin_server' WHERE user='new_user'; |
| 161 | +UPDATE mysql.user SET USER='new_dest' WHERE user='plug_dest'; |
| 162 | +FLUSH PRIVILEGES; |
| 163 | +GRANT PROXY ON new_dest TO new_user; |
| 164 | +SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; |
| 165 | +user plugin authentication_string |
| 166 | +new_dest |
| 167 | +new_user test_plugin_server new_dest |
| 168 | +connect(plug_user,localhost,new_user,new_dest); |
| 169 | +select USER(),CURRENT_USER(); |
| 170 | +USER() CURRENT_USER() |
| 171 | +new_user@localhost new_dest@% |
| 172 | +connection default; |
| 173 | +disconnect plug_user; |
| 174 | +UPDATE mysql.user SET USER='plug_dest' WHERE user='new_dest'; |
| 175 | +FLUSH PRIVILEGES; |
| 176 | +CREATE USER new_dest IDENTIFIED BY 'new_dest_passwd'; |
| 177 | +SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; |
| 178 | +user plugin authentication_string |
| 179 | +new_dest |
| 180 | +new_user test_plugin_server new_dest |
| 181 | +plug_dest |
| 182 | +GRANT ALL PRIVILEGES ON test.* TO new_user; |
| 183 | +connect(plug_user,localhost,new_dest,new_dest_passwd); |
| 184 | +select USER(),CURRENT_USER(); |
| 185 | +USER() CURRENT_USER() |
| 186 | +new_dest@localhost new_dest@% |
| 187 | +connection default; |
| 188 | +disconnect plug_user; |
| 189 | +DROP USER new_user,new_dest,plug_dest; |
| 190 | +========== test 2, 2.1, 2.2 ================================ |
| 191 | +CREATE USER ''@'' IDENTIFIED WITH test_plugin_server AS 'proxied_user'; |
| 192 | +CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd'; |
| 193 | +SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; |
| 194 | +user plugin authentication_string |
| 195 | + test_plugin_server proxied_user |
| 196 | +proxied_user |
| 197 | +connect(proxy_con,localhost,proxied_user,proxied_user_passwd); |
| 198 | +SELECT USER(),CURRENT_USER(); |
| 199 | +USER() CURRENT_USER() |
| 200 | +proxied_user@localhost proxied_user@% |
| 201 | +========== test 2.2.1 ====================================== |
| 202 | +SELECT @@proxy_user; |
| 203 | +@@proxy_user |
| 204 | +NULL |
| 205 | +connection default; |
| 206 | +disconnect proxy_con; |
| 207 | +connect(proxy_con,localhost,proxy_user,proxied_user); |
| 208 | +ERROR 28000: Access denied for user 'proxy_user'@'localhost' (using password: YES) |
| 209 | +GRANT PROXY ON proxied_user TO ''@''; |
| 210 | +connect(proxy_con,localhost,proxied_user,proxied_user_passwd); |
| 211 | +SELECT USER(),CURRENT_USER(); |
| 212 | +USER() CURRENT_USER() |
| 213 | +proxied_user@localhost proxied_user@% |
| 214 | +connection default; |
| 215 | +disconnect proxy_con; |
| 216 | +connect(proxy_con,localhost,proxy_user,proxied_user); |
| 217 | +SELECT USER(),CURRENT_USER(); |
| 218 | +USER() CURRENT_USER() |
| 219 | +proxy_user@localhost proxied_user@% |
| 220 | +========== test 2.2.1 ====================================== |
| 221 | +SELECT @@proxy_user; |
| 222 | +@@proxy_user |
| 223 | +''@'' |
| 224 | +connection default; |
| 225 | +disconnect proxy_con; |
| 226 | +DROP USER ''@'',proxied_user; |
| 227 | +GRANT ALL PRIVILEGES ON test_user_db.* TO ''@'' |
| 228 | +IDENTIFIED WITH test_plugin_server AS 'proxied_user'; |
| 229 | +CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd'; |
| 230 | +SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; |
| 231 | +user plugin authentication_string |
| 232 | + test_plugin_server proxied_user |
| 233 | +proxied_user |
| 234 | +connect(proxy_con,localhost,proxied_user,proxied_user_passwd); |
| 235 | +SELECT USER(),CURRENT_USER(); |
| 236 | +USER() CURRENT_USER() |
| 237 | +proxied_user@localhost proxied_user@% |
| 238 | +SELECT @@proxy_user; |
| 239 | +@@proxy_user |
| 240 | +NULL |
| 241 | +connection default; |
| 242 | +disconnect proxy_con; |
| 243 | +connect(proxy_con,localhost,proxy_user,proxied_user); |
| 244 | +ERROR 28000: Access denied for user 'proxy_user'@'localhost' (using password: YES) |
| 245 | +GRANT PROXY ON proxied_user TO ''@''; |
| 246 | +connect(proxy_con,localhost,proxied_user,proxied_user_passwd); |
| 247 | +SELECT USER(),CURRENT_USER(); |
| 248 | +USER() CURRENT_USER() |
| 249 | +proxied_user@localhost proxied_user@% |
| 250 | +connection default; |
| 251 | +disconnect proxy_con; |
| 252 | +connect(proxy_con,localhost,proxy_user,proxied_user); |
| 253 | +SELECT USER(),CURRENT_USER(); |
| 254 | +USER() CURRENT_USER() |
| 255 | +proxy_user@localhost proxied_user@% |
| 256 | +SELECT @@proxy_user; |
| 257 | +@@proxy_user |
| 258 | +''@'' |
| 259 | +connection default; |
| 260 | +disconnect proxy_con; |
| 261 | +DROP USER ''@'',proxied_user; |
| 262 | +CREATE USER ''@'' IDENTIFIED WITH test_plugin_server AS 'proxied_user'; |
| 263 | +CREATE USER proxied_user_1 IDENTIFIED BY 'proxied_user_1_pwd'; |
| 264 | +CREATE USER proxied_user_2 IDENTIFIED BY 'proxied_user_2_pwd'; |
| 265 | +CREATE USER proxied_user_3 IDENTIFIED BY 'proxied_user_3_pwd'; |
| 266 | +CREATE USER proxied_user_4 IDENTIFIED BY 'proxied_user_4_pwd'; |
| 267 | +CREATE USER proxied_user_5 IDENTIFIED BY 'proxied_user_5_pwd'; |
| 268 | +GRANT PROXY ON proxied_user_1 TO ''@''; |
| 269 | +GRANT PROXY ON proxied_user_2 TO ''@''; |
| 270 | +GRANT PROXY ON proxied_user_3 TO ''@''; |
| 271 | +GRANT PROXY ON proxied_user_4 TO ''@''; |
| 272 | +GRANT PROXY ON proxied_user_5 TO ''@''; |
| 273 | +SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; |
| 274 | +user plugin authentication_string |
| 275 | + test_plugin_server proxied_user |
| 276 | +proxied_user_1 |
| 277 | +proxied_user_2 |
| 278 | +proxied_user_3 |
| 279 | +proxied_user_4 |
| 280 | +proxied_user_5 |
| 281 | +connect(proxy_con_1,localhost,proxied_user_1,'proxied_user_1_pwd'); |
| 282 | +connect(proxy_con_2,localhost,proxied_user_2,proxied_user_2_pwd); |
| 283 | +connect(proxy_con_3,localhost,proxied_user_3,proxied_user_3_pwd); |
| 284 | +connect(proxy_con_4,localhost,proxied_user_4,proxied_user_4_pwd); |
| 285 | +connect(proxy_con_5,localhost,proxied_user_5,proxied_user_5_pwd); |
| 286 | +connection proxy_con_1; |
| 287 | +SELECT USER(),CURRENT_USER(); |
| 288 | +USER() CURRENT_USER() |
| 289 | +proxied_user_1@localhost proxied_user_1@% |
| 290 | +SELECT @@proxy_user; |
| 291 | +@@proxy_user |
| 292 | +NULL |
| 293 | +connection proxy_con_2; |
| 294 | +SELECT USER(),CURRENT_USER(); |
| 295 | +USER() CURRENT_USER() |
| 296 | +proxied_user_2@localhost proxied_user_2@% |
| 297 | +SELECT @@proxy_user; |
| 298 | +@@proxy_user |
| 299 | +NULL |
| 300 | +connection proxy_con_3; |
| 301 | +SELECT USER(),CURRENT_USER(); |
| 302 | +USER() CURRENT_USER() |
| 303 | +proxied_user_3@localhost proxied_user_3@% |
| 304 | +SELECT @@proxy_user; |
| 305 | +@@proxy_user |
| 306 | +NULL |
| 307 | +connection proxy_con_4; |
| 308 | +SELECT USER(),CURRENT_USER(); |
| 309 | +USER() CURRENT_USER() |
| 310 | +proxied_user_4@localhost proxied_user_4@% |
| 311 | +SELECT @@proxy_user; |
| 312 | +@@proxy_user |
| 313 | +NULL |
| 314 | +connection proxy_con_5; |
| 315 | +SELECT USER(),CURRENT_USER(); |
| 316 | +USER() CURRENT_USER() |
| 317 | +proxied_user_5@localhost proxied_user_5@% |
| 318 | +SELECT @@proxy_user; |
| 319 | +@@proxy_user |
| 320 | +NULL |
| 321 | +connection default; |
| 322 | +disconnect proxy_con_1; |
| 323 | +disconnect proxy_con_2; |
| 324 | +disconnect proxy_con_3; |
| 325 | +disconnect proxy_con_4; |
| 326 | +disconnect proxy_con_5; |
| 327 | +DROP USER ''@'',proxied_user_1,proxied_user_2,proxied_user_3,proxied_user_4,proxied_user_5; |
| 328 | +========== test 3 ========================================== |
| 329 | +GRANT ALL PRIVILEGES ON *.* TO plug_user |
| 330 | +IDENTIFIED WITH test_plugin_server AS 'plug_dest'; |
| 331 | +CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; |
| 332 | +GRANT PROXY ON plug_dest TO plug_user; |
| 333 | +FLUSH PRIVILEGES; |
| 334 | +DROP USER plug_user, plug_dest; |
| 335 | +DROP DATABASE test_user_db; |
0 commit comments