| 1 |
# Connection delay tests for unauthenticated connections |
| 2 |
# (with or without control exemption) |
| 3 |
|
| 4 |
# ---------------------------------------------------------------------- |
| 5 |
|
| 6 |
# Setup |
| 7 |
# Install connection_control plugin |
| 8 |
INSTALL PLUGIN connection_control SONAME 'CONNECTION_CONTROL_LIB'; |
| 9 |
INSTALL PLUGIN connection_control_failed_login_attempts SONAME 'CONNECTION_CONTROL_LIB'; |
| 10 |
# Save original values of connection_control variables |
| 11 |
SET @saved_connections_threshold = @@global.connection_control_failed_connections_threshold; |
| 12 |
SET @saved_max_delay = @@global.connection_control_max_connection_delay; |
| 13 |
SET @saved_exempt= @@global.connection_control_exempt_unknown_users; |
| 14 |
# Set small values for connection_control variables |
| 15 |
SET @@global.connection_control_failed_connections_threshold = 2; |
| 16 |
SET @global.connection_control_max_connection_delay = 1000; |
| 17 |
# Check initial Connection_control_exempted_unknown_users - Should be 0 |
| 18 |
SHOW STATUS LIKE 'Connection_control_exempted_unknown_users'; |
| 19 |
Variable_name Value |
| 20 |
Connection_control_exempted_unknown_users 0 |
| 21 |
|
| 22 |
# ---------------------------------------------------------------------- |
| 23 |
|
| 24 |
# Following attempt will not experience any delay in server response (exempt enabled) |
| 25 |
SET @@global.connection_control_exempt_unknown_users= 1; |
| 26 |
closing connection |
| 27 |
closing connection |
| 28 |
closing connection |
| 29 |
Connection_control_delay_generated should be 0 |
| 30 |
SHOW STATUS LIKE 'Connection_control_delay_generated'; |
| 31 |
Variable_name Value |
| 32 |
Connection_control_delay_generated 0 |
| 33 |
# Connection_control_exempted_unknown_users should be 3 |
| 34 |
SHOW STATUS LIKE 'Connection_control_exempted_unknown_users'; |
| 35 |
Variable_name Value |
| 36 |
Connection_control_exempted_unknown_users 3 |
| 37 |
# Following attempt will experience delay in server response (exempt disabled) |
| 38 |
SET @@global.connection_control_exempt_unknown_users= 0; |
| 39 |
closing connection |
| 40 |
closing connection |
| 41 |
closing connection |
| 42 |
Connection_control_delay_generated should be 1 |
| 43 |
SHOW STATUS LIKE 'Connection_control_delay_generated'; |
| 44 |
Variable_name Value |
| 45 |
Connection_control_delay_generated 1 |
| 46 |
# Connection_control_exempted_unknown_users should still be 3 |
| 47 |
SHOW STATUS LIKE 'Connection_control_exempted_unknown_users'; |
| 48 |
Variable_name Value |
| 49 |
Connection_control_exempted_unknown_users 3 |
| 50 |
|
| 51 |
# ---------------------------------------------------------------------- |
| 52 |
|
| 53 |
# Cleanup |
| 54 |
# Restore original values of connection_control variables |
| 55 |
SET @@global.connection_control_failed_connections_threshold = @saved_connections_threshold; |
| 56 |
SET @@global.connection_control_max_connection_delay = @saved_max_delay; |
| 57 |
SET @@global.connection_control_exempt_unknown_users= @saved_exempt; |
| 58 |
# Uninstall connection_control plugin |
| 59 |
UNINSTALL PLUGIN connection_control; |
| 60 |
UNINSTALL PLUGIN connection_control_failed_login_attempts; |
| 61 |
|
| 62 |
# ---------------------------------------------------------------------- |