4 |
- |
1 |
# Fail2Ban configuration file
|
|
|
2 |
#
|
|
|
3 |
# Author: Guido Bozzetto
|
|
|
4 |
# Modified: Cyril Jaquier
|
|
|
5 |
#
|
34 |
- |
6 |
# make "f2b-<name>" chain to match drop IP
|
|
|
7 |
# make "f2b-<name>-log" chain to log and drop
|
|
|
8 |
# insert a jump to f2b-<name> from -I <chain> if proto/port match
|
4 |
- |
9 |
#
|
|
|
10 |
#
|
|
|
11 |
|
|
|
12 |
[INCLUDES]
|
|
|
13 |
|
34 |
- |
14 |
before = iptables-common.conf
|
4 |
- |
15 |
|
|
|
16 |
[Definition]
|
|
|
17 |
|
|
|
18 |
# Option: actionstart
|
|
|
19 |
# Notes.: command executed once at the start of Fail2Ban.
|
|
|
20 |
# Values: CMD
|
|
|
21 |
#
|
39 |
- |
22 |
actionstart = <iptables> -N f2b-<name>
|
|
|
23 |
<iptables> -A f2b-<name> -j <returntype>
|
|
|
24 |
<iptables> -I <chain> 1 -p <protocol> -m multiport --dports <port> -j f2b-<name>
|
|
|
25 |
<iptables> -N f2b-<name>-log
|
|
|
26 |
<iptables> -I f2b-<name>-log -j LOG --log-prefix "$(expr f2b-<name> : '\(.\{1,23\}\)'):DROP " --log-level warning -m limit --limit 6/m --limit-burst 2
|
|
|
27 |
<iptables> -A f2b-<name>-log -j <blocktype>
|
4 |
- |
28 |
|
|
|
29 |
# Option: actionstop
|
|
|
30 |
# Notes.: command executed once at the end of Fail2Ban
|
|
|
31 |
# Values: CMD
|
|
|
32 |
#
|
39 |
- |
33 |
actionstop = <iptables> -D <chain> -p <protocol> -m multiport --dports <port> -j f2b-<name>
|
|
|
34 |
<iptables> -F f2b-<name>
|
|
|
35 |
<iptables> -F f2b-<name>-log
|
|
|
36 |
<iptables> -X f2b-<name>
|
|
|
37 |
<iptables> -X f2b-<name>-log
|
4 |
- |
38 |
|
|
|
39 |
# Option: actioncheck
|
|
|
40 |
# Notes.: command executed once before each actionban command
|
|
|
41 |
# Values: CMD
|
|
|
42 |
#
|
39 |
- |
43 |
actioncheck = <iptables> -n -L f2b-<name>-log >/dev/null
|
4 |
- |
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 |
#
|
39 |
- |
51 |
actionban = <iptables> -I f2b-<name> 1 -s <ip> -j f2b-<name>-log
|
4 |
- |
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 |
#
|
39 |
- |
59 |
actionunban = <iptables> -D f2b-<name> -s <ip> -j f2b-<name>-log
|
4 |
- |
60 |
|
|
|
61 |
[Init]
|
|
|
62 |
|