Bug #69807 | Host cache counter isn't reset on valid connection | ||
---|---|---|---|
Submitted: | 21 Jul 2013 22:54 | Modified: | 1 Aug 2013 7:26 |
Reporter: | Todd Farmer (OCA) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Security: Privileges | Severity: | S2 (Serious) |
Version: | 5.6.11 | OS: | Windows (7) |
Assigned to: | Marc ALFF | CPU Architecture: | Any |
[21 Jul 2013 22:54]
Todd Farmer
[22 Jul 2013 14:19]
Todd Farmer
This is a regression from 5.5: C:\mysql-5.5.27-winx64>bin\mysql -uroot -P3307 -e"SET GLOBAL max_connect_errors= 2;FLUSH HOSTS;" C:\mysql-5.5.27-winx64>start telnet 192.168.2.8 3307 C:\mysql-5.5.27-winx64>start telnet 192.168.2.8 3307 C:\mysql-5.5.27-winx64>start telnet 192.168.2.8 3307 C:\mysql-5.5.27-winx64>bin\mysql -utest_mce -P3307 -h192.168.2.8 ERROR 1129 (HY000): Host 'Crowder' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' C:\mysql-5.5.27-winx64>bin\mysql -uroot -P3307 -e"FLUSH HOSTS;" C:\mysql-5.5.27-winx64>bin\mysql -utest_mce -P3307 -h192.168.2.8 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 Server version: 5.5.27 MySQL Community Server (GPL) Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> exit; Bye C:\mysql-5.5.27-winx64>start telnet 192.168.2.8 3307 C:\mysql-5.5.27-winx64>start telnet 192.168.2.8 3307 C:\mysql-5.5.27-winx64>bin\mysql -utest_mce -P3307 -h192.168.2.8 -e"SELECT 1;" +---+ | 1 | +---+ | 1 | +---+ C:\mysql-5.5.27-winx64>start telnet 192.168.2.8 3307 C:\mysql-5.5.27-winx64>bin\mysql -utest_mce -P3307 -h192.168.2.8 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 14 Server version: 5.5.27 MySQL Community Server (GPL) Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
[22 Jul 2013 14:30]
Peter Laursen
I am not sure if the problem is with host cache or (only) with P_S. Maybe just P_S does not *mirror* the host cache here?
[22 Jul 2013 14:46]
Todd Farmer
Hi Peter, The problem is with the host cache itself (and I'll speculate that the behavior regarding resetting the host-specific counter towards max_connect_errors was changed during implementation of P_S.HOST_CACHE). This can be demonstrated without querying P_S.HOST_CACHE, as I did with 5.5.27 below: 1. Create an account allowing access from any host. 2. Confirm it works from remote host 3. Using root, set global max_connect_errors to 2 and issue FLUSH HOSTS 4. Do telnet from remote host to MySQL Sever instance twice, wait for timeout during handshake. 5. Establish new connection from same remote host using account created in 1. 6. Do telnet from remote host to MySQL Server instance once, wait for timeout during handshake. 7. Try to establish new connection from same remote host using same account. In 5.5.27, step #7 succeeds. In 5.6.11, it fails. The good news in all of this is that P_S.HOSTS allows DBAs to monitor whether hosts are approaching or exceeding max_connect_errors and take appropriate action (FLUSH HOSTS) to avoid affecting deployments.
[1 Aug 2013 7:26]
Erlend Dahl
[29 Jul 2013 11:42] Paul Dubois Noted in 5.6.14, 5.7.2 changelogs. A successful connection failed to reset the per-IP address counter used to count successive connection failures. This could possibly cause a host to be blocked, when the max_connect_errors limit was reached.