4 |
- |
1 |
# Fail2Ban configuration file
|
|
|
2 |
#
|
|
|
3 |
# Author: Cyril Jaquier
|
|
|
4 |
# Modified by Yaroslav Halchenko for multiport banning
|
|
|
5 |
#
|
|
|
6 |
|
|
|
7 |
[INCLUDES]
|
|
|
8 |
|
|
|
9 |
before = iptables-blocktype.conf
|
|
|
10 |
|
|
|
11 |
[Definition]
|
|
|
12 |
|
|
|
13 |
# Option: actionstart
|
|
|
14 |
# Notes.: command executed once at the start of Fail2Ban.
|
|
|
15 |
# Values: CMD
|
|
|
16 |
#
|
|
|
17 |
actionstart = iptables -N fail2ban-<name>
|
|
|
18 |
iptables -A fail2ban-<name> -j RETURN
|
|
|
19 |
iptables -I <chain> -p <protocol> -m multiport --dports <port> -j fail2ban-<name>
|
|
|
20 |
|
|
|
21 |
# Option: actionstop
|
|
|
22 |
# Notes.: command executed once at the end of Fail2Ban
|
|
|
23 |
# Values: CMD
|
|
|
24 |
#
|
|
|
25 |
actionstop = iptables -D <chain> -p <protocol> -m multiport --dports <port> -j fail2ban-<name>
|
|
|
26 |
iptables -F fail2ban-<name>
|
|
|
27 |
iptables -X fail2ban-<name>
|
|
|
28 |
|
|
|
29 |
# Option: actioncheck
|
|
|
30 |
# Notes.: command executed once before each actionban command
|
|
|
31 |
# Values: CMD
|
|
|
32 |
#
|
|
|
33 |
actioncheck = iptables -n -L <chain> | grep -q 'fail2ban-<name>[ \t]'
|
|
|
34 |
|
|
|
35 |
# Option: actionban
|
|
|
36 |
# Notes.: command executed when banning an IP. Take care that the
|
|
|
37 |
# command is executed with Fail2Ban user rights.
|
|
|
38 |
# Tags: See jail.conf(5) man page
|
|
|
39 |
# Values: CMD
|
|
|
40 |
#
|
|
|
41 |
actionban = iptables -I fail2ban-<name> 1 -s <ip> -j <blocktype>
|
|
|
42 |
|
|
|
43 |
# Option: actionunban
|
|
|
44 |
# Notes.: command executed when unbanning an IP. Take care that the
|
|
|
45 |
# command is executed with Fail2Ban user rights.
|
|
|
46 |
# Tags: See jail.conf(5) man page
|
|
|
47 |
# Values: CMD
|
|
|
48 |
#
|
|
|
49 |
actionunban = iptables -D fail2ban-<name> -s <ip> -j <blocktype>
|
|
|
50 |
|
|
|
51 |
[Init]
|
|
|
52 |
|
|
|
53 |
# Default name of the chain
|
|
|
54 |
#
|
|
|
55 |
name = default
|
|
|
56 |
|
|
|
57 |
# Option: port
|
|
|
58 |
# Notes.: specifies port to monitor
|
|
|
59 |
# Values: [ NUM | STRING ] Default:
|
|
|
60 |
#
|
|
|
61 |
port = ssh
|
|
|
62 |
|
|
|
63 |
# Option: protocol
|
|
|
64 |
# Notes.: internally used by config reader for interpolations.
|
|
|
65 |
# Values: [ tcp | udp | icmp | all ] Default: tcp
|
|
|
66 |
#
|
|
|
67 |
protocol = tcp
|
|
|
68 |
|
|
|
69 |
# Option: chain
|
|
|
70 |
# Notes specifies the iptables chain to which the fail2ban rules should be
|
|
|
71 |
# added
|
|
|
72 |
# Values: STRING Default: INPUT
|
|
|
73 |
chain = INPUT
|