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