From 56e5821c06c1e1071936b16de10339170b5d70f8 Mon Sep 17 00:00:00 2001 From: Anton Shestakov Date: Thu, 30 Apr 2015 16:53:10 +0800 Subject: [PATCH] Match unknown user in dovecot's passwd-file auth database --- ChangeLog | 2 ++ config/filter.d/dovecot.conf | 2 +- fail2ban/tests/files/logs/dovecot | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 71d84e71..b415fc2b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,8 @@ ver. 0.9.3 (2015/XX/XXX) - wanna-be-released ----------- - Fixes: + * filter.d/dovecot.conf - also match unknown user in passwd-file. + Thanks Anton Shestakov - New Features: diff --git a/config/filter.d/dovecot.conf b/config/filter.d/dovecot.conf index b6645b89..856c220e 100644 --- a/config/filter.d/dovecot.conf +++ b/config/filter.d/dovecot.conf @@ -12,7 +12,7 @@ _daemon = (auth|dovecot(-auth)?|auth-worker) failregex = ^%(__prefix_line)s(%(__pam_auth)s(\(dovecot:auth\))?:)?\s+authentication failure; logname=\S* uid=\S* euid=\S* tty=dovecot ruser=\S* rhost=(\s+user=\S*)?\s*$ ^%(__prefix_line)s(pop3|imap)-login: (Info: )?(Aborted login|Disconnected)(: Inactivity)? \(((auth failed, \d+ attempts)( in \d+ secs)?|tried to use (disabled|disallowed) \S+ auth)\):( user=<\S*>,)?( method=\S+,)? rip=(, lip=(\d{1,3}\.){3}\d{1,3})?(, TLS( handshaking(: SSL_accept\(\) failed: error:[\dA-F]+:SSL routines:[TLS\d]+_GET_CLIENT_HELLO:unknown protocol)?)?(: Disconnected)?)?(, session=<\S+>)?\s*$ ^%(__prefix_line)s(Info|dovecot: auth\(default\)|auth-worker\(\d+\)): pam\(\S+,\): pam_authenticate\(\) failed: (User not known to the underlying authentication module: \d+ Time\(s\)|Authentication failure \(password mismatch\?\))\s*$ - ^%(__prefix_line)sauth-worker\(\d+\): pam\(\S+,\): unknown user\s*$ + ^%(__prefix_line)s(auth|auth-worker\(\d+\)): (pam|passwd-file)\(\S+,\): unknown user\s*$ ignoreregex = diff --git a/fail2ban/tests/files/logs/dovecot b/fail2ban/tests/files/logs/dovecot index aa2ab3cf..4c2ccc94 100644 --- a/fail2ban/tests/files/logs/dovecot +++ b/fail2ban/tests/files/logs/dovecot @@ -37,6 +37,9 @@ Jan 29 05:32:50 mail dovecot: auth-worker(304): pam(username,1.2.3.4): pam_authe # failJSON: { "time": "2005-01-29T05:13:40", "match": true , "host": "1.2.3.4" } Jan 29 05:13:40 mail dovecot: auth-worker(31326): pam(username,1.2.3.4): unknown user +# failJSON: { "time": "2005-01-29T05:13:50", "match": true , "host": "1.2.3.4" } +Jan 29 05:13:50 mail dovecot: auth: passwd-file(username,1.2.3.4): unknown user + # failJSON: { "time": "2005-04-19T05:22:20", "match": true , "host": "80.255.3.104" } Apr 19 05:22:20 vm5 auth: pam_unix(dovecot:auth): authentication failure; logname= uid=0 euid=0 tty=dovecot ruser=informix rhost=80.255.3.104