4 |
- |
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 |
|
|
|
22 |
before = iptables-blocktype.conf
|
|
|
23 |
|
|
|
24 |
[Definition]
|
|
|
25 |
|
|
|
26 |
# Option: actionstart
|
|
|
27 |
# Notes.: command executed once at the start of Fail2Ban.
|
|
|
28 |
# Values: CMD
|
|
|
29 |
#
|
|
|
30 |
actionstart = ipset --create fail2ban-<name> iphash
|
|
|
31 |
iptables -I INPUT -p <protocol> -m multiport --dports <port> -m set --match-set fail2ban-<name> src -j <blocktype>
|
|
|
32 |
|
|
|
33 |
# Option: actionstop
|
|
|
34 |
# Notes.: command executed once at the end of Fail2Ban
|
|
|
35 |
# Values: CMD
|
|
|
36 |
#
|
|
|
37 |
actionstop = iptables -D INPUT -p <protocol> -m multiport --dports <port> -m set --match-set fail2ban-<name> src -j <blocktype>
|
|
|
38 |
ipset --flush fail2ban-<name>
|
|
|
39 |
ipset --destroy fail2ban-<name>
|
|
|
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 |
#
|
|
|
47 |
actionban = ipset --test fail2ban-<name> <ip> || ipset --add fail2ban-<name> <ip>
|
|
|
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 |
#
|
|
|
55 |
actionunban = ipset --test fail2ban-<name> <ip> && ipset --del fail2ban-<name> <ip>
|
|
|
56 |
|
|
|
57 |
[Init]
|
|
|
58 |
|
|
|
59 |
# Default name of the ipset
|
|
|
60 |
#
|
|
|
61 |
name = default
|
|
|
62 |
|
|
|
63 |
# Option: port
|
|
|
64 |
# Notes.: specifies port to monitor
|
|
|
65 |
# Values: [ NUM | STRING ] Default: ssh
|
|
|
66 |
#
|
|
|
67 |
port = ssh
|
|
|
68 |
|
|
|
69 |
# Option: protocol
|
|
|
70 |
# Notes.: internally used by config reader for interpolations.
|
|
|
71 |
# Values: [ tcp | udp | icmp | all ] Default: tcp
|
|
|
72 |
#
|
|
|
73 |
protocol = tcp
|