[Dovecot] Logging passwords on auth failure/dealing with botnets

Timo Sirainen tss at iki.fi
Sun Sep 22 02:47:50 EEST 2013

On 30.8.2013, at 20.54, Michael Smith (DF) <msmith at datafoundry.com> wrote:

> We're already running fail2ban, but it doesn't seem that effective against botnets, when they only do one attempt per IP.  Add that on top of load balancing between many servers...  We've setup some rules to help, but still not that great.
> I've checked out several DNS BLs (those listed here, and some not), and at the most they have about 15-20 IPs out of the 8000+ that we've manually identified, and blocked, as botnet behavior.  So, none of them seem effective/beneficial to us right now.
> That leaves us back to getting dovecot to log the tried password for unknown users.  I'll admit that C is not my strong suit, but after poking around I've come up with a patch that appears to work.  It hasn't been stress tested yet, so I don't know it's long term stability.  Maybe someone more intimately familiar with the Dovecot code can review it, and maybe this could make it into the code base.  This patch is against Dovecot 2.2.4, as that is what we have deployed at the moment.  It would be weeks before we could begin to deploy to Dovecot 2.2.5.

I guess it doesn't hurt to add this feature for everyone: http://hg.dovecot.org/dovecot-2.2/rev/4ce8f47d20af http://hg.dovecot.org/dovecot-2.2/rev/1f9294fbb118

> Also, is there a way to make the auth system report successful auths, with no option to report the password (or maybe ONLY report the hash if password debugging is enabled)?  It's currently impossible to identify when a bot makes a successful auth.  Dovecot doesn't report it, and postfix doesn't report it.  Postfix only reports the authentication IF a message is actually sent through.  These bots are only connecting, sending the auth command, and quitting.  My best guess, based on the bulk of auth failures for a user, and when that user is used by a botnet is 1-8 weeks.  So, if we could identify the bot's successful auth, we could warn the customer and/or force a password change before the account is used to send hundreds of thousands of spam.

I'm not sure what you mean by this. Log the password also for successful connections? How would that help?

More information about the dovecot mailing list