| 3 |
- |
1 |
# Fail2Ban configuration file
|
|
|
2 |
#
|
|
|
3 |
# Author: Cyril Jaquier
|
|
|
4 |
#
|
|
|
5 |
#
|
|
|
6 |
|
|
|
7 |
[Definition]
|
|
|
8 |
|
|
|
9 |
# Option: actionstart
|
|
|
10 |
# Notes.: command executed once at the start of Fail2Ban.
|
|
|
11 |
# Values: CMD
|
|
|
12 |
#
|
|
|
13 |
actionstart = printf %%b "Hi,\n
|
|
|
14 |
The jail <name> has been started successfully.\n
|
|
|
15 |
Output will be buffered until <lines> lines are available.\n
|
|
|
16 |
Regards,\n
|
|
|
17 |
Fail2Ban"|mail -s "[Fail2Ban] <name>: started on `uname -n`" <dest>
|
|
|
18 |
|
|
|
19 |
# Option: actionstop
|
|
|
20 |
# Notes.: command executed once at the end of Fail2Ban
|
|
|
21 |
# Values: CMD
|
|
|
22 |
#
|
|
|
23 |
actionstop = if [ -f <tmpfile> ]; then
|
|
|
24 |
printf %%b "Hi,\n
|
|
|
25 |
These hosts have been banned by Fail2Ban.\n
|
|
|
26 |
`cat <tmpfile>`
|
|
|
27 |
Regards,\n
|
|
|
28 |
Fail2Ban"|mail -s "[Fail2Ban] <name>: Summary from `uname -n`" <dest>
|
|
|
29 |
rm <tmpfile>
|
|
|
30 |
fi
|
|
|
31 |
printf %%b "Hi,\n
|
|
|
32 |
The jail <name> has been stopped.\n
|
|
|
33 |
Regards,\n
|
|
|
34 |
Fail2Ban"|mail -s "[Fail2Ban] <name>: stopped on `uname -n`" <dest>
|
|
|
35 |
|
|
|
36 |
# Option: actioncheck
|
|
|
37 |
# Notes.: command executed once before each actionban command
|
|
|
38 |
# Values: CMD
|
|
|
39 |
#
|
|
|
40 |
actioncheck =
|
|
|
41 |
|
|
|
42 |
# Option: actionban
|
|
|
43 |
# Notes.: command executed when banning an IP. Take care that the
|
|
|
44 |
# command is executed with Fail2Ban user rights.
|
|
|
45 |
# Tags: See jail.conf(5) man page
|
|
|
46 |
# Values: CMD
|
|
|
47 |
#
|
|
|
48 |
actionban = printf %%b "`date`: <ip> (<failures> failures)\n" >> <tmpfile>
|
|
|
49 |
LINE=$( wc -l <tmpfile> | awk '{ print $1 }' )
|
|
|
50 |
if [ $LINE -ge <lines> ]; then
|
|
|
51 |
printf %%b "Hi,\n
|
|
|
52 |
These hosts have been banned by Fail2Ban.\n
|
|
|
53 |
`cat <tmpfile>`
|
|
|
54 |
\nRegards,\n
|
|
|
55 |
Fail2Ban"|mail -s "[Fail2Ban] <name>: Summary" <dest>
|
|
|
56 |
rm <tmpfile>
|
|
|
57 |
fi
|
|
|
58 |
|
|
|
59 |
# Option: actionunban
|
|
|
60 |
# Notes.: command executed when unbanning an IP. Take care that the
|
|
|
61 |
# command is executed with Fail2Ban user rights.
|
|
|
62 |
# Tags: See jail.conf(5) man page
|
|
|
63 |
# Values: CMD
|
|
|
64 |
#
|
|
|
65 |
actionunban =
|
|
|
66 |
|
|
|
67 |
[Init]
|
|
|
68 |
|
|
|
69 |
# Default name of the chain
|
|
|
70 |
#
|
|
|
71 |
name = default
|
|
|
72 |
|
|
|
73 |
# Default number of lines that are buffered
|
|
|
74 |
#
|
|
|
75 |
lines = 5
|
|
|
76 |
|
|
|
77 |
# Default temporary file
|
|
|
78 |
#
|
|
|
79 |
tmpfile = /var/run/fail2ban/tmp-mail.txt
|
|
|
80 |
|
|
|
81 |
# Destination/Addressee of the mail
|
|
|
82 |
#
|
|
|
83 |
dest = root
|