Linux-Debian поставил правило из пакета
# Fail2Ban filter for unsuccesfull MySQL authentication attempts
#
#
# To log wrong MySQL access attempts add to /etc/my.cnf in [mysqld]:
# log-error=/var/log/mysqld.log
# log-warning = 2
#
# If using mysql syslog [mysql_safe] has syslog in /etc/my.cnf
[INCLUDES]
# Read common prefixes. If any customizations available -- read them from
# common.local
before = common.conf
[Definition]
_daemon = mysqld
failregex = ^%(__prefix_line)s(\d{6} \s?\d{1,2}:\d{2}:\d{2} )?\[Warning\] Access denied for user '\w+'@'<HOST>' (to database '[^']*'|\(using password: (YES|NO)\))*\s*$
ignoreregex =
# DEV Notes:
#
# Technically __prefix_line can equate to an empty string hence it can support
# syslog and non-syslog at once.
# Example:
# 130322 11:26:54 [Warning] Access denied for user 'root'@'127.0.0.1' (using password: YES)
#
# Authors: Artur Penttinen
# Yaroslav O. Halchenko
fail2ban-regex /var/log/mysql/error.log /etc/fail2ban/filter.d/mysql.conf
Running tests
=============
Use regex file : /etc/fail2ban/filter.d/mysql.conf
Use log file : /var/log/mysql/error.log
Found a match for '141201 15:58:01 [Warning] Access denied for user 'root'@'104.194.19.65' (using password: NO)
' but no valid date/time found for '141201 15:58:01 [Warning] Access denied for user 'root'@'104.194.19.65' (using password: NO)
'. Please contact the author in order to get support for this format
Found a match for '141201 15:58:02 [Warning] Access denied for user 'root'@'104.194.19.65' (using password: NO)
' but no valid date/time found for '141201 15:58:02 [Warning] Access denied for user 'root'@'104.194.19.65' (using password: NO)
'. Please contact the author in order to get support for this format
Found a match for '141201 15:58:03 [Warning] Access denied for user 'root'@'104.194.19.65' (using password: NO)
' but no valid date/time found for '141201 15:58:03 [Warning] Access denied for user 'root'@'104.194.19.65' (using password: NO)
'. Please contact the author in order to get support for this format
Results
=======
Failregex
|- Regular expressions:
| [1] ^\s*(?:\S+ )?(?:kernel: \[\d+\.\d+\] )?(?:@vserver_\S+ )?(?:(?:\[\d+\])?:\s+[\[\(]?mysqld(?:\(\S+\))?[\]\)]?:?|[\[\(]?mysqld(?:\(\S+\))?[\]\)]?:?(?:\[\d+\])?:)?\s*(\d{6} \s?\d{1,2}:\d{2}:\d{2} )?\[Warning\] Access denied for user '\w+'@'<HOST>' (to database '[^']*'|\(using password: (YES|NO)\))*\s*$
|
`- Number of matches:
[1] 0 match(es)
Ignoreregex
|- Regular expressions:
|
`- Number of matches:
Summary
=======
Sorry, no match
Look at the above section 'Running tests' which could contain important
information.
141201 15:58:01 [Warning] Access denied for user 'root'@'104.194.19.65' (using password: NO)
141201 15:58:02 [Warning] Access denied for user 'root'@'104.194.19.65' (using password: NO)
141201 15:58:03 [Warning] Access denied for user 'root'@'104.194.19.65' (using password: NO)
141201 15:58:04 [Warning] Access denied for user 'root'@'104.194.19.65' (using password: NO)
141201 15:58:05 [Warning] Access denied for user 'root'@'104.194.19.65' (using password: NO)
141201 15:58:06 [Warning] Access denied for user 'root'@'104.194.19.65' (using password: NO)
141201 15:58:07 [Warning] Access denied for user 'root'@'104.194.19.65' (using password: NO)
Спасибо.