| 1 |
############################################################################### |
| 2 |
# # |
| 3 |
# Password expiry scenarios catering to all the authentication plugin # |
| 4 |
# and handled by the flag "password_expired" in the mysql.user table # |
| 5 |
# # |
| 6 |
# # |
| 7 |
# # |
| 8 |
# Creation Date: 2012-12-28 # |
| 9 |
# Author : Tanjot Singh Uppal # |
| 10 |
# # |
| 11 |
# # |
| 12 |
# Description:Test Cases of password expiry validated the access to the # |
| 13 |
# users under scenarios with expired password. # |
| 14 |
# # |
| 15 |
############################################################################### |
| 16 |
|
| 17 |
--source include/mysql_upgrade_preparation.inc |
| 18 |
|
| 19 |
# This test will intentionally generate errors in the server error log |
| 20 |
# when a broken password is inserted into the mysql.user table. |
| 21 |
# The below suppression is to clear those errors. |
| 22 |
|
| 23 |
--disable_query_log |
| 24 |
call mtr.add_suppression(".*Password salt for user.*"); |
| 25 |
--enable_query_log |
| 26 |
|
| 27 |
## By default the server is started with the @default_plugin plugin. |
| 28 |
|
| 29 |
--echo |
| 30 |
--echo |
| 31 |
--echo ======================================================================================= |
| 32 |
--echo Checking the password expiry with the users created with all 3 plugable authentication |
| 33 |
--echo ======================================================================================= |
| 34 |
--echo |
| 35 |
|
| 36 |
## Creating a user with respect to all the 2 password authentication plugin |
| 37 |
|
| 38 |
set @default_plugin= @@global.default_authentication_plugin; |
| 39 |
|
| 40 |
--echo Creating a user with respect to all the 2 password authentication plugin |
| 41 |
|
| 42 |
|
| 43 |
# User with @default_plugin plugin |
| 44 |
--echo **** Creating user with @default_plugin plugin |
| 45 |
|
| 46 |
CREATE USER 'Tanjotuser1'@'localhost' IDENTIFIED BY 'abc'; |
| 47 |
|
| 48 |
|
| 49 |
# User with sha256_password plugin |
| 50 |
--echo **** Creating user with sha256_password plugin |
| 51 |
|
| 52 |
CREATE USER 'Tanjotuser3'@'localhost' IDENTIFIED WITH 'sha256_password'; |
| 53 |
SET PASSWORD for 'Tanjotuser3'@'localhost' = 'abc'; |
| 54 |
|
| 55 |
|
| 56 |
## Validating the plugin assigned for the above 2 users in the user table |
| 57 |
|
| 58 |
--echo **** Validating the plugin names |
| 59 |
|
| 60 |
select (select plugin from mysql.user where User='Tanjotuser1' and Host='localhost')=@default_plugin; |
| 61 |
--echo 1 Expected |
| 62 |
|
| 63 |
select (select plugin from mysql.user where User='Tanjotuser3' and Host='localhost')='sha256_password'; |
| 64 |
--echo 1 Expected |
| 65 |
|
| 66 |
|
| 67 |
## Validating the password expiry flag in the mysql.user table |
| 68 |
|
| 69 |
--echo **** Validating the password expiry flag in the mysql.user table |
| 70 |
|
| 71 |
|
| 72 |
select (select password_expired from mysql.user where User='Tanjotuser1' and Host='localhost')='N'; |
| 73 |
--echo 1 Expected |
| 74 |
|
| 75 |
select (select password_expired from mysql.user where User='Tanjotuser3' and Host='localhost')='N'; |
| 76 |
--echo 1 Expected |
| 77 |
|
| 78 |
|
| 79 |
## Expirying password from user login for the 2 created users |
| 80 |
|
| 81 |
--echo **** Expirying password from root login for the 2 created users |
| 82 |
|
| 83 |
|
| 84 |
--disable_warnings |
| 85 |
connect(con1,localhost,Tanjotuser1,abc,,,,SSL); |
| 86 |
--error ER_SPECIFIC_ACCESS_DENIED_ERROR |
| 87 |
Alter user 'Tanjotuser1'@'localhost' password expire; |
| 88 |
select 1; |
| 89 |
--echo 1 Expected |
| 90 |
--enable_warnings |
| 91 |
|
| 92 |
|
| 93 |
--disable_warnings |
| 94 |
connect(con3,localhost,Tanjotuser3,abc,,); |
| 95 |
--error ER_SPECIFIC_ACCESS_DENIED_ERROR |
| 96 |
Alter user 'Tanjotuser3'@'localhost' password expire; |
| 97 |
select 1; |
| 98 |
--echo 1 Expected |
| 99 |
--enable_warnings |
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
## The password expiry flag in the mysql.user table should not be altered |
| 104 |
|
| 105 |
--echo **** Validating the password expiry flag in the mysql.user table should not be altered |
| 106 |
|
| 107 |
connection default; |
| 108 |
|
| 109 |
select (select password_expired from mysql.user where User='Tanjotuser1' and Host='localhost')='N'; |
| 110 |
--echo 1 Expected |
| 111 |
|
| 112 |
select (select password_expired from mysql.user where User='Tanjotuser3' and Host='localhost')='N'; |
| 113 |
--echo 1 Expected |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
## These 2 users still should be able to login and work properly |
| 118 |
|
| 119 |
--echo **** These 2 users still should be able to login and work properly |
| 120 |
|
| 121 |
--disable_warnings |
| 122 |
connect(con4,localhost,Tanjotuser1,abc,,); |
| 123 |
select 1; |
| 124 |
--echo 1 Expected |
| 125 |
|
| 126 |
connect(con6,localhost,Tanjotuser3,abc,,); |
| 127 |
select 1; |
| 128 |
--echo 1 Expected |
| 129 |
|
| 130 |
--enable_warnings |
| 131 |
|
| 132 |
## Disconnecting the last 2 connections |
| 133 |
|
| 134 |
disconnect con4; |
| 135 |
disconnect con6; |
| 136 |
|
| 137 |
## Expirying password from root login for the 2 created users using Alter user |
| 138 |
|
| 139 |
--echo **** Expirying password from root login for the 2 created users using Alter user |
| 140 |
|
| 141 |
connection default; |
| 142 |
|
| 143 |
Alter user 'Tanjotuser1'@'localhost' password expire; |
| 144 |
|
| 145 |
Alter user 'Tanjotuser3'@'localhost' password expire; |
| 146 |
|
| 147 |
|
| 148 |
## Validating the password expiry flag in the mysql.user table |
| 149 |
|
| 150 |
--echo **** Validating the password expiry flag in the mysql.user table |
| 151 |
|
| 152 |
|
| 153 |
select (select password_expired from mysql.user where User='Tanjotuser1' and Host='localhost')='Y'; |
| 154 |
--echo 1 Expected |
| 155 |
|
| 156 |
select (select password_expired from mysql.user where User='Tanjotuser3' and Host='localhost')='Y'; |
| 157 |
--echo 1 Expected |
| 158 |
|
| 159 |
|
| 160 |
## checking user access after password expiry |
| 161 |
|
| 162 |
--echo **** checking user access after password expiry |
| 163 |
|
| 164 |
--disable_warnings |
| 165 |
|
| 166 |
connect(con7,localhost,Tanjotuser1,abc,,,,SSL); |
| 167 |
--error ER_MUST_CHANGE_PASSWORD |
| 168 |
select 1; |
| 169 |
|
| 170 |
|
| 171 |
connect(con9,localhost,Tanjotuser3,abc,,,,SSL); |
| 172 |
--error ER_MUST_CHANGE_PASSWORD |
| 173 |
select 1; |
| 174 |
|
| 175 |
--enable_warnings |
| 176 |
|
| 177 |
|
| 178 |
## At the same time the open sessions for these users should able to work properly |
| 179 |
|
| 180 |
--echo At the same time the open sessions for these users should able to work properly. |
| 181 |
|
| 182 |
connection con1; |
| 183 |
|
| 184 |
select 1; |
| 185 |
--echo 1 Expected |
| 186 |
|
| 187 |
|
| 188 |
connection con3; |
| 189 |
|
| 190 |
select 1; |
| 191 |
--echo 1 Expected |
| 192 |
|
| 193 |
|
| 194 |
## setting passwords from the new connections. |
| 195 |
|
| 196 |
--echo setting passwords from the new connections. |
| 197 |
|
| 198 |
connection con7; |
| 199 |
|
| 200 |
|
| 201 |
--error ER_MUST_CHANGE_PASSWORD |
| 202 |
select 1; |
| 203 |
|
| 204 |
set password='abcd'; |
| 205 |
|
| 206 |
select 1; |
| 207 |
--echo 1 Expected |
| 208 |
|
| 209 |
connection default; |
| 210 |
|
| 211 |
select (select password_expired from mysql.user where User='Tanjotuser1' and Host='localhost')='N'; |
| 212 |
--echo 1 Expected |
| 213 |
|
| 214 |
|
| 215 |
connection con9; |
| 216 |
|
| 217 |
--error ER_MUST_CHANGE_PASSWORD |
| 218 |
select 1; |
| 219 |
|
| 220 |
set password='abcd'; |
| 221 |
|
| 222 |
select 1; |
| 223 |
--echo 1 Expected |
| 224 |
|
| 225 |
connection default; |
| 226 |
|
| 227 |
select (select password_expired from mysql.user where User='Tanjotuser3' and Host='localhost')='N'; |
| 228 |
--echo 1 Expected |
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
## logging the 2 users with the new passwords |
| 233 |
|
| 234 |
--echo **** logging the 2 users with the new passwords |
| 235 |
|
| 236 |
|
| 237 |
--disable_warnings |
| 238 |
|
| 239 |
connect(con10,localhost,Tanjotuser1,abcd,,,,SSL); |
| 240 |
select 1; |
| 241 |
--echo 1 Expected |
| 242 |
|
| 243 |
connect(con12,localhost,Tanjotuser3,abcd,,,,SSL); |
| 244 |
select 1; |
| 245 |
--echo 1 Expected |
| 246 |
|
| 247 |
--enable_warnings |
| 248 |
|
| 249 |
|
| 250 |
## Disconnecting the open sessions and dropping the created users. |
| 251 |
|
| 252 |
connection default; |
| 253 |
|
| 254 |
--echo Disconnecting the open sessions and dropping the created users |
| 255 |
|
| 256 |
disconnect con1; |
| 257 |
disconnect con3; |
| 258 |
|
| 259 |
disconnect con7; |
| 260 |
disconnect con9; |
| 261 |
|
| 262 |
disconnect con10; |
| 263 |
disconnect con12; |
| 264 |
|
| 265 |
drop user 'Tanjotuser1'@'localhost'; |
| 266 |
drop user 'Tanjotuser3'@'localhost'; |
| 267 |
|
| 268 |
|
| 269 |
--echo |
| 270 |
--echo |
| 271 |
--echo ======================================================================================= |
| 272 |
--echo Checking the password expiry using the update command on mysql.user table |
| 273 |
--echo ======================================================================================= |
| 274 |
--echo |
| 275 |
|
| 276 |
|
| 277 |
## Creating a user with respect to all the 2 password authentication plugin |
| 278 |
|
| 279 |
--echo Creating a user with respect to all the 2 password authentication plugin |
| 280 |
|
| 281 |
connection default; |
| 282 |
|
| 283 |
# User with @default_plugin plugin |
| 284 |
--echo **** Creating user with @default_plugin plugin |
| 285 |
|
| 286 |
CREATE USER 'Tanjotuser1'@'localhost' IDENTIFIED BY 'abc'; |
| 287 |
|
| 288 |
|
| 289 |
# User with sha256_password plugin |
| 290 |
--echo **** Creating user with sha256_password plugin |
| 291 |
|
| 292 |
CREATE USER 'Tanjotuser3'@'localhost' IDENTIFIED WITH 'sha256_password'; |
| 293 |
SET PASSWORD for 'Tanjotuser3'@'localhost' = 'abc'; |
| 294 |
|
| 295 |
|
| 296 |
## Validating the plugin assigned for the above 2 users in the user table |
| 297 |
|
| 298 |
--echo **** Validating the plugin names |
| 299 |
|
| 300 |
select (select plugin from mysql.user where User='Tanjotuser1' and Host='localhost')=@default_plugin; |
| 301 |
--echo 1 Expected |
| 302 |
|
| 303 |
select (select plugin from mysql.user where User='Tanjotuser3' and Host='localhost')='sha256_password'; |
| 304 |
--echo 1 Expected |
| 305 |
|
| 306 |
|
| 307 |
## Validating the password expiry flag in the mysql.user table |
| 308 |
|
| 309 |
--echo **** Validating the password expiry flag in the mysql.user table |
| 310 |
|
| 311 |
|
| 312 |
select (select password_expired from mysql.user where User='Tanjotuser1' and Host='localhost')='N'; |
| 313 |
--echo 1 Expected |
| 314 |
|
| 315 |
select (select password_expired from mysql.user where User='Tanjotuser3' and Host='localhost')='N'; |
| 316 |
--echo 1 Expected |
| 317 |
|
| 318 |
|
| 319 |
## Making connections from each of these created users |
| 320 |
|
| 321 |
--echo **** Making connections from each of these created users |
| 322 |
|
| 323 |
--disable_warnings |
| 324 |
|
| 325 |
connect(con13,localhost,Tanjotuser1,abc,,,,SSL); |
| 326 |
select 1; |
| 327 |
--echo 1 Expected |
| 328 |
|
| 329 |
connect(con15,localhost,Tanjotuser3,abc,,,,SSL); |
| 330 |
select 1; |
| 331 |
--echo 1 Expected |
| 332 |
|
| 333 |
--enable_warnings |
| 334 |
|
| 335 |
|
| 336 |
|
| 337 |
## Expirying password from user login for the 2 created users using update command |
| 338 |
|
| 339 |
--echo **** Expirying password from root login for the 2 created users using update command |
| 340 |
|
| 341 |
connection default; |
| 342 |
|
| 343 |
update mysql.user set password_expired='Y' where User='Tanjotuser1' and Host='localhost'; |
| 344 |
|
| 345 |
update mysql.user set password_expired='Y' where User='Tanjotuser3' and Host='localhost'; |
| 346 |
|
| 347 |
|
| 348 |
## connecting client before flush privileges |
| 349 |
|
| 350 |
--echo **** connecting client before flush privileges |
| 351 |
|
| 352 |
--disable_warnings |
| 353 |
|
| 354 |
connect(con16,localhost,Tanjotuser1,abc,,); |
| 355 |
select 1; |
| 356 |
--echo 1 Expected |
| 357 |
|
| 358 |
connect(con18,localhost,Tanjotuser3,abc,,); |
| 359 |
select 1; |
| 360 |
--echo 1 Expected |
| 361 |
|
| 362 |
--enable_warnings |
| 363 |
|
| 364 |
|
| 365 |
## flush privileges |
| 366 |
|
| 367 |
--echo **** flush privileges |
| 368 |
|
| 369 |
connection default; |
| 370 |
flush privileges; |
| 371 |
|
| 372 |
|
| 373 |
## connecting client after flush privileges |
| 374 |
|
| 375 |
--echo **** connecting client after flush privileges |
| 376 |
|
| 377 |
--disable_warnings |
| 378 |
|
| 379 |
connect(con19,localhost,Tanjotuser1,abc,,,,SSL); |
| 380 |
--error ER_MUST_CHANGE_PASSWORD |
| 381 |
select 1; |
| 382 |
|
| 383 |
connect(con21,localhost,Tanjotuser3,abc,,,,SSL); |
| 384 |
--error ER_MUST_CHANGE_PASSWORD |
| 385 |
select 1; |
| 386 |
|
| 387 |
--enable_warnings |
| 388 |
|
| 389 |
|
| 390 |
## checking the previous open connections |
| 391 |
|
| 392 |
--echo **** checking the previous open connections |
| 393 |
|
| 394 |
|
| 395 |
connection con13; |
| 396 |
select 1; |
| 397 |
--echo 1 Expected |
| 398 |
|
| 399 |
connection con15; |
| 400 |
select 1; |
| 401 |
--echo 1 Expected |
| 402 |
|
| 403 |
|
| 404 |
## Resetting the password |
| 405 |
|
| 406 |
--echo **** Resetting the password |
| 407 |
|
| 408 |
connection con16; |
| 409 |
|
| 410 |
select 1; |
| 411 |
--echo 1 Expected |
| 412 |
|
| 413 |
set password='abcd'; |
| 414 |
|
| 415 |
select 1; |
| 416 |
--echo 1 Expected |
| 417 |
|
| 418 |
connection default; |
| 419 |
|
| 420 |
select (select password_expired from mysql.user where User='Tanjotuser1' and Host='localhost')='N'; |
| 421 |
--echo 1 Expected |
| 422 |
|
| 423 |
|
| 424 |
connection con18; |
| 425 |
|
| 426 |
|
| 427 |
select 1; |
| 428 |
--echo 1 Expected |
| 429 |
|
| 430 |
set password='abcd'; |
| 431 |
|
| 432 |
select 1; |
| 433 |
--echo 1 Expected |
| 434 |
|
| 435 |
connection default; |
| 436 |
|
| 437 |
select (select password_expired from mysql.user where User='Tanjotuser3' and Host='localhost')='N'; |
| 438 |
--echo 1 Expected |
| 439 |
|
| 440 |
|
| 441 |
## Logging with the new password |
| 442 |
|
| 443 |
--echo **** Logging with the new password |
| 444 |
|
| 445 |
|
| 446 |
--disable_warnings |
| 447 |
|
| 448 |
connect(con22,localhost,Tanjotuser1,abcd,,,,SSL); |
| 449 |
|
| 450 |
select 1; |
| 451 |
--echo 1 Expected |
| 452 |
|
| 453 |
connect(con24,localhost,Tanjotuser3,abcd,,,,SSL); |
| 454 |
|
| 455 |
select 1; |
| 456 |
--echo 1 Expected |
| 457 |
|
| 458 |
--enable_warnings |
| 459 |
|
| 460 |
## Below section is hashed till Bug #16054065 is fixed |
| 461 |
|
| 462 |
## connecting client after resetting the password |
| 463 |
|
| 464 |
--echo **** connecting client after resetting the password |
| 465 |
|
| 466 |
#--disable_warnings |
| 467 |
|
| 468 |
#connection con19; |
| 469 |
#select 1; |
| 470 |
#--echo 1 Expected |
| 471 |
|
| 472 |
#connection con21; |
| 473 |
#select 1; |
| 474 |
#--echo 1 Expected |
| 475 |
|
| 476 |
#--enable_warnings |
| 477 |
|
| 478 |
|
| 479 |
## Disconnecting the open sessions and dropping the created users. |
| 480 |
|
| 481 |
connection default; |
| 482 |
|
| 483 |
--echo Disconnecting the open sessions and dropping the created users |
| 484 |
|
| 485 |
disconnect con13; |
| 486 |
disconnect con15; |
| 487 |
|
| 488 |
disconnect con16; |
| 489 |
disconnect con18; |
| 490 |
|
| 491 |
disconnect con19; |
| 492 |
disconnect con21; |
| 493 |
|
| 494 |
disconnect con22; |
| 495 |
disconnect con24; |
| 496 |
|
| 497 |
drop user 'Tanjotuser1'@'localhost'; |
| 498 |
drop user 'Tanjotuser3'@'localhost'; |
| 499 |
|
| 500 |
|
| 501 |
--echo |
| 502 |
--echo |
| 503 |
--echo ================================================================================================= |
| 504 |
--echo Starting the server with the default authentication sha256_password |
| 505 |
--echo ================================================================================================= |
| 506 |
--echo |
| 507 |
|
| 508 |
--echo # Restart server with default-authentication-plugin=sha256_password; |
| 509 |
|
| 510 |
let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; |
| 511 |
--exec echo "wait" > $restart_file |
| 512 |
--shutdown_server |
| 513 |
--source include/wait_until_disconnected.inc |
| 514 |
-- exec echo "restart:--default-authentication-plugin=sha256_password " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 515 |
-- enable_reconnect |
| 516 |
-- source include/wait_until_connected_again.inc |
| 517 |
|
| 518 |
--echo |
| 519 |
--echo |
| 520 |
--echo ======================================================================================= |
| 521 |
--echo Checking the password expiry with the users created with all 2 plugable authentication |
| 522 |
--echo ======================================================================================= |
| 523 |
--echo |
| 524 |
|
| 525 |
## Creating a user with respect to all the 2 password authentication plugin |
| 526 |
|
| 527 |
--echo Creating a user with respect to all the 2 password authentication plugin |
| 528 |
|
| 529 |
|
| 530 |
# User with mysql_native_password plugin |
| 531 |
--echo **** Creating user with mysql_native_password plugin |
| 532 |
|
| 533 |
CREATE USER 'Tanjotuser1'@'localhost' IDENTIFIED WITH 'mysql_native_password'; |
| 534 |
SET PASSWORD for 'Tanjotuser1'@'localhost' = 'abc'; |
| 535 |
|
| 536 |
# User with sha256_password plugin |
| 537 |
--echo **** Creating user with sha256_password plugin |
| 538 |
|
| 539 |
CREATE USER 'Tanjotuser3'@'localhost' IDENTIFIED WITH 'sha256_password'; |
| 540 |
SET PASSWORD for 'Tanjotuser3'@'localhost' = 'abc'; |
| 541 |
|
| 542 |
|
| 543 |
## Validating the plugin assigned for the above 2 users in the user table |
| 544 |
|
| 545 |
--echo **** Validating the plugin names |
| 546 |
|
| 547 |
select (select plugin from mysql.user where User='Tanjotuser1' and Host='localhost')='mysql_native_password'; |
| 548 |
--echo 1 Expected |
| 549 |
|
| 550 |
select (select plugin from mysql.user where User='Tanjotuser3' and Host='localhost')='sha256_password'; |
| 551 |
--echo 1 Expected |
| 552 |
|
| 553 |
|
| 554 |
## Validating the password expiry flag in the mysql.user table |
| 555 |
|
| 556 |
--echo **** Validating the password expiry flag in the mysql.user table |
| 557 |
|
| 558 |
|
| 559 |
select (select password_expired from mysql.user where User='Tanjotuser1' and Host='localhost')='N'; |
| 560 |
--echo 1 Expected |
| 561 |
|
| 562 |
select (select password_expired from mysql.user where User='Tanjotuser3' and Host='localhost')='N'; |
| 563 |
--echo 1 Expected |
| 564 |
|
| 565 |
|
| 566 |
## Expirying password from user login for the 2 created users |
| 567 |
|
| 568 |
--echo **** Expirying password from root login for the 2 created users |
| 569 |
|
| 570 |
|
| 571 |
--disable_warnings |
| 572 |
connect(con1,localhost,Tanjotuser1,abc,,); |
| 573 |
--error ER_SPECIFIC_ACCESS_DENIED_ERROR |
| 574 |
Alter user 'Tanjotuser1'@'localhost' password expire; |
| 575 |
select 1; |
| 576 |
--echo 1 Expected |
| 577 |
--enable_warnings |
| 578 |
|
| 579 |
|
| 580 |
--disable_warnings |
| 581 |
connect(con3,localhost,Tanjotuser3,abc,,); |
| 582 |
--error ER_SPECIFIC_ACCESS_DENIED_ERROR |
| 583 |
Alter user 'Tanjotuser3'@'localhost' password expire; |
| 584 |
select 1; |
| 585 |
--echo 1 Expected |
| 586 |
--enable_warnings |
| 587 |
|
| 588 |
|
| 589 |
|
| 590 |
## The password expiry flag in the mysql.user table should not be altered |
| 591 |
|
| 592 |
--echo **** Validating the password expiry flag in the mysql.user table should not be altered |
| 593 |
|
| 594 |
connection default; |
| 595 |
|
| 596 |
select (select password_expired from mysql.user where User='Tanjotuser1' and Host='localhost')='N'; |
| 597 |
--echo 1 Expected |
| 598 |
|
| 599 |
select (select password_expired from mysql.user where User='Tanjotuser3' and Host='localhost')='N'; |
| 600 |
--echo 1 Expected |
| 601 |
|
| 602 |
|
| 603 |
|
| 604 |
## These 2 users still should be able to login and work properly |
| 605 |
|
| 606 |
--echo **** These 2 users still should be able to login and work properly |
| 607 |
|
| 608 |
--disable_warnings |
| 609 |
connect(con4,localhost,Tanjotuser1,abc,,); |
| 610 |
select 1; |
| 611 |
--echo 1 Expected |
| 612 |
|
| 613 |
connect(con6,localhost,Tanjotuser3,abc,,); |
| 614 |
select 1; |
| 615 |
--echo 1 Expected |
| 616 |
|
| 617 |
--enable_warnings |
| 618 |
|
| 619 |
## Disconnecting the last 2 connections |
| 620 |
|
| 621 |
disconnect con4; |
| 622 |
disconnect con6; |
| 623 |
|
| 624 |
## Expirying password from root login for the 2 created users using Alter user |
| 625 |
|
| 626 |
--echo **** Expirying password from root login for the 2 created users using Alter user |
| 627 |
|
| 628 |
connection default; |
| 629 |
|
| 630 |
Alter user 'Tanjotuser1'@'localhost' password expire; |
| 631 |
|
| 632 |
Alter user 'Tanjotuser3'@'localhost' password expire; |
| 633 |
|
| 634 |
|
| 635 |
## Validating the password expiry flag in the mysql.user table |
| 636 |
|
| 637 |
--echo **** Validating the password expiry flag in the mysql.user table |
| 638 |
|
| 639 |
|
| 640 |
select (select password_expired from mysql.user where User='Tanjotuser1' and Host='localhost')='Y'; |
| 641 |
--echo 1 Expected |
| 642 |
|
| 643 |
select (select password_expired from mysql.user where User='Tanjotuser3' and Host='localhost')='Y'; |
| 644 |
--echo 1 Expected |
| 645 |
|
| 646 |
|
| 647 |
## checking user access after password expiry |
| 648 |
|
| 649 |
--echo **** checking user access after password expiry |
| 650 |
|
| 651 |
--disable_warnings |
| 652 |
|
| 653 |
connect(con7,localhost,Tanjotuser1,abc,,); |
| 654 |
--error ER_MUST_CHANGE_PASSWORD |
| 655 |
select 1; |
| 656 |
|
| 657 |
|
| 658 |
connect(con9,localhost,Tanjotuser3,abc,,); |
| 659 |
--error ER_MUST_CHANGE_PASSWORD |
| 660 |
select 1; |
| 661 |
|
| 662 |
--enable_warnings |
| 663 |
|
| 664 |
|
| 665 |
## At the same time the open sessions for these users should able to work properly |
| 666 |
|
| 667 |
--echo At the same time the open sessions for these users should able to work properly. |
| 668 |
|
| 669 |
connection con1; |
| 670 |
|
| 671 |
select 1; |
| 672 |
--echo 1 Expected |
| 673 |
|
| 674 |
|
| 675 |
connection con3; |
| 676 |
|
| 677 |
select 1; |
| 678 |
--echo 1 Expected |
| 679 |
|
| 680 |
|
| 681 |
## setting passwords from the new connections. |
| 682 |
|
| 683 |
--echo setting passwords from the new connections. |
| 684 |
|
| 685 |
connection con7; |
| 686 |
|
| 687 |
--error ER_MUST_CHANGE_PASSWORD |
| 688 |
select 1; |
| 689 |
|
| 690 |
set password='abcd'; |
| 691 |
|
| 692 |
select 1; |
| 693 |
--echo 1 Expected |
| 694 |
|
| 695 |
connection default; |
| 696 |
|
| 697 |
select (select password_expired from mysql.user where User='Tanjotuser1' and Host='localhost')='N'; |
| 698 |
--echo 1 Expected |
| 699 |
|
| 700 |
|
| 701 |
connection con9; |
| 702 |
|
| 703 |
--error ER_MUST_CHANGE_PASSWORD |
| 704 |
select 1; |
| 705 |
|
| 706 |
set password='abcd'; |
| 707 |
|
| 708 |
select 1; |
| 709 |
--echo 1 Expected |
| 710 |
|
| 711 |
connection default; |
| 712 |
|
| 713 |
select (select password_expired from mysql.user where User='Tanjotuser3' and Host='localhost')='N'; |
| 714 |
--echo 1 Expected |
| 715 |
|
| 716 |
|
| 717 |
|
| 718 |
## logging the 2 users with the new passwords |
| 719 |
|
| 720 |
--echo **** logging the 2 users with the new passwords |
| 721 |
|
| 722 |
|
| 723 |
--disable_warnings |
| 724 |
|
| 725 |
connect(con10,localhost,Tanjotuser1,abcd,,); |
| 726 |
select 1; |
| 727 |
--echo 1 Expected |
| 728 |
|
| 729 |
connect(con12,localhost,Tanjotuser3,abcd,,); |
| 730 |
select 1; |
| 731 |
--echo 1 Expected |
| 732 |
|
| 733 |
--enable_warnings |
| 734 |
|
| 735 |
|
| 736 |
## Disconnecting the open sessions and dropping the created users. |
| 737 |
|
| 738 |
connection default; |
| 739 |
|
| 740 |
--echo Disconnecting the open sessions and dropping the created users |
| 741 |
|
| 742 |
disconnect con1; |
| 743 |
disconnect con3; |
| 744 |
|
| 745 |
disconnect con7; |
| 746 |
disconnect con9; |
| 747 |
|
| 748 |
disconnect con10; |
| 749 |
disconnect con12; |
| 750 |
|
| 751 |
drop user 'Tanjotuser1'@'localhost'; |
| 752 |
drop user 'Tanjotuser3'@'localhost'; |
| 753 |
|
| 754 |
|
| 755 |
--echo |
| 756 |
--echo |
| 757 |
--echo ======================================================================================= |
| 758 |
--echo Checking the password expiry using the update command on mysql.user table |
| 759 |
--echo ======================================================================================= |
| 760 |
--echo |
| 761 |
|
| 762 |
|
| 763 |
## Creating a user with respect to all the 2 password authentication plugin |
| 764 |
|
| 765 |
--echo Creating a user with respect to all the 2 password authentication plugin |
| 766 |
|
| 767 |
connection default; |
| 768 |
|
| 769 |
# User with mysql_native_password plugin |
| 770 |
--echo **** Creating user with mysql_native_password plugin |
| 771 |
|
| 772 |
CREATE USER 'Tanjotuser1'@'localhost' IDENTIFIED WITH 'mysql_native_password'; |
| 773 |
SET PASSWORD for 'Tanjotuser1'@'localhost' = 'abc'; |
| 774 |
|
| 775 |
|
| 776 |
# User with sha256_password plugin |
| 777 |
--echo **** Creating user with sha256_password plugin |
| 778 |
|
| 779 |
CREATE USER 'Tanjotuser3'@'localhost' IDENTIFIED WITH 'sha256_password'; |
| 780 |
SET PASSWORD for 'Tanjotuser3'@'localhost' = 'abc'; |
| 781 |
|
| 782 |
|
| 783 |
## Validating the plugin assigned for the above 2 users in the user table |
| 784 |
|
| 785 |
--echo **** Validating the plugin names |
| 786 |
|
| 787 |
select (select plugin from mysql.user where User='Tanjotuser1' and Host='localhost')='mysql_native_password'; |
| 788 |
--echo 1 Expected |
| 789 |
|
| 790 |
select (select plugin from mysql.user where User='Tanjotuser3' and Host='localhost')='sha256_password'; |
| 791 |
--echo 1 Expected |
| 792 |
|
| 793 |
|
| 794 |
## Validating the password expiry flag in the mysql.user table |
| 795 |
|
| 796 |
--echo **** Validating the password expiry flag in the mysql.user table |
| 797 |
|
| 798 |
|
| 799 |
select (select password_expired from mysql.user where User='Tanjotuser1' and Host='localhost')='N'; |
| 800 |
--echo 1 Expected |
| 801 |
|
| 802 |
select (select password_expired from mysql.user where User='Tanjotuser3' and Host='localhost')='N'; |
| 803 |
--echo 1 Expected |
| 804 |
|
| 805 |
|
| 806 |
## Making connections from each of these created users |
| 807 |
|
| 808 |
--echo **** Making connections from each of these created users |
| 809 |
|
| 810 |
--disable_warnings |
| 811 |
|
| 812 |
connect(con13,localhost,Tanjotuser1,abc,,); |
| 813 |
select 1; |
| 814 |
--echo 1 Expected |
| 815 |
|
| 816 |
connect(con15,localhost,Tanjotuser3,abc,,); |
| 817 |
select 1; |
| 818 |
--echo 1 Expected |
| 819 |
|
| 820 |
--enable_warnings |
| 821 |
|
| 822 |
|
| 823 |
|
| 824 |
## Expirying password from user login for the 2 created users using update command |
| 825 |
|
| 826 |
--echo **** Expirying password from root login for the 2 created users using update command |
| 827 |
|
| 828 |
connection default; |
| 829 |
|
| 830 |
update mysql.user set password_expired='Y' where User='Tanjotuser1' and Host='localhost'; |
| 831 |
|
| 832 |
update mysql.user set password_expired='Y' where User='Tanjotuser3' and Host='localhost'; |
| 833 |
|
| 834 |
|
| 835 |
## connecting client before flush privileges |
| 836 |
|
| 837 |
--echo **** connecting client before flush privileges |
| 838 |
|
| 839 |
--disable_warnings |
| 840 |
|
| 841 |
connect(con16,localhost,Tanjotuser1,abc,,); |
| 842 |
select 1; |
| 843 |
--echo 1 Expected |
| 844 |
|
| 845 |
connect(con18,localhost,Tanjotuser3,abc,,); |
| 846 |
select 1; |
| 847 |
--echo 1 Expected |
| 848 |
|
| 849 |
--enable_warnings |
| 850 |
|
| 851 |
|
| 852 |
## flush privileges |
| 853 |
|
| 854 |
--echo **** flush privileges |
| 855 |
|
| 856 |
connection default; |
| 857 |
flush privileges; |
| 858 |
|
| 859 |
|
| 860 |
## connecting client after flush privileges |
| 861 |
|
| 862 |
--echo **** connecting client after flush privileges |
| 863 |
|
| 864 |
--disable_warnings |
| 865 |
|
| 866 |
connect(con19,localhost,Tanjotuser1,abc,,); |
| 867 |
--error ER_MUST_CHANGE_PASSWORD |
| 868 |
select 1; |
| 869 |
|
| 870 |
connect(con21,localhost,Tanjotuser3,abc,,); |
| 871 |
--error ER_MUST_CHANGE_PASSWORD |
| 872 |
select 1; |
| 873 |
|
| 874 |
--enable_warnings |
| 875 |
|
| 876 |
|
| 877 |
## checking the previous open connections |
| 878 |
|
| 879 |
--echo **** checking the previous open connections |
| 880 |
|
| 881 |
|
| 882 |
connection con13; |
| 883 |
select 1; |
| 884 |
--echo 1 Expected |
| 885 |
|
| 886 |
connection con15; |
| 887 |
select 1; |
| 888 |
--echo 1 Expected |
| 889 |
|
| 890 |
|
| 891 |
## Resetting the password |
| 892 |
|
| 893 |
--echo **** Resetting the password |
| 894 |
|
| 895 |
connection con16; |
| 896 |
|
| 897 |
select 1; |
| 898 |
--echo 1 Expected |
| 899 |
|
| 900 |
set password='abcd'; |
| 901 |
|
| 902 |
select 1; |
| 903 |
--echo 1 Expected |
| 904 |
|
| 905 |
connection default; |
| 906 |
|
| 907 |
select (select password_expired from mysql.user where User='Tanjotuser1' and Host='localhost')='N'; |
| 908 |
--echo 1 Expected |
| 909 |
|
| 910 |
|
| 911 |
connection con18; |
| 912 |
|
| 913 |
|
| 914 |
select 1; |
| 915 |
--echo 1 Expected |
| 916 |
|
| 917 |
set password='abcd'; |
| 918 |
|
| 919 |
select 1; |
| 920 |
--echo 1 Expected |
| 921 |
|
| 922 |
connection default; |
| 923 |
|
| 924 |
select (select password_expired from mysql.user where User='Tanjotuser3' and Host='localhost')='N'; |
| 925 |
--echo 1 Expected |
| 926 |
|
| 927 |
|
| 928 |
## Logging with the new password |
| 929 |
|
| 930 |
--echo **** Logging with the new password |
| 931 |
|
| 932 |
|
| 933 |
--disable_warnings |
| 934 |
|
| 935 |
connect(con22,localhost,Tanjotuser1,abcd,,); |
| 936 |
|
| 937 |
select 1; |
| 938 |
--echo 1 Expected |
| 939 |
|
| 940 |
connect(con24,localhost,Tanjotuser3,abcd,,); |
| 941 |
|
| 942 |
select 1; |
| 943 |
--echo 1 Expected |
| 944 |
|
| 945 |
--enable_warnings |
| 946 |
|
| 947 |
## Below section is hashed till Bug #16054065 is fixed |
| 948 |
|
| 949 |
## connecting client after resetting the password |
| 950 |
|
| 951 |
--echo **** connecting client after resetting the password |
| 952 |
|
| 953 |
#--disable_warnings |
| 954 |
|
| 955 |
#connection con19; |
| 956 |
#select 1; |
| 957 |
#--echo 1 Expected |
| 958 |
|
| 959 |
#connection con21; |
| 960 |
#select 1; |
| 961 |
#--echo 1 Expected |
| 962 |
|
| 963 |
#--enable_warnings |
| 964 |
|
| 965 |
|
| 966 |
## Disconnecting the open sessions and dropping the created users. |
| 967 |
|
| 968 |
--echo # |
| 969 |
--echo # WL#2284: Increase the length of a user name |
| 970 |
--echo # |
| 971 |
|
| 972 |
connection default; |
| 973 |
CREATE USER user_name_len_25_01234567@localhost IDENTIFIED BY 'password' PASSWORD EXPIRE; |
| 974 |
|
| 975 |
connect (con_user25,localhost,user_name_len_25_01234567,'password',); |
| 976 |
|
| 977 |
--error ER_MUST_CHANGE_PASSWORD |
| 978 |
SELECT 1; |
| 979 |
|
| 980 |
SET PASSWORD FOR user_name_len_25_01234567@localhost = 'abc'; |
| 981 |
|
| 982 |
disconnect con_user25; |
| 983 |
connect (con_user25_new_pass,localhost,user_name_len_25_01234567,'abc',); |
| 984 |
|
| 985 |
SELECT 1; |
| 986 |
|
| 987 |
connection default; |
| 988 |
|
| 989 |
--echo Disconnecting the open sessions and dropping the created users |
| 990 |
|
| 991 |
disconnect con_user25_new_pass; |
| 992 |
disconnect con13; |
| 993 |
disconnect con15; |
| 994 |
|
| 995 |
disconnect con16; |
| 996 |
disconnect con18; |
| 997 |
|
| 998 |
disconnect con19; |
| 999 |
disconnect con21; |
| 1000 |
|
| 1001 |
disconnect con22; |
| 1002 |
disconnect con24; |
| 1003 |
|
| 1004 |
DROP USER user_name_len_25_01234567@localhost; |
| 1005 |
drop user 'Tanjotuser1'@'localhost'; |
| 1006 |
drop user 'Tanjotuser3'@'localhost'; |
| 1007 |
|
| 1008 |
# Restore default settings in opt file |
| 1009 |
--let $restart_parameters = restart: |
| 1010 |
--source include/restart_mysqld.inc |
| 1011 |
|