Receiver addresses NOT case-INsensitive?

Before I start troubleshooting this issue, is anyone else having this problem and, if so, figured out how to fix it?

When someone sends a message to one of my users and has an uppercase letter in the local-part of the address, Dovecot rejects it.

For example, “[email protected]” exists, but a message to “[email protected]” gives this error in exim mainlog:

<= [email protected] H=(mail-qv1-f54.google.com) [209.85.219.54]:35990 I=[10.0.20.101]:25 P=esmtps X=TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128 CV=no SNI="mail.receiverdomain.com" K S=22880 DKIM=senderdomain.com [email protected] T="Email subject" for [email protected]
** [email protected] <[email protected]> F=<[email protected]> R=localuser T=dovecot_lmtp: LMTP error after RCPT TO:<[email protected]>: 550 5.1.1 <[email protected]> User doesn't exist: [email protected]
<= <> R=1l3Tir-0006d5-Q1 U=Debian-exim P=local S=24267 T="Mail delivery failed: returning message to sender" for [email protected]

And this in dovecot.log:

lmtp(25493): Info: Connect from local
auth: Info: passwd-file([email protected]): unknown user
lmtp(25493): Info: Disconnect from local: Client has quit the connection (state=READY)

Thanks
–Dan

Okay, I found the problem.

Turns out, Exim leaves the case of the email address as-is when it passes it on to Dovecot via LMTP. And in Dovecot, you have to explicitly specify that you want it to change the username to lowercase by including “L” in the config for the username_format: %Ln instead of %n, or %Lu instead of just %u.

Hence, the /etc/dovecot/conf.d/auth-passwdfile.conf.ext file should be like this:

passdb {
  driver = passwd-file
  args = scheme=MD5-CRYPT username_format=%Ln /etc/exim4/domains/%d/passwd
}

userdb {
  driver = passwd-file
  args = username_format=%Ln /etc/exim4/domains/%d/passwd
}

I simply added the “L” where it had “username_format=%n”.

–Dan

1 Like

I have tried to reproduce your error but I couldn’t.

On Debian 10 - hestia 1.3.2 everything works fine.

My config file doesn’t have the %Ln part

passdb {
driver = passwd-file
args = scheme=MD5-CRYPT username_format=%n /etc/exim4/domains/%d/passwd
}

userdb {
driver = passwd-file
args = username_format=%n /etc/exim4/domains/%d/passwd
}
1 Like

Thanks for checking, @jlguerrero .

I realized after I posted this that the problem only occurs when you switch to using standard LMTP local delivery through Dovecot instead of Hestia’s custom Exim config that delivers new messages by directly copying them into the MAILDIR directory. The “%n” was only an issue for me because Exim passes the email address to Dovecot with case intact, so Dovecot needs to convert it to lowercase before checking the username against the passwd file. Changing it to “%Ln” serves that purpose.

Cheers
–Dan