4 |
- |
1 |
# Fail2Ban configuration file
|
|
|
2 |
#
|
|
|
3 |
# Author: Guido Bozzetto
|
|
|
4 |
# Modified: Cyril Jaquier
|
|
|
5 |
#
|
|
|
6 |
# make "fail2ban-<name>" chain to match drop IP
|
|
|
7 |
# make "fail2ban-<name>-log" chain to log and drop
|
|
|
8 |
# insert a jump to fail2ban-<name> from -I <chain> if proto/port match
|
|
|
9 |
#
|
|
|
10 |
#
|
|
|
11 |
|
|
|
12 |
[INCLUDES]
|
|
|
13 |
|
|
|
14 |
before = iptables-blocktype.conf
|
|
|
15 |
|
|
|
16 |
[Definition]
|
|
|
17 |
|
|
|
18 |
# Option: actionstart
|
|
|
19 |
# Notes.: command executed once at the start of Fail2Ban.
|
|
|
20 |
# Values: CMD
|
|
|
21 |
#
|
|
|
22 |
actionstart = iptables -N fail2ban-<name>
|
|
|
23 |
iptables -A fail2ban-<name> -j RETURN
|
|
|
24 |
iptables -I <chain> 1 -p <protocol> -m multiport --dports <port> -j fail2ban-<name>
|
|
|
25 |
iptables -N fail2ban-<name>-log
|
|
|
26 |
iptables -I fail2ban-<name>-log -j LOG --log-prefix "$(expr fail2ban-<name> : '\(.\{1,23\}\)'):DROP " --log-level warning -m limit --limit 6/m --limit-burst 2
|
|
|
27 |
iptables -A fail2ban-<name>-log -j <blocktype>
|
|
|
28 |
|
|
|
29 |
# Option: actionstop
|
|
|
30 |
# Notes.: command executed once at the end of Fail2Ban
|
|
|
31 |
# Values: CMD
|
|
|
32 |
#
|
|
|
33 |
actionstop = iptables -D <chain> -p <protocol> -m multiport --dports <port> -j fail2ban-<name>
|
|
|
34 |
iptables -F fail2ban-<name>
|
|
|
35 |
iptables -F fail2ban-<name>-log
|
|
|
36 |
iptables -X fail2ban-<name>
|
|
|
37 |
iptables -X fail2ban-<name>-log
|
|
|
38 |
|
|
|
39 |
# Option: actioncheck
|
|
|
40 |
# Notes.: command executed once before each actionban command
|
|
|
41 |
# Values: CMD
|
|
|
42 |
#
|
|
|
43 |
actioncheck = iptables -n -L fail2ban-<name>-log >/dev/null
|
|
|
44 |
|
|
|
45 |
# Option: actionban
|
|
|
46 |
# Notes.: command executed when banning an IP. Take care that the
|
|
|
47 |
# command is executed with Fail2Ban user rights.
|
|
|
48 |
# Tags: See jail.conf(5) man page
|
|
|
49 |
# Values: CMD
|
|
|
50 |
#
|
|
|
51 |
actionban = iptables -I fail2ban-<name> 1 -s <ip> -j fail2ban-<name>-log
|
|
|
52 |
|
|
|
53 |
# Option: actionunban
|
|
|
54 |
# Notes.: command executed when unbanning an IP. Take care that the
|
|
|
55 |
# command is executed with Fail2Ban user rights.
|
|
|
56 |
# Tags: See jail.conf(5) man page
|
|
|
57 |
# Values: CMD
|
|
|
58 |
#
|
|
|
59 |
actionunban = iptables -D fail2ban-<name> -s <ip> -j fail2ban-<name>-log
|
|
|
60 |
|
|
|
61 |
[Init]
|
|
|
62 |
|
|
|
63 |
# Default name of the chain
|
|
|
64 |
#
|
|
|
65 |
name = default
|
|
|
66 |
|
|
|
67 |
# Option: port
|
|
|
68 |
# Notes.: specifies port to monitor
|
|
|
69 |
# Values: [ NUM | STRING ] Default:
|
|
|
70 |
#
|
|
|
71 |
port = ssh
|
|
|
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
|
|
|
78 |
|
|
|
79 |
# Option: chain
|
|
|
80 |
# Notes specifies the iptables chain to which the fail2ban rules should be
|
|
|
81 |
# added
|
|
|
82 |
# Values: STRING Default: INPUT
|
|
|
83 |
chain = INPUT
|