Subversion Repositories configs

Rev

Rev 4 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4 Rev 34
Line 1... Line 1...
1
# Fail2Ban configuration file
1
# Fail2Ban configuration file
2
#
2
#
3
# Author: Guido Bozzetto
3
# Author: Guido Bozzetto
4
# Modified: Cyril Jaquier
4
# Modified: Cyril Jaquier
5
#
5
#
6
# make "fail2ban-<name>" chain to match drop IP
6
# make "f2b-<name>" chain to match drop IP
7
# make "fail2ban-<name>-log" chain to log and drop
7
# make "f2b-<name>-log" chain to log and drop
8
# insert a jump to fail2ban-<name> from -I <chain> if proto/port match
8
# insert a jump to f2b-<name> from -I <chain> if proto/port match
9
#
9
#
10
#
10
#
11
 
11
 
12
[INCLUDES]
12
[INCLUDES]
13
 
13
 
14
before = iptables-blocktype.conf
14
before = iptables-common.conf
15
 
15
 
16
[Definition]
16
[Definition]
17
 
17
 
18
# Option:  actionstart
18
# Option:  actionstart
19
# Notes.:  command executed once at the start of Fail2Ban.
19
# Notes.:  command executed once at the start of Fail2Ban.
20
# Values:  CMD
20
# Values:  CMD
21
#
21
#
22
actionstart = iptables -N fail2ban-<name>
22
actionstart = iptables -N f2b-<name>
23
              iptables -A fail2ban-<name> -j RETURN
23
              iptables -A f2b-<name> -j RETURN
24
              iptables -I <chain> 1 -p <protocol> -m multiport --dports <port> -j fail2ban-<name>
24
              iptables -I <chain> 1 -p <protocol> -m multiport --dports <port> -j f2b-<name>
25
              iptables -N fail2ban-<name>-log
25
              iptables -N f2b-<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
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 fail2ban-<name>-log -j <blocktype>
27
              iptables -A f2b-<name>-log -j <blocktype>
28
 
28
 
29
# Option:  actionstop
29
# Option:  actionstop
30
# Notes.:  command executed once at the end of Fail2Ban
30
# Notes.:  command executed once at the end of Fail2Ban
31
# Values:  CMD
31
# Values:  CMD
32
#
32
#
33
actionstop = iptables -D <chain> -p <protocol> -m multiport --dports <port> -j fail2ban-<name>
33
actionstop = iptables -D <chain> -p <protocol> -m multiport --dports <port> -j f2b-<name>
34
             iptables -F fail2ban-<name>
34
             iptables -F f2b-<name>
35
             iptables -F fail2ban-<name>-log
35
             iptables -F f2b-<name>-log
36
             iptables -X fail2ban-<name>
36
             iptables -X f2b-<name>
37
             iptables -X fail2ban-<name>-log
37
             iptables -X f2b-<name>-log
38
 
38
 
39
# Option:  actioncheck
39
# Option:  actioncheck
40
# Notes.:  command executed once before each actionban command
40
# Notes.:  command executed once before each actionban command
41
# Values:  CMD
41
# Values:  CMD
42
#
42
#
43
actioncheck = iptables -n -L fail2ban-<name>-log >/dev/null
43
actioncheck = iptables -n -L f2b-<name>-log >/dev/null
44
 
44
 
45
# Option:  actionban
45
# Option:  actionban
46
# Notes.:  command executed when banning an IP. Take care that the
46
# Notes.:  command executed when banning an IP. Take care that the
47
#          command is executed with Fail2Ban user rights.
47
#          command is executed with Fail2Ban user rights.
48
# Tags:    See jail.conf(5) man page
48
# Tags:    See jail.conf(5) man page
49
# Values:  CMD
49
# Values:  CMD
50
#
50
#
51
actionban = iptables -I fail2ban-<name> 1 -s <ip> -j fail2ban-<name>-log
51
actionban = iptables -I f2b-<name> 1 -s <ip> -j f2b-<name>-log
52
 
52
 
53
# Option:  actionunban
53
# Option:  actionunban
54
# Notes.:  command executed when unbanning an IP. Take care that the
54
# Notes.:  command executed when unbanning an IP. Take care that the
55
#          command is executed with Fail2Ban user rights.
55
#          command is executed with Fail2Ban user rights.
56
# Tags:    See jail.conf(5) man page
56
# Tags:    See jail.conf(5) man page
57
# Values:  CMD
57
# Values:  CMD
58
#
58
#
59
actionunban = iptables -D fail2ban-<name> -s <ip> -j fail2ban-<name>-log
59
actionunban = iptables -D f2b-<name> -s <ip> -j f2b-<name>-log
60
 
60
 
61
[Init]
61
[Init]
62
 
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
-