What the message looks like
imap-login: Disconnected (auth failed, 1 attempts in 2 secs): user=<anna@example.com>, method=PLAIN, rip=198.51.100.7, lip=203.0.113.10, TLSCommon causes
- Wrong or changed password, old value still saved on the phone or in Outlook.
- Username with or without domain, matching
auth_username_formatbut not the client. - Plaintext login without TLS is blocked (“Plaintext authentication disallowed”).
- passdb query or password scheme (e.g. SHA512-CRYPT) does not match the stored hashes.
- Many attempts from foreign IPs: brute force against IMAP/POP3.
Check
- Group failed attempts by IP
- Test the login directly in Dovecot (prompts for the password)
doveadm auth test -x service=imap anna@example.com - Show auth and SSL settings
doveconf -n | grep -E 'auth_|passdb|userdb|ssl =' - Show recent errors kept by Dovecot
doveadm log errors
Fix
- For details temporarily set
auth_verbose = yesandauth_debug_passwords = no, then rundoveadm reload. - Reset the password and generate the hash with
doveadm pw -s SHA512-CRYPT. - Move clients to port 993 (IMAPS) or 143 with STARTTLS.
- Against brute force enable fail2ban with the
dovecotfilter. - Turn
auth_verboseoff again after debugging so usernames do not pile up in the log.
Typical scenario
Looking through the Dovecot log, hundreds of lines 'imap-login: Disconnected (auth failed, 1 attempts in 2 secs)' stand out, each with a different user name and the same source IP. Meanwhile a user says her iPhone keeps asking for the password. First separate the two patterns: one IP with many names is an attack, one name from a fixed device IP is an outdated login. grep 'auth failed' | awk on user= and rip= does the sorting.
FAQ
How do I tell a wrong password from an attack?
One user from a known IP is usually an old saved password. Many different usernames from a few IPs is an attack.
What does “no auth attempts” mean instead of “auth failed”?
With “no auth attempts” the client never tried to log in – usually port scanners or monitoring. That is not a login error.
How can I tell whether it is an attack?
An attack shows many different user names, or many rapid attempts from a few IPs, often with non-existent accounts. A user problem always shows the same existing user from the same IP. With auth_verbose = yes Dovecot also logs the reason, such as 'unknown user' or 'password mismatch'.
What effectively slows such attacks?
Fail2ban with the Dovecot filter bans repeated failures; add strong passwords and, where possible, access only through a VPN or country restrictions. Without a ban, a botnet can try passwords slowly and quietly for a long time.
Why do failures pile up after a password change?
Devices keep the old password and retry it automatically, often several devices at once. That creates many lines without anyone attacking. It helps to update the password on all devices and then check the Fail2ban ban list.