4 |
- |
1 |
# Fail2Ban configuration file
|
|
|
2 |
#
|
|
|
3 |
# Author: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
|
|
|
4 |
#
|
|
|
5 |
#
|
|
|
6 |
|
|
|
7 |
[INCLUDES]
|
|
|
8 |
|
34 |
- |
9 |
before = iptables-common.conf
|
4 |
- |
10 |
|
|
|
11 |
[Definition]
|
|
|
12 |
|
|
|
13 |
# Option: actionstart
|
|
|
14 |
# Notes.: command executed once at the start of Fail2Ban.
|
|
|
15 |
# Values: CMD
|
|
|
16 |
#
|
|
|
17 |
# Changing iptables rules requires root privileges. If fail2ban is
|
|
|
18 |
# configured to run as root, firewall setup can be performed by
|
|
|
19 |
# fail2ban automatically. However, if fail2ban is configured to run as
|
|
|
20 |
# a normal user, the configuration must be done by some other means
|
|
|
21 |
# (e.g. using static firewall configuration with the
|
|
|
22 |
# iptables-persistent package).
|
|
|
23 |
#
|
|
|
24 |
# Explanation of the rule below:
|
34 |
- |
25 |
# Check if any packets coming from an IP on the f2b-<name>
|
4 |
- |
26 |
# list have been seen in the last 3600 seconds. If yes, update the
|
|
|
27 |
# timestamp for this IP and drop the packet. If not, let the packet
|
|
|
28 |
# through.
|
|
|
29 |
#
|
34 |
- |
30 |
# Fail2ban inserts blacklisted hosts into the f2b-<name> list
|
4 |
- |
31 |
# and removes them from the list after some time, according to its
|
|
|
32 |
# own rules. The 3600 second timeout is independent and acts as a
|
|
|
33 |
# safeguard in case the fail2ban process dies unexpectedly. The
|
|
|
34 |
# shorter of the two timeouts actually matters.
|
39 |
- |
35 |
actionstart = if [ `id -u` -eq 0 ];then <iptables> -I <chain> -m recent --update --seconds 3600 --name f2b-<name> -j <blocktype>;fi
|
4 |
- |
36 |
|
|
|
37 |
# Option: actionstop
|
|
|
38 |
# Notes.: command executed once at the end of Fail2Ban
|
|
|
39 |
# Values: CMD
|
|
|
40 |
#
|
34 |
- |
41 |
actionstop = echo / > /proc/net/xt_recent/f2b-<name>
|
39 |
- |
42 |
if [ `id -u` -eq 0 ];then <iptables> -D <chain> -m recent --update --seconds 3600 --name f2b-<name> -j <blocktype>;fi
|
4 |
- |
43 |
|
|
|
44 |
# Option: actioncheck
|
|
|
45 |
# Notes.: command executed once before each actionban command
|
|
|
46 |
# Values: CMD
|
|
|
47 |
#
|
34 |
- |
48 |
actioncheck = test -e /proc/net/xt_recent/f2b-<name>
|
4 |
- |
49 |
|
|
|
50 |
# Option: actionban
|
|
|
51 |
# Notes.: command executed when banning an IP. Take care that the
|
|
|
52 |
# command is executed with Fail2Ban user rights.
|
|
|
53 |
# Tags: See jail.conf(5) man page
|
|
|
54 |
# Values: CMD
|
|
|
55 |
#
|
34 |
- |
56 |
actionban = echo +<ip> > /proc/net/xt_recent/f2b-<name>
|
4 |
- |
57 |
|
|
|
58 |
# Option: actionunban
|
|
|
59 |
# Notes.: command executed when unbanning an IP. Take care that the
|
|
|
60 |
# command is executed with Fail2Ban user rights.
|
|
|
61 |
# Tags: See jail.conf(5) man page
|
|
|
62 |
# Values: CMD
|
|
|
63 |
#
|
34 |
- |
64 |
actionunban = echo -<ip> > /proc/net/xt_recent/f2b-<name>
|
4 |
- |
65 |
|
|
|
66 |
[Init]
|
|
|
67 |
|