| 1 |
# Connection delay tests for invalid user accounts |
| 2 |
|
| 3 |
# ---------------------------------------------------------------------- |
| 4 |
|
| 5 |
# Setup |
| 6 |
# Install connection_control plugin |
| 7 |
INSTALL PLUGIN connection_control SONAME 'CONNECTION_CONTROL_LIB'; |
| 8 |
INSTALL PLUGIN connection_control_failed_login_attempts SONAME 'CONNECTION_CONTROL_LIB'; |
| 9 |
# Save original values of connection_control variables |
| 10 |
SET @saved_connections_threshold = @@global.connection_control_failed_connections_threshold; |
| 11 |
SET @saved_max_delay = @@global.connection_control_max_connection_delay; |
| 12 |
SET @saved_exempt= @@global.connection_control_exempt_unknown_users; |
| 13 |
# Set small values for connection_control variables |
| 14 |
SET @@global.connection_control_failed_connections_threshold = 3; |
| 15 |
SET @@global.connection_control_max_connection_delay = 1000; |
| 16 |
SET @@global.connection_control_exempt_unknown_users= 1; |
| 17 |
|
| 18 |
# ---------------------------------------------------------------------- |
| 19 |
|
| 20 |
# Following attempts will not experience any delay in server respose |
| 21 |
# Connection attempt should fail. |
| 22 |
Connection_control_delay_generated should be 0 |
| 23 |
Variable_name Value |
| 24 |
Connection_control_delay_generated 0 |
| 25 |
# Connection attempt should fail. |
| 26 |
Connection_control_delay_generated should be 0 |
| 27 |
Variable_name Value |
| 28 |
Connection_control_delay_generated 0 |
| 29 |
# Connection attempt should fail. |
| 30 |
Connection_control_delay_generated should be 0 |
| 31 |
Variable_name Value |
| 32 |
Connection_control_delay_generated 0 |
| 33 |
# Connection attempt should fail. |
| 34 |
Connection_control_delay_generated should be 0 |
| 35 |
Variable_name Value |
| 36 |
Connection_control_delay_generated 0 |
| 37 |
# Connection attempt should fail. |
| 38 |
Connection_control_delay_generated should be 0 |
| 39 |
Variable_name Value |
| 40 |
Connection_control_delay_generated 0 |
| 41 |
# Connection attempt should fail. |
| 42 |
Connection_control_delay_generated should be 0 |
| 43 |
Variable_name Value |
| 44 |
Connection_control_delay_generated 0 |
| 45 |
# Connection attempt should fail. |
| 46 |
Connection_control_delay_generated should be 0 |
| 47 |
Variable_name Value |
| 48 |
Connection_control_delay_generated 0 |
| 49 |
# Connection attempt should fail. |
| 50 |
Connection_control_delay_generated should be 0 |
| 51 |
Variable_name Value |
| 52 |
Connection_control_delay_generated 0 |
| 53 |
# Connection attempt should fail. |
| 54 |
Connection_control_delay_generated should be 0 |
| 55 |
Variable_name Value |
| 56 |
Connection_control_delay_generated 0 |
| 57 |
|
| 58 |
# Following attempts will experience delay in server respose |
| 59 |
# Connection attempt should fail. |
| 60 |
Connection_control_delay_generated should be 1 |
| 61 |
Variable_name Value |
| 62 |
Connection_control_delay_generated 1 |
| 63 |
# Connection attempt should fail. |
| 64 |
Connection_control_delay_generated should be 2 |
| 65 |
Variable_name Value |
| 66 |
Connection_control_delay_generated 2 |
| 67 |
# Connection attempt should fail. |
| 68 |
Connection_control_delay_generated should be 3 |
| 69 |
Variable_name Value |
| 70 |
Connection_control_delay_generated 3 |
| 71 |
SELECT * FROM INFORMATION_SCHEMA.connection_control_failed_login_attempts; |
| 72 |
USERHOST FAILED_ATTEMPTS |
| 73 |
'u1'@'localhost' 4 |
| 74 |
'u2'@'localhost' 4 |
| 75 |
'u3'@'localhost' 4 |
| 76 |
# Connection attempt should fail. |
| 77 |
Connection_control_delay_generated should be 4 |
| 78 |
Variable_name Value |
| 79 |
Connection_control_delay_generated 4 |
| 80 |
# Connection attempt should fail. |
| 81 |
Connection_control_delay_generated should be 5 |
| 82 |
Variable_name Value |
| 83 |
Connection_control_delay_generated 5 |
| 84 |
# Connection attempt should fail. |
| 85 |
Connection_control_delay_generated should be 6 |
| 86 |
Variable_name Value |
| 87 |
Connection_control_delay_generated 6 |
| 88 |
SELECT * FROM INFORMATION_SCHEMA.connection_control_failed_login_attempts; |
| 89 |
USERHOST FAILED_ATTEMPTS |
| 90 |
'u1'@'localhost' 5 |
| 91 |
'u2'@'localhost' 5 |
| 92 |
'u3'@'localhost' 5 |
| 93 |
|
| 94 |
# ---------------------------------------------------------------------- |
| 95 |
|
| 96 |
# Cleanup |
| 97 |
# Restore original values of conenction_control variables |
| 98 |
SET @@global.connection_control_failed_connections_threshold = @saved_connections_threshold; |
| 99 |
SET @@global.connection_control_max_connection_delay = @saved_max_delay; |
| 100 |
SET @@global.connection_control_exempt_unknown_users= @saved_exempt; |
| 101 |
# Uninstall connection_control plugin |
| 102 |
UNINSTALL PLUGIN connection_control; |
| 103 |
UNINSTALL PLUGIN connection_control_failed_login_attempts; |
| 104 |
|
| 105 |
# ---------------------------------------------------------------------- |