2015-02-26 17:48:31 +00:00
|
|
|
# Fail2Ban configuration file
|
|
|
|
#
|
|
|
|
# Author: Eduardo Diaz
|
|
|
|
#
|
|
|
|
# This is for ipset protocol 6 (and hopefully later) (ipset v6.14).
|
|
|
|
# for shorewall
|
|
|
|
#
|
2015-07-27 03:10:08 +00:00
|
|
|
# Use this setting in jail.conf to modify use this action instead of a
|
|
|
|
# default one
|
|
|
|
#
|
|
|
|
# banaction = shorewall-ipset-proto6
|
2015-02-26 17:48:31 +00:00
|
|
|
#
|
|
|
|
# This requires the program ipset which is normally in package called ipset.
|
|
|
|
#
|
2015-07-27 03:10:08 +00:00
|
|
|
# IPset was a feature introduced in the linux kernel 2.6.39 and 3.0.0
|
|
|
|
# kernels, and you need Shorewall >= 4.5.5 to use this action.
|
2015-02-26 17:48:31 +00:00
|
|
|
#
|
|
|
|
# The default Shorewall configuration is with "BLACKLISTNEWONLY=Yes" (see
|
|
|
|
# file /etc/shorewall/shorewall.conf). This means that when Fail2ban adds a
|
|
|
|
# new shorewall rule to ban an IP address, that rule will affect only new
|
2015-07-27 03:10:08 +00:00
|
|
|
# connections. So if the attacker goes on trying using the same connection
|
2015-02-26 17:48:31 +00:00
|
|
|
# he could even log in. In order to get the same behavior of the iptable
|
|
|
|
# action (so that the ban is immediate) the /etc/shorewall/shorewall.conf
|
|
|
|
# file should me modified with "BLACKLISTNEWONLY=No".
|
|
|
|
#
|
|
|
|
#
|
2015-07-27 03:10:08 +00:00
|
|
|
# Enable shorewall to use a blacklist using iptables creating a file
|
|
|
|
# /etc/shorewall/blrules and adding "DROP net:+f2b-ssh all" and
|
|
|
|
# similar lines for every jail. To enable restoring you ipset you
|
|
|
|
# must set SAVE_IPSETS=Yes in shorewall.conf . You can read more
|
|
|
|
# about ipsets handling in Shorewall at http://shorewall.net/ipsets.html
|
2015-02-26 17:48:31 +00:00
|
|
|
#
|
2015-07-27 03:10:08 +00:00
|
|
|
# To force creation of the ipset in the case that somebody deletes the
|
|
|
|
# ipset create a file /etc/shorewall/initdone and add one line for
|
|
|
|
# every ipset (this files are in Perl) and add 1 at the end of the file.
|
|
|
|
# The example:
|
2015-02-26 17:48:31 +00:00
|
|
|
# system("/usr/sbin/ipset -quiet -exist create f2b-ssh hash:ip timeout 600 ");
|
|
|
|
# 1;
|
|
|
|
#
|
|
|
|
# To destroy the ipset in shorewall you must add to the file /etc/shorewall/stopped
|
|
|
|
# # One line of every ipset
|
|
|
|
# system("/usr/sbin/ipset -quiet destroy f2b-ssh ");
|
2015-03-22 23:56:37 +00:00
|
|
|
# 1; # This must go to the end of the file if not shorewall compilation fails
|
2015-02-26 17:48:31 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
[Definition]
|
|
|
|
|
|
|
|
# Option: actionstart
|
2018-09-12 14:00:40 +00:00
|
|
|
# Notes.: command executed on demand at the first ban (or at the start of Fail2Ban if actionstart_on_demand is set to false).
|
2015-02-26 17:48:31 +00:00
|
|
|
# Values: CMD
|
|
|
|
#
|
|
|
|
actionstart = if ! ipset -quiet -name list f2b-<name> >/dev/null;
|
2017-12-06 01:38:10 +00:00
|
|
|
then ipset -quiet -exist create f2b-<name> hash:ip timeout <default-timeout>;
|
2015-02-26 17:48:31 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Option: actionstop
|
2018-09-12 14:00:40 +00:00
|
|
|
# Notes.: command executed at the stop of jail (or at the end of Fail2Ban)
|
2015-02-26 17:48:31 +00:00
|
|
|
# Values: CMD
|
|
|
|
#
|
|
|
|
actionstop = ipset flush f2b-<name>
|
|
|
|
|
|
|
|
# Option: actionban
|
|
|
|
# Notes.: command executed when banning an IP. Take care that the
|
|
|
|
# command is executed with Fail2Ban user rights.
|
|
|
|
# Tags: See jail.conf(5) man page
|
|
|
|
# Values: CMD
|
|
|
|
#
|
|
|
|
actionban = ipset add f2b-<name> <ip> timeout <bantime> -exist
|
|
|
|
|
2017-03-15 09:15:48 +00:00
|
|
|
actionprolong = %(actionban)s
|
|
|
|
|
2015-02-26 17:48:31 +00:00
|
|
|
# Option: actionunban
|
|
|
|
# Notes.: command executed when unbanning an IP. Take care that the
|
|
|
|
# command is executed with Fail2Ban user rights.
|
|
|
|
# Tags: See jail.conf(5) man page
|
|
|
|
# Values: CMD
|
|
|
|
#
|
|
|
|
actionunban = ipset del f2b-<name> <ip> -exist
|
|
|
|
|
2017-12-06 01:38:10 +00:00
|
|
|
# Option: default-timeout
|
|
|
|
# Notes: specifies default timeout in seconds (handled default ipset timeout only)
|
|
|
|
# Values: [ NUM ] Default: 600
|
|
|
|
|
|
|
|
default-timeout = 600
|