Setting Fail2ban to track attacks in IspConfig setup

karatekidWe have an ISPConfig setup for some of our web hosting, and I noticed a lot of brute force attempts in analyzing /var/log/apache/error.log.

[Sat Jul 11 09:55:03 2015] [error] [client XX.XX.XX.XX] script '/var/www/setup.php' not found or unable to stat
.....
[Sat Jul 11 09:55:03 2015] [error] [client XX.XX.XX.XX] script '/var/www/xmlrpc.php' not found or unable to stat
.....

To solve this brute force attempts we added the following rules in fail2ban.
/etc/fail2ban/jail.conf

[apache-scripts-bots]
enabled  = true
port     = http,https
filter   = apache-scripts-bots
logpath  = /var/log/apache*/*error.log
maxretry = 3

/etc/fail2ban/filter.d/apache-scripts-bots.conf

[INCLUDES]



[Definition]

# Option:  failregex
# Notes.:  regex to match the password failure messages in the logfile. The
#          host must be matched by a group named "host". The tag "<HOST>" can
#          be used for standard IP/hostname matching and is only an alias for
#          (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
# Values:  TEXT
#
failregex =  [[]client <HOST>[]] File does not exist: /\S*admin*
	     [[]client <HOST>[]] script '/[^ ]*(xmlrpc|site|awstatstotals|main|setup)\.php' not found or unable to stat


# Option:  ignoreregex
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
# Values:  TEXT
#
ignoreregex = 

Att.: It is possible to check the fail2bas rules using

fail2ban-regex <path to logpath> <path to fail2ban filter>

i.e.

fail2ban-regex /var/log/apache2/error.log /etc/fail2ban/filter.d/apache-admin.conf

Linkografia
Fail2Ban Wiki
New Brute Force Attacks Exploiting XMLRPC in WordPress