I've created a jail and action in an attempt to catch "DDoS attacks", however the log files show errors for this jail whenever I restart Fail2Ban. The jail & filter seem fairly straightforward, and reproduced in several blogs, but the one I've used for comparison is here.
This is the jail:
[http-get-dos]
enabled = true
filter = http-get-dos
action = iptables[name=Http-Get-Dos, port="http,https"]
logpath = %(apache_access_log)s
maxretry = 300
findtime = 300
bantime = 300
and this is the filter:
# Fail2Ban configuration file
#
[Definition]
# Option: failregex
# Note: This regex will match any GET entry in your logs
# You should set up in the jail.conf file, the maxretry and findtime carefully
failregex = ^<HOST> -.*"(GET|POST).*
# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
#
This all looks straightforward, but for some reason if I restart the service after enabling this jail, I see the following errors in the Fail2ban log:
2017-11-04 12:48:13,296 fail2ban.jail [1460]: INFO Creating new jail 'http-get-dos'
2017-11-04 12:48:13,298 fail2ban.jail [1460]: INFO Jail 'http-get-dos' uses poller
2017-11-04 12:48:13,300 fail2ban.filter [1460]: INFO Set jail log file encoding to UTF-8
2017-11-04 12:48:13,300 fail2ban.jail [1460]: INFO Initiated 'polling' backend
2017-11-04 12:48:13,303 fail2ban.actions [1460]: INFO Set banTime = 300
2017-11-04 12:48:13,304 fail2ban.filter [1460]: INFO Set findtime = 300
2017-11-04 12:48:13,306 fail2ban.filter [1460]: INFO Added logfile = /var/log/apache2/access.log
2017-11-04 12:48:13,308 fail2ban.filter [1460]: INFO Added logfile = /var/log/apache2/other_vhosts_access.log
2017-11-04 12:48:13,309 fail2ban.filter [1460]: INFO Set jail log file encoding to UTF-8
2017-11-04 12:48:13,310 fail2ban.filter [1460]: INFO Set maxRetry = 300
2017-11-04 12:48:14,411 fail2ban.action [1460]: ERROR iptables -w -N f2b-Http-Get-Dos
iptables -w -A f2b-Http-Get-Dos -j RETURN
iptables -w -I INPUT -p tcp --dport http,https -j f2b-Http-Get-Dos -- stdout: b''
2017-11-04 12:48:14,441 fail2ban.action [1460]: ERROR iptables -w -N f2b-Http-Get-Dos
iptables -w -A f2b-Http-Get-Dos -j RETURN
iptables -w -I INPUT -p tcp --dport http,https -j f2b-Http-Get-Dos -- stderr: b"iptables v1.6.0: invalid port/service `http,https' specified\nTry `iptables -h' or 'iptables --help' for more information.\n"
2017-11-04 12:48:14,458 fail2ban.action [1460]: ERROR iptables -w -N f2b-Http-Get-Dos
iptables -w -A f2b-Http-Get-Dos -j RETURN
iptables -w -I INPUT -p tcp --dport http,https -j f2b-Http-Get-Dos -- returned 2
2017-11-04 12:48:14,463 fail2ban.actions [1460]: ERROR Failed to start jail 'http-get-dos' action 'iptables': Error starting action
2017-11-04 12:48:20,150 fail2ban.jail [1460]: INFO Jail 'http-get-dos' started
It appears that the action part of the jail is causing an issue, however I don't understand why. The action is similar to that used by other jails.
Any ideas how I can resolve this to get the jail running properly?