В моем журнале ошибок apache много следующих сообщений об ошибках:
[Thu Dec 16 15:13:24 2010] [error] [client 168.144.92.191] File does not exist: /var/www/mydomain/fud
[Thu Dec 16 15:13:24 2010] [error] [client 168.144.92.191] File does not exist: /var/www/mydomain/flag, referer: http://lexington.craigslist.org/fud/2076870022.html
[Thu Dec 16 15:14:28 2010] [error] [client 168.144.92.191] File does not exist: /var/www/mydomain/flag, referer: http://lexington.craigslist.org/fud/2115799176.html
[Thu Dec 16 15:17:51 2010] [error] [client 168.144.92.191] File does not exist: /var/www/mydomain/fud
В моем /etc/fail2ban/jail.local У меня есть:
# Fail2Ban configuration file.
#
# This file was composed for Debian systems from the original one
# provided now under /usr/share/doc/fail2ban/examples/jail.conf
# for additional examples.
#
# To avoid merges during upgrades DO NOT MODIFY THIS FILE
# and rather provide your changes in /etc/fail2ban/jail.local
#
# Author: Yaroslav O. Halchenko <debian@onerussian.com>
#
# $Revision: 281 $
#
# The DEFAULT allows a global definition of the options. They can be override
# in each jail afterwards.
[DEFAULT]
# "ignoreip" can be an IP address, a CIDR mask or a DNS host
ignoreip = myip
bantime = -1
maxretry = 3
# "backend" specifies the backend used to get files modification. Available
# options are "gamin", "polling" and "auto".
# yoh: For some reason Debian shipped python-gamin didn't work as expected
# This issue left ToDo, so polling is default backend for now
backend = polling
#
# Destination email address used solely for the interpolations in
# jail.{conf,local} configuration files.
destemail = root@localhost
#
# ACTIONS
#
# Default banning action (e.g. iptables, iptables-new,
# iptables-multiport, shorewall, etc) It is used to define
# action_* variables. Can be overriden globally or per
# section within jail.local file
banaction = iptables-allports
# email action. Since 0.8.1 upstream fail2ban uses sendmail
# MTA for the mailing. Change mta configuration parameter to mail
# if you want to revert to conventional 'mail'.
mta = sendmail
# Default protocol
protocol = tcp
#
# Action shortcuts. To be used to define action parameter
# The simplest action to take: ban only
action_ = %(banaction)s[name=%(__name__)s, port="%(port)s", protocol="%(protocol)s]
# ban & send an e-mail with whois report to the destemail.
action_mw = %(banaction)s[name=%(__name__)s, port="%(port)s", protocol="%(protocol)s]
%(mta)s-whois[name=%(__name__)s, dest="%(destemail)s", protocol="%(protocol)s]
# ban & send an e-mail with whois report and relevant log lines
# to the destemail.
action_mwl = %(banaction)s[name=%(__name__)s, port="%(port)s", protocol="%(protocol)s]
%(mta)s-whois-lines[name=%(__name__)s, dest="%(destemail)s", logpath=%(logpath)s]
# Choose default action. To change, just override value of 'action' with the
# interpolation to the chosen action shortcut (e.g. action_mw, action_mwl, etc) in jail.local
# globally (section [DEFAULT]) or per specific section
action = %(action_mw)s
#
# JAILS
#
#
# HTTP servers
#
[apache]
enabled = true
port = http,https
filter = apache-auth
logpath = /var/log/apache2/error.log
maxretry = 3
# default action is now multiport, so apache-multiport jail was left
# for compatibility with previous (<0.7.6-2) releases
[apache-multiport]
enabled = false
port = http,https
filter = apache-auth
logpath = /var/log/apache*/*error.log
maxretry = 6
[apache-noscript]
enabled = true
port = http,https
filter = apache-noscript
logpath = /var/log/apache2/error.log
maxretry = 3
[apache-overflows]
enabled = false
port = http,https
filter = apache-overflows
logpath = /var/log/apache*/*error.log
maxretry = 2
В моем /etc/fail2ban/filter.d/apache-noscript.conf У меня есть:
failregex = [[]client <HOST>[]] (File does not exist|script not found or unable to stat): .*
failregex = [[]client <HOST>[]] script '.*' not found or unable to stat
В моем /var/log/fail2ban.log есть записи только с того момента, когда он был впервые запущен. Ничего подобного в моем denyhosts.log нет упоминания о запрещенных IP.
Проверка "iptables -L -v -n" показывает:
Chain INPUT (policy ACCEPT 834K packets, 145M bytes)
pkts bytes target prot opt in out source destination
403 71010 fail2ban-apache tcp -- * * 0.0.0.0/0 0.0.0.0/0
403 71010 fail2ban-apache-noscript tcp -- * * 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 574K packets, 976M bytes)
pkts bytes target prot opt in out source destination
Chain fail2ban-apache (1 references)
pkts bytes target prot opt in out source destination
403 71010 RETURN all -- * * 0.0.0.0/0 0.0.0.0/0
Chain fail2ban-apache-noscript (1 references)
pkts bytes target prot opt in out source destination
403 71010 RETURN all -- * * 0.0.0.0/0 0.0.0.0/0
Что мне не хватает или что я сделал не так?
**** Сообщение обновлено, чтобы показать полные файлы jail.local, а не только раздел jail Apache и результаты "iptables -L -v -n". **
Я думаю, что вторая строка в apache-noscript.conf уничтожает первую.
Попробуй это:
failregex = [[]client <HOST>[]] (File does not exist|script not found or unable to stat): .*
[[]client <HOST>[]] script '.*' not found or unable to stat
Если нет значения по умолчанию action
Я скучаю, у тебя нет action
линия. Вот мой (который работает):
[apache-noscript]
enabled = true
filter = apache-noscript
action = iptables-multiport[name=NoScript, port="http,https"]
logpath = /usr/local/www/sites/*/logs/*_error_log
bantime = 172800
maxretry = 5
Я упростил регулярное выражение соответствия до 1 строки:
failregex = [[]client <HOST>[]] (File does not exist|script not found or unable to stat)
Делает iptables -L -v -n
хотя бы показать, что цепочки правильно настроены?