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