~ubuntu-branches/ubuntu/saucy/fail2ban/saucy

« back to all changes in this revision

Viewing changes to man/jail.conf.5

  • Committer: Package Import Robot
  • Author(s): Yaroslav Halchenko
  • Date: 2013-05-13 11:58:56 UTC
  • mfrom: (1.1.15) (10.2.13 sid)
  • Revision ID: package-import@ubuntu.com-20130513115856-x7six9p53qcie0vl
Tags: 0.8.9-1
* New upstream release
  - significant improvements in documentation (Closes: #400416)
  - roundcube auth filter (Closes: #699442)
  - enforces C locale for dates (Closes: #686341)
  - provides bash_completion.d/fail2ban
* debian/jail.conf:
  - added findtime and documentation on those basic options from jail.conf
    (Closes: #704568)
  - added new sample jails definitions for ssh-route, ssh-iptables-ipset{4,6},
    roundcube-auth, sogo-auth, mysqld-auth
* debian/control:
  - suggest system-log-daemon (Closes: #691001)
  - boost policy compliance to 3.9.4
* debian/rules:
  - run fail2ban's unittests at build time but ignore the failures
    (there are still some known issues to fix up to guarantee robust testing
    in clean chroots etc).
    Only pyinotify was added to build-depends since gamin might still be
    buggy on older releases and get stuck, which would complicate
    backporting

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.TH JAIL.CONF "5" "March 2013" "Fail2Ban" "Fail2Ban Configuration"
 
2
.SH NAME
 
3
jail.conf \- configuration for the fail2ban server
 
4
.SH SYNOPSIS
 
5
.I jail.conf / jail.local
 
6
 
 
7
.I action.d/*.conf action.d/*.local
 
8
 
 
9
.I filter.d/*.conf filter.d/*.local
 
10
.SH DESCRIPTION
 
11
Fail2ban has three configuration file types. Action files are the commands for banning and unbanning of IP address,
 
12
Filter files tell fail2ban how to detect authentication failures, and Jail configurations combine filters with actions into jails.
 
13
 
 
14
There are *.conf files that are distributed by fail2ban and *.local file that contain user customizations.
 
15
It is recommended that *.conf files should remain unchanged.  If needed, customizations should be provided in *.local files.
 
16
For instance, if you would like to customize the [ssh-iptables-ipset] jail, create a jail.local to extend jail.conf
 
17
(the configuration for the fail2ban server).  The jail.local file will be the following if you only need to enable
 
18
it:
 
19
 
 
20
.TP
 
21
\fIjail.local\fR
 
22
[ssh-iptables-ipset]
 
23
 
 
24
enabled = true
 
25
 
 
26
.PP
 
27
Override only the settings you need to change and the rest of the configuration will come from the corresponding
 
28
*.conf file.
 
29
 
 
30
\fI*.d/\fR
 
31
.RS
 
32
In addition to .local, for any .conf file there can be a corresponding
 
33
\fI.d/\fR directory to contain additional .conf files that will be read after the
 
34
appropriate .local file.  Last parsed file will take precidence over
 
35
identical entries, parsed alphabetically, e.g.
 
36
 
 
37
.RS
 
38
\fIjail.d/01_enable.conf\fR - to enable a specific jail
 
39
.RE
 
40
.RS
 
41
\fIjail.d/02_custom_port.conf\fR - containing specific configuration entry to change the port of the jail specified in the configuration
 
42
.RE
 
43
.RS
 
44
\fIfail2ban.d/01_custom_log.conf\fR - containing specific configuration entry to use a different log path.
 
45
.RE
 
46
.RE
 
47
 
 
48
.SH DEFAULT
 
49
The following options are applicable to all jails. Their meaning is described in the default \fIjail.conf\fR file.
 
50
.TP
 
51
\fBignoreip\fR 
 
52
.TP
 
53
\fBbantime\fR
 
54
.TP
 
55
\fBfindtime\fR
 
56
.TP
 
57
\fBmaxretry\fR
 
58
.TP
 
59
\fBbackend\fR
 
60
.TP
 
61
\fBusedns\fR
 
62
 
 
63
 
 
64
.SH "ACTION FILES"
 
65
Action files specify which commands are executed to ban and unban an IP address. They are located under \fI/etc/fail2ban/action.d\fR.
 
66
 
 
67
Like with jail.conf files, if you desire local changes create an \fI[actionname].local\fR file in the \fI/etc/fail2ban/action.d\fR directory
 
68
and override the required settings.
 
69
 
 
70
Action files are ini files that have two sections, \fBDefinition\fR and \fBInit\fR . 
 
71
 
 
72
The [Init] section allows for action-specific settings. In \fIjail.conf/jail.local\fR these can be overwritten for a particular jail as options to the jail.
 
73
 
 
74
The following commands can be present in the [Definition] section.
 
75
.TP
 
76
\fBactionstart\fR
 
77
command(s) executed when the jail starts.
 
78
.TP
 
79
\fBactionstop\fR
 
80
command(s) executed when the jail stops.
 
81
.TP
 
82
\fBactioncheck\fR
 
83
the command ran before any other action. It aims to verify if the environment is still ok.
 
84
.TP
 
85
\fBactionban\fR
 
86
command(s) that bans the IP address after \fBmaxretry\fR log lines matches within last \fBfindtime\fR seconds.
 
87
.TP
 
88
\fBactionunban\fR
 
89
command(s) that unbans the IP address after \fBbantime\fR.
 
90
 
 
91
Commands specified in the [Definition] section are executed through a system shell so shell redirection and process control is allowed. The commands should
 
92
return 0, otherwise error would be logged.  Moreover if \fBactioncheck\fR exits with non-0 status, it is taken as indication that firewall status has changed and fail2ban needs to reinitialize itself (i.e. issue \fBactionstop\fR and \fBactionstart\fR commands).
 
93
 
 
94
Tags are enclosed in <>.  All the elements of [Init] are tags that are replaced in all action commands.  Tags can be added by the
 
95
\fBfail2ban-client\fR using the setctag command. \fB<br>\fR is a tag that is always a new line (\\n).
 
96
 
 
97
More than a single command is allowed to be specified. Each command needs to be on a separate line and indented with whitespaces without blank lines. The following example defines
 
98
two commands to be executed.
 
99
 
 
100
 actionban = iptables -I fail2ban-<name> --source <ip> -j DROP
 
101
             echo ip=<ip>, match=<match>, time=<time> >> /var/log/fail2ban.log
 
102
 
 
103
.SS "Action Tags"
 
104
The following tags are substituted in the actionban, actionunban and actioncheck (when called before actionban/actionunban) commands.
 
105
.TP
 
106
\fBip\fR
 
107
An IPv4 ip address to be banned. e.g. 192.168.0.2
 
108
.TP
 
109
\fBfailures\fR
 
110
The number of times the failure occurred in the log file. e.g. 3
 
111
.TP
 
112
\fBtime\fR
 
113
The unix time of the ban. e.g. 1357508484
 
114
.TP
 
115
\fBmatches\fR
 
116
The concatenated string of the log file lines of the matches that generated the ban. Many characters interpreted by shell get escaped.
 
117
 
 
118
.SH FILTER FILES
 
119
 
 
120
Filter definitions are those in \fI/etc/fail2ban/filter.d/*.conf\fR and \fIfilter.d/*.local\fR.
 
121
 
 
122
These are used to identify failed authentication attempts in logs and to extract the host IP address (or hostname if \fBusedns\fR is \fBtrue\fR).
 
123
 
 
124
Like action files, filter files are ini files. The main section is the [Definition] section.
 
125
 
 
126
There are two filter definitions used in the [Definition] section:
 
127
 
 
128
.TP
 
129
\fBfailregex\fR
 
130
is the regex (\fBreg\fRular \fBex\fRpression) that will match failed attempts. The tag <HOST> is used as part of the regex and is itself a regex
 
131
for IPv4 addresses and hostnames. fail2ban will work out which one of these it actually is.
 
132
 
 
133
.TP
 
134
\fBignoreregex\fR
 
135
is the regex to identify log entries that should be ignored by fail2ban, even if they match failregex.
 
136
 
 
137
 
 
138
Using Python "string interpolation" mechanisms, other definitions are allowed and can later be used within other definitions as %(defnname)s. For example.
 
139
 
 
140
 baduseragents = IE|wget
 
141
 failregex = useragent=%(baduseragents)s
 
142
 
 
143
.PP
 
144
Filters can also have a section called [INCLUDES]. This is used to read other configuration files.
 
145
 
 
146
.TP
 
147
\fBbefore\fR
 
148
indicates that this file is read before the [Definition] section.
 
149
 
 
150
.TP
 
151
\fBafter\fR
 
152
indicates that this file is read after the [Definition] section.
 
153
 
 
154
.SH AUTHOR
 
155
Fail2ban was originally written by Cyril Jaquier <cyril.jaquier@fail2ban.org>.
 
156
At the moment it is maintained and further developed by Yaroslav O. Halchenko <debian@onerussian.com> and a number of contributors.  See \fBTHANKS\fR file shipped with Fail2Ban for a full list.
 
157
.
 
158
Manual page written by Daniel Black and Yaroslav Halchenko.
 
159
.SH "REPORTING BUGS"
 
160
Report bugs to https://github.com/fail2ban/fail2ban/issues
 
161
.SH COPYRIGHT
 
162
Copyright \(co 2013 Daniel Black
 
163
.br
 
164
Copyright of modifications held by their respective authors.
 
165
Licensed under the GNU General Public License v2 (GPL).
 
166
.SH "SEE ALSO"
 
167
.br
 
168
fail2ban-server(1)