192 |
- |
1 |
# Fail2Ban filter Dovecot authentication and pop3/imap server
|
|
|
2 |
#
|
|
|
3 |
|
|
|
4 |
[INCLUDES]
|
|
|
5 |
|
|
|
6 |
before = common.conf
|
|
|
7 |
|
|
|
8 |
[Definition]
|
|
|
9 |
|
|
|
10 |
_auth_worker = (?:dovecot: )?auth(?:-worker)?
|
|
|
11 |
_daemon = (?:dovecot(?:-auth)?|auth)
|
|
|
12 |
|
193 |
- |
13 |
prefregex = ^%(__prefix_line)s(?:%(_auth_worker)s(?:\([^\)]+\))?: )?(?:%(__pam_auth)s(?:\(dovecot:auth\))?: |(?:pop3|imap|managesieve|submission)-login: )?(?:Info: )?<F-CONTENT>.+</F-CONTENT>$
|
192 |
- |
14 |
|
|
|
15 |
failregex = ^authentication failure; logname=<F-ALT_USER1>\S*</F-ALT_USER1> uid=\S* euid=\S* tty=dovecot ruser=<F-USER>\S*</F-USER> rhost=<HOST>(?:\s+user=<F-ALT_USER>\S*</F-ALT_USER>)?\s*$
|
193 |
- |
16 |
^(?:Aborted login|Disconnected|Remote closed connection|Client has quit the connection)(?::(?: [^ \(]+)+)? \((?:auth failed, \d+ attempts(?: in \d+ secs)?|tried to use (?:disabled|disallowed) \S+ auth|proxy dest auth failed)\):(?: user=<<F-USER>[^>]*</F-USER>>,)?(?: method=\S+,)? rip=<HOST>(?:[^>]*(?:, session=<\S+>)?)\s*$
|
192 |
- |
17 |
^pam\(\S+,<HOST>(?:,\S*)?\): pam_authenticate\(\) failed: (?:User not known to the underlying authentication module: \d+ Time\(s\)|Authentication failure \(password mismatch\?\)|Permission denied)\s*$
|
193 |
- |
18 |
^[a-z\-]{3,15}\(\S*,<HOST>(?:,\S*)?\): (?:unknown user|invalid credentials|Password mismatch)
|
192 |
- |
19 |
<mdre-<mode>>
|
|
|
20 |
|
193 |
- |
21 |
mdre-aggressive = ^(?:Aborted login|Disconnected|Remote closed connection|Client has quit the connection)(?::(?: [^ \(]+)+)? \((?:no auth attempts|disconnected before auth was ready,|client didn't finish \S+ auth,)(?: (?:in|waited) \d+ secs)?\):(?: user=<[^>]*>,)?(?: method=\S+,)? rip=<HOST>(?:[^>]*(?:, session=<\S+>)?)\s*$
|
192 |
- |
22 |
|
|
|
23 |
mdre-normal =
|
|
|
24 |
|
|
|
25 |
# Parameter `mode` - `normal` or `aggressive`.
|
|
|
26 |
# Aggressive mode can be used to match log-entries like:
|
|
|
27 |
# 'no auth attempts', 'disconnected before auth was ready', 'client didn't finish SASL auth'.
|
|
|
28 |
# Note it may produce lots of false positives on misconfigured MTAs.
|
|
|
29 |
# Ex.:
|
|
|
30 |
# filter = dovecot[mode=aggressive]
|
|
|
31 |
mode = normal
|
|
|
32 |
|
|
|
33 |
ignoreregex =
|
|
|
34 |
|
|
|
35 |
journalmatch = _SYSTEMD_UNIT=dovecot.service
|
|
|
36 |
|
|
|
37 |
datepattern = {^LN-BEG}TAI64N
|
|
|
38 |
{^LN-BEG}
|
|
|
39 |
|
|
|
40 |
# DEV Notes:
|
|
|
41 |
# * the first regex is essentially a copy of pam-generic.conf
|
|
|
42 |
# * Probably doesn't do dovecot sql/ldap backends properly (resolved in edit 21/03/2016)
|
|
|
43 |
#
|
|
|
44 |
# Author: Martin Waschbuesch
|
|
|
45 |
# Daniel Black (rewrote with begin and end anchors)
|
|
|
46 |
# Martin O'Neal (added LDAP authentication failure regex)
|
|
|
47 |
# Sergey G. Brester aka sebres (reviewed, optimized, IPv6-compatibility)
|