| 1 |
# Make sure that connection_control plugin can be loaded |
| 2 |
--source ../inc/have_connection_control_plugin.inc |
| 3 |
--source ../inc/have_test_plugin.inc |
| 4 |
|
| 5 |
# Save the initial number of concurrent sessions |
| 6 |
--source include/count_sessions.inc |
| 7 |
|
| 8 |
--echo #----------------------------------------------------------------------- |
| 9 |
--echo # Setup |
| 10 |
--echo # Install connection_control plugin |
| 11 |
--source ../inc/install_connection_control_plugin.inc |
| 12 |
--echo # Do proxy setup |
| 13 |
--source ../inc/setup_proxy_accounts.inc |
| 14 |
|
| 15 |
# Official builds include separate debug enabled plugins to be used by |
| 16 |
# the debug enabled server. But the non-debug *client* should not use them. |
| 17 |
|
| 18 |
let PLUGIN_AUTH_OPT=`SELECT TRIM(TRAILING '/debug' FROM '$PLUGIN_AUTH_OPT')`; |
| 19 |
let CONNECTION_CONTROL_PLUGIN_OPT=`SELECT TRIM(TRAILING '/debug' FROM '$CONNECTION_CONTROL_PLUGIN_OPT')`; |
| 20 |
|
| 21 |
# Suppress error messages from test_plugin_server |
| 22 |
CALL mtr.add_suppression("Plugin test_plugin_server reported: 'Wrong password supplied for proxied'"); |
| 23 |
|
| 24 |
# Save original values of connection_control variables |
| 25 |
SET @saved_connections_threshold = @@global.connection_control_failed_connections_threshold; |
| 26 |
SET @saved_max_delay = @@global.connection_control_max_connection_delay; |
| 27 |
SET @saved_min_delay= @@global.connection_control_min_connection_delay; |
| 28 |
|
| 29 |
# Set a small values for connection_control variables |
| 30 |
SET @@global.connection_control_failed_connections_threshold = 3; |
| 31 |
SET @@global.connection_control_max_connection_delay = 4000; |
| 32 |
SET @@global.connection_control_min_connection_delay = 2000; |
| 33 |
|
| 34 |
# We will use client side authentication plugin for this test. |
| 35 |
let $USE_AUTH_PLUGIN= 1; |
| 36 |
let $CLIENT_AUTH_PLUGIN= $PLUGIN_AUTH_OPT; |
| 37 |
|
| 38 |
--echo #----------------------------------------------------------------------- |
| 39 |
|
| 40 |
--echo # Case 1 : Testss for valid user accounts |
| 41 |
|
| 42 |
--echo # Make enough failed attempts to trigger delays |
| 43 |
|
| 44 |
disable_result_log; |
| 45 |
|
| 46 |
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT |
| 47 |
--error ER_ACCESS_DENIED_ERROR |
| 48 |
connect(fail_con_u1, localhost, u1,,,,,); |
| 49 |
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT |
| 50 |
--error ER_ACCESS_DENIED_ERROR |
| 51 |
connect(fail_con_u1, localhost, u1,haha,,,,); |
| 52 |
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT |
| 53 |
--error ER_ACCESS_DENIED_ERROR |
| 54 |
connect(fail_con_u1, localhost, u2,efgh,,,,); |
| 55 |
|
| 56 |
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT |
| 57 |
--error ER_ACCESS_DENIED_ERROR |
| 58 |
connect(fail_con_u1, localhost, u3,,,,,); |
| 59 |
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT |
| 60 |
--error ER_ACCESS_DENIED_ERROR |
| 61 |
connect(fail_con_u1, localhost, u2,haha,,,,); |
| 62 |
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT |
| 63 |
--error ER_ACCESS_DENIED_ERROR |
| 64 |
connect(fail_con_u1, localhost, u3,efgh,,,,); |
| 65 |
|
| 66 |
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT |
| 67 |
--error ER_ACCESS_DENIED_ERROR |
| 68 |
connect(fail_con_u1, localhost, u2,,,,,); |
| 69 |
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT |
| 70 |
--error ER_ACCESS_DENIED_ERROR |
| 71 |
connect(fail_con_u1, localhost, u1,haha,,,,); |
| 72 |
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT |
| 73 |
--error ER_ACCESS_DENIED_ERROR |
| 74 |
connect(fail_con_u1, localhost, u3,efgh,,,,); |
| 75 |
|
| 76 |
enable_result_log; |
| 77 |
|
| 78 |
--echo # Following attempts will experience delay in server respose |
| 79 |
|
| 80 |
# Trying with invalid passwords |
| 81 |
|
| 82 |
--source ../inc/set_before_marker.inc |
| 83 |
let $USER=u1; |
| 84 |
let $PASSWORD=hoho; |
| 85 |
let $SUCCESS=0; |
| 86 |
let $DELAY_STATS=1; |
| 87 |
--source ../inc/check_connection_delay.inc |
| 88 |
|
| 89 |
let $SERVER_RESPONSE_TIME= 2; |
| 90 |
--source ../inc/set_after_marker.inc |
| 91 |
|
| 92 |
--source ../inc/set_before_marker.inc |
| 93 |
let $USER=u2; |
| 94 |
let $PASSWORD=hoho; |
| 95 |
let $SUCCESS=0; |
| 96 |
let $DELAY_STATS=2; |
| 97 |
--source ../inc/check_connection_delay.inc |
| 98 |
|
| 99 |
let $SERVER_RESPONSE_TIME= 2; |
| 100 |
--source ../inc/set_after_marker.inc |
| 101 |
|
| 102 |
--source ../inc/set_before_marker.inc |
| 103 |
let $USER=u3; |
| 104 |
let $PASSWORD=hoho; |
| 105 |
let $SUCCESS=0; |
| 106 |
let $DELAY_STATS=3; |
| 107 |
--source ../inc/check_connection_delay.inc |
| 108 |
|
| 109 |
let $SERVER_RESPONSE_TIME= 2; |
| 110 |
--source ../inc/set_after_marker.inc |
| 111 |
|
| 112 |
# Trying with valid passwords |
| 113 |
# Even though u1@localhost, u2@localhost and u3@localhost are |
| 114 |
# proxying same user - proxied@localhost, we will not use |
| 115 |
# proxied@localohst for recording failed attempts information. |
| 116 |
# Rather, we will rely on proxying users' data. |
| 117 |
# So each of the following should get delay of 2 seconds |
| 118 |
# or more. |
| 119 |
|
| 120 |
--source ../inc/set_before_marker.inc |
| 121 |
let $USER=u3; |
| 122 |
let $PASSWORD=proxied; |
| 123 |
let $SUCCESS=1; |
| 124 |
let $DELAY_STATS=4; |
| 125 |
--source ../inc/check_connection_delay.inc |
| 126 |
|
| 127 |
let $SERVER_RESPONSE_TIME= 2; |
| 128 |
--source ../inc/set_after_marker.inc |
| 129 |
|
| 130 |
--source ../inc/set_before_marker.inc |
| 131 |
let $USER=u2; |
| 132 |
let $PASSWORD=proxied; |
| 133 |
let $SUCCESS=1; |
| 134 |
let $DELAY_STATS=5; |
| 135 |
--source ../inc/check_connection_delay.inc |
| 136 |
|
| 137 |
let $SERVER_RESPONSE_TIME= 2; |
| 138 |
--source ../inc/set_after_marker.inc |
| 139 |
|
| 140 |
--source ../inc/set_before_marker.inc |
| 141 |
let $USER=u1; |
| 142 |
let $PASSWORD=proxied; |
| 143 |
let $SUCCESS=1; |
| 144 |
let $DELAY_STATS=6; |
| 145 |
--source ../inc/check_connection_delay.inc |
| 146 |
|
| 147 |
let $SERVER_RESPONSE_TIME= 2; |
| 148 |
--source ../inc/set_after_marker.inc |
| 149 |
|
| 150 |
|
| 151 |
--echo # Following attempts will not experience any delay in server respose |
| 152 |
|
| 153 |
let $USER=u1; |
| 154 |
let $PASSWORD=hoho; |
| 155 |
let $SUCCESS=0; |
| 156 |
let $DELAY_STATS=6; |
| 157 |
--source ../inc/check_connection_delay.inc |
| 158 |
|
| 159 |
let $USER=u2; |
| 160 |
let $PASSWORD=hoho; |
| 161 |
let $SUCCESS=0; |
| 162 |
let $DELAY_STATS=6; |
| 163 |
--source ../inc/check_connection_delay.inc |
| 164 |
|
| 165 |
let $USER=u3; |
| 166 |
let $PASSWORD=hoho; |
| 167 |
let $SUCCESS=0; |
| 168 |
let $DELAY_STATS=6; |
| 169 |
--source ../inc/check_connection_delay.inc |
| 170 |
|
| 171 |
let $USER=u1; |
| 172 |
let $PASSWORD=proxied; |
| 173 |
let $SUCCESS=1; |
| 174 |
let $DELAY_STATS=6; |
| 175 |
--source ../inc/check_connection_delay.inc |
| 176 |
|
| 177 |
let $USER=u2; |
| 178 |
let $PASSWORD=proxied; |
| 179 |
let $SUCCESS=1; |
| 180 |
let $DELAY_STATS=6; |
| 181 |
--source ../inc/check_connection_delay.inc |
| 182 |
|
| 183 |
let $USER=u3; |
| 184 |
let $PASSWORD=proxied; |
| 185 |
let $SUCCESS=1; |
| 186 |
let $DELAY_STATS=6; |
| 187 |
--source ../inc/check_connection_delay.inc |
| 188 |
|
| 189 |
--echo #----------------------------------------------------------------------- |
| 190 |
--echo # Cleanup |
| 191 |
|
| 192 |
connection default; |
| 193 |
|
| 194 |
# Restore original values of conenction_control variables |
| 195 |
SET @@global.connection_control_failed_connections_threshold = @saved_connections_threshold; |
| 196 |
SET @@global.connection_control_max_connection_delay = @saved_max_delay; |
| 197 |
SET @@global.connection_control_min_connection_delay = @saved_min_delay; |
| 198 |
|
| 199 |
--echo # Remove user accounts |
| 200 |
--source ../inc/cleanup_proxy_accounts.inc |
| 201 |
--echo # Uninstall connection_control plugin |
| 202 |
--source ../inc/uninstall_connection_control_plugin.inc |
| 203 |
|
| 204 |
# Wait till all disconnects are completed. |
| 205 |
--source include/wait_until_count_sessions.inc |
| 206 |
--echo #----------------------------------------------------------------------- |