3 |
- |
1 |
# Fail2Ban configuration file
|
|
|
2 |
#
|
|
|
3 |
# Author: Daniel Black
|
|
|
4 |
#
|
|
|
5 |
# This is for ipset protocol 4 (ipset v4.2). If you have a later version
|
|
|
6 |
# of ipset try to use the iptables-ipset-proto6.conf as it does some things
|
|
|
7 |
# nicer.
|
|
|
8 |
#
|
|
|
9 |
# This requires the program ipset which is normally in package called ipset.
|
|
|
10 |
#
|
|
|
11 |
# IPset was a feature introduced in the linux kernel 2.6.39 and 3.0.0 kernels.
|
|
|
12 |
#
|
|
|
13 |
# If you are running on an older kernel you make need to patch in external
|
|
|
14 |
# modules. Debian squeeze can do this with:
|
|
|
15 |
# apt-get install xtables-addons-source
|
|
|
16 |
# module-assistant auto-install xtables-addons
|
|
|
17 |
#
|
|
|
18 |
# Debian wheezy and above uses protocol 6
|
|
|
19 |
|
|
|
20 |
[INCLUDES]
|
|
|
21 |
|
33 |
- |
22 |
before = iptables-common.conf
|
3 |
- |
23 |
|
|
|
24 |
[Definition]
|
|
|
25 |
|
|
|
26 |
# Option: actionstart
|
|
|
27 |
# Notes.: command executed once at the start of Fail2Ban.
|
|
|
28 |
# Values: CMD
|
|
|
29 |
#
|
33 |
- |
30 |
actionstart = ipset --create f2b-<name> iphash
|
|
|
31 |
iptables -I <chain> -p <protocol> -m multiport --dports <port> -m set --match-set f2b-<name> src -j <blocktype>
|
3 |
- |
32 |
|
|
|
33 |
# Option: actionstop
|
|
|
34 |
# Notes.: command executed once at the end of Fail2Ban
|
|
|
35 |
# Values: CMD
|
|
|
36 |
#
|
33 |
- |
37 |
actionstop = iptables -D <chain> -p <protocol> -m multiport --dports <port> -m set --match-set f2b-<name> src -j <blocktype>
|
|
|
38 |
ipset --flush f2b-<name>
|
|
|
39 |
ipset --destroy f2b-<name>
|
3 |
- |
40 |
|
|
|
41 |
# Option: actionban
|
|
|
42 |
# Notes.: command executed when banning an IP. Take care that the
|
|
|
43 |
# command is executed with Fail2Ban user rights.
|
|
|
44 |
# Tags: See jail.conf(5) man page
|
|
|
45 |
# Values: CMD
|
|
|
46 |
#
|
33 |
- |
47 |
actionban = ipset --test f2b-<name> <ip> || ipset --add f2b-<name> <ip>
|
3 |
- |
48 |
|
|
|
49 |
# Option: actionunban
|
|
|
50 |
# Notes.: command executed when unbanning an IP. Take care that the
|
|
|
51 |
# command is executed with Fail2Ban user rights.
|
|
|
52 |
# Tags: See jail.conf(5) man page
|
|
|
53 |
# Values: CMD
|
|
|
54 |
#
|
33 |
- |
55 |
actionunban = ipset --test f2b-<name> <ip> && ipset --del f2b-<name> <ip>
|
3 |
- |
56 |
|
|
|
57 |
[Init]
|
|
|
58 |
|