--- fail2ban-0.8.6.orig/config/filter.d/apache-auth.conf +++ fail2ban-0.8.6/config/filter.d/apache-auth.conf @@ -5,6 +5,12 @@ # $Revision$ # +[INCLUDES] + +# Read common prefixes. If any customizations available -- read them from +# common.local +before = apache-common.conf + [Definition] # Option: failregex @@ -14,9 +20,7 @@ # (?:::f{4,6}:)?(?P[\w\-.^_]+) # Values: TEXT # -failregex = [[]client []] user .* authentication failure - [[]client []] user .* not found - [[]client []] user .* password mismatch +failregex = ^%(_apache_error_client)s user .* (authentication failure|not found|password mismatch)\s*$ # Option: ignoreregex # Notes.: regex to ignore. If this regex matches, the line is ignored. --- fail2ban-0.8.6.orig/config/filter.d/apache-common.conf +++ fail2ban-0.8.6/config/filter.d/apache-common.conf @@ -0,0 +1,17 @@ +# Generic configuration items (to be used as interpolations) in other +# apache filters +# +# Author: Yaroslav Halchenko +# +# + +[INCLUDES] + +# Load customizations if any available +after = apache-common.local + + +[DEFAULT] + +# Common prefix for [error] apache messages which also would include +_apache_error_client = \[[^]]+\] \[error\] \[client \] --- fail2ban-0.8.6.orig/config/filter.d/apache-overflows.conf +++ fail2ban-0.8.6/config/filter.d/apache-overflows.conf @@ -5,13 +5,19 @@ # $Revision$ # +[INCLUDES] + +# Read common prefixes. If any customizations available -- read them from +# common.local +before = apache-common.conf + [Definition] # Option: failregex # Notes.: Regexp to catch Apache overflow attempts. # Values: TEXT # -failregex = [[]client []] (Invalid (method|URI) in request|request failed: URI too long|erroneous characters after protocol string) +failregex = ^%(_apache_error_client)s (Invalid (method|URI) in request|request failed: URI too long|erroneous characters after protocol string) # Option: ignoreregex # Notes.: regex to ignore. If this regex matches, the line is ignored. --- fail2ban-0.8.6.orig/config/filter.d/apache-nohome.conf +++ fail2ban-0.8.6/config/filter.d/apache-nohome.conf @@ -5,6 +5,12 @@ # $Revision$ # +[INCLUDES] + +# Read common prefixes. If any customizations available -- read them from +# common.local +before = apache-common.conf + [Definition] # Option: failregex @@ -14,7 +20,7 @@ # per-domain log files. # Values: TEXT # -failregex = [[]client []] File does not exist: .*/~.* +failregex = ^%(_apache_error_client)s File does not exist: .*/~.* # Option: ignoreregex # Notes.: regex to ignore. If this regex matches, the line is ignored. --- fail2ban-0.8.6.orig/config/filter.d/apache-noscript.conf +++ fail2ban-0.8.6/config/filter.d/apache-noscript.conf @@ -5,6 +5,12 @@ # $Revision$ # +[INCLUDES] + +# Read common prefixes. If any customizations available -- read them from +# common.local +before = apache-common.conf + [Definition] # Option: failregex @@ -14,8 +20,8 @@ # (?:::f{4,6}:)?(?P[\w\-.^_]+) # Values: TEXT # -failregex = [[]client []] (File does not exist|script not found or unable to stat): /\S*(\.php|\.asp|\.exe|\.pl) - [[]client []] script '/\S*(\.php|\.asp|\.exe|\.pl)\S*' not found or unable to stat *$ +failregex = ^%(_apache_error_client)s (File does not exist|script not found or unable to stat): /\S*(\.php|\.asp|\.exe|\.pl)\s*$ + ^%(_apache_error_client)s script '/\S*(\.php|\.asp|\.exe|\.pl)\S*' not found or unable to stat\s*$ # Option: ignoreregex # Notes.: regex to ignore. If this regex matches, the line is ignored. --- fail2ban-0.8.6.orig/config/action.d/iptables-xt_recent-echo.conf +++ fail2ban-0.8.6/config/action.d/iptables-xt_recent-echo.conf @@ -0,0 +1,76 @@ +# Fail2Ban configuration file +# +# Author: Zbigniew Jędrzejewski-Szmek +# +# $Revision: 1 $ +# + +[Definition] + +# Option: actionstart +# Notes.: command executed once at the start of Fail2Ban. +# Values: CMD +# +# Changing iptables rules requires root priviledges. If fail2ban is +# configured to run as root, firewall setup can be performed by +# fail2ban automatically. However, if fail2ban is configured to run as +# a normal user, the configuration must be done by some other means +# (e.g. using static firewall configuration with the +# iptables-persistent package). +# +# Explanation of the rule below: +# Check if any packets coming from an IP on the fail2ban- +# list have been seen in the last 3600 seconds. If yes, update the +# timestamp for this IP and drop the packet. If not, let the packet +# through. +# +# Fail2ban inserts blacklisted hosts into the fail2ban- list +# and removes them from the list after some time, according to its +# own rules. The 3600 second timeout is independent and acts as a +# safeguard in case the fail2ban process dies unexpectedly. The +# shorter of the two timeouts actually matters. +actionstart = iptables -I INPUT -m recent --update --seconds 3600 --name fail2ban- -j DROP + +# Option: actionstop +# Notes.: command executed once at the end of Fail2Ban +# Values: CMD +# +actionstop = echo / > /proc/net/xt_recent/fail2ban- + +# Option: actioncheck +# Notes.: command executed once before each actionban command +# Values: CMD +# +actioncheck = test -e /proc/net/xt_recent/fail2ban- + +# Option: actionban +# Notes.: command executed when banning an IP. Take care that the +# command is executed with Fail2Ban user rights. +# Tags: IP address +# number of failures +#