lmtp and recipient_delimiter
Juri Haberland
juri at koschikode.com
Sun Mar 15 20:10:10 EET 2020
On 12/03/2020 08:04, Jean-Daniel wrote:
>
>
>> Le 11 mars 2020 à 19:32, Juri Haberland <juri at koschikode.com> a écrit :
>>
>> Hi list,
>>
>> I have a small problem with recipient_delimiters contained in usernames.
>> Recently I have extended recipient_delimiter from "+" to "+-" in both
>> Postfix and Dovecot (using lmtp) and now any user that have a '-' in it's
>> username can't receive mail anymore, because lmtp truncates the localpart
>> after the '-' and of course can't find the first half in the user database.
>>
>> To illustrate: given an account "foo-bar at example.com", I get the following
>> log entry from postfix:
>> Mar 9 09:31:43 batleth postfix/lmtp[6196]: 9A7BA33E005B:
>> to=<foo-bar at example.com>,
>> relay=batleth.sapienti-sat.org[private/dovecot-lmtp], delay=20,
>> delays=20/0.01/0.01/0.08, dsn=5.1.1, status=bounced (host
>> batleth.sapienti-sat.org[private/dovecot-lmtp] said: 550 5.1.1
>> <foo-bar at example.com> User doesn't exist: foo at example.com (in reply to RCPT
>> TO command))
>> Is there any way to tell lmtp to first look for
>> <user><delimiter><extension> and if that fails look for <user> only (the
>> reverse order would be ok, too)?
>>
>
> This is already what they do AFAIK. I’m using ‘-‘ as delimiter for a long time and didn’t have any issue with my mails.
> I think this postfix error only reflects the last attempt, and not all the resolution attempts. Try increasing the log (either in postfix or LMTP) to see what append exactly.
I turned debugging on in both programs and could see the conversation between Postfix and Dovecot via LMTP. Setting recipient_delimiter to +- in
Postfix doesn't make the delivery break so I left it at this. Only recipient_delimiter=+- in Dovecot makes the difference. In both cases Postfix ask
Dovecot for a user named "<foo-bar at sapienti-sat.org>" and with "-" included in Dovecot's recipient_delimiter option Dovecot replies with:
550 5.1.1 <foo-bar at sapienti-sat.org> User doesn't exist: foo at sapienti-sat.org
On the Dovecot side I see a single database lookup for "foo at sapienti-sat.org". So Postfix doesn't care and hands the complete mail address off to
Dovecot, which in turn either looks up the full email address (in case of "-" excluded) or looks up the truncated mail address only in case of "-"
included.
My question would be:
Is this due to a misconfiguration somewhere?
Is this the intended behavior?
Or is this a bug?
Cheers,
Juri
PS: here are the logs (from two different but identical tests) for the case where both Dovecot and Postfix have recipient_delimiter = +-
Mar 15 17:57:06 batleth postfix/lmtp[5077]: smtp_connect_unix: trying: private/dovecot-lmtp...
Mar 15 17:57:06 batleth postfix/lmtp[5077]: smtp_stream_setup: maxtime=300 enable_deadline=0
Mar 15 17:57:06 batleth postfix/lmtp[5077]: < batleth.sapienti-sat.org[private/dovecot-lmtp]: 220 batleth.sapienti-sat.org Dovecot ready.
Mar 15 17:57:06 batleth dovecot: lmtp(5154): Connect from local
Mar 15 17:57:06 batleth postfix/lmtp[5077]: > batleth.sapienti-sat.org[private/dovecot-lmtp]: LHLO batleth.sapienti-sat.org
Mar 15 17:57:06 batleth postfix/lmtp[5077]: < batleth.sapienti-sat.org[private/dovecot-lmtp]: 250-batleth.sapienti-sat.org
Mar 15 17:57:06 batleth postfix/lmtp[5077]: < batleth.sapienti-sat.org[private/dovecot-lmtp]: 250-8BITMIME
Mar 15 17:57:06 batleth postfix/lmtp[5077]: < batleth.sapienti-sat.org[private/dovecot-lmtp]: 250-CHUNKING
Mar 15 17:57:06 batleth postfix/lmtp[5077]: < batleth.sapienti-sat.org[private/dovecot-lmtp]: 250-ENHANCEDSTATUSCODES
Mar 15 17:57:06 batleth postfix/lmtp[5077]: < batleth.sapienti-sat.org[private/dovecot-lmtp]: 250-PIPELINING
Mar 15 17:57:06 batleth postfix/lmtp[5077]: < batleth.sapienti-sat.org[private/dovecot-lmtp]: 250 STARTTLS
Mar 15 17:57:06 batleth postfix/lmtp[5077]: server features: 0x17 size 0
Mar 15 17:57:06 batleth postfix/lmtp[5077]: Using LMTP PIPELINING, TCP send buffer size is 212992, PIPELINING buffer size is 4096
Mar 15 17:57:06 batleth postfix/lmtp[5077]: smtp_stream_setup: maxtime=300 enable_deadline=0
Mar 15 17:57:06 batleth postfix/lmtp[5077]: > batleth.sapienti-sat.org[private/dovecot-lmtp]: MAIL FROM:<root at batleth.sapienti-sat.org>
Mar 15 17:57:06 batleth postfix/lmtp[5077]: > batleth.sapienti-sat.org[private/dovecot-lmtp]: RCPT TO:<foo-bar at sapienti-sat.org>
Mar 15 17:57:06 batleth postfix/lmtp[5077]: > batleth.sapienti-sat.org[private/dovecot-lmtp]: DATA
Mar 15 17:57:06 batleth postfix/lmtp[5077]: smtp_stream_setup: maxtime=300 enable_deadline=0
Mar 15 17:57:06 batleth postfix/lmtp[5077]: < batleth.sapienti-sat.org[private/dovecot-lmtp]: 250 2.1.0 OK
Mar 15 17:57:06 batleth postfix/lmtp[5077]: smtp_stream_setup: maxtime=300 enable_deadline=0
Mar 15 17:57:06 batleth postfix/lmtp[5077]: < batleth.sapienti-sat.org[private/dovecot-lmtp]: 550 5.1.1 <foo-bar at sapienti-sat.org> User doesn't exist:
foo at sapienti-sat.org
Mar 15 17:57:06 batleth postfix/lmtp[5077]: connect to subsystem private/bounce
Mar 15 17:57:06 batleth postfix/lmtp[5077]: send attr nrequest = 0
Mar 15 17:57:06 batleth postfix/lmtp[5077]: send attr flags = 0
Mar 15 17:57:06 batleth postfix/lmtp[5077]: send attr queue_id = B75A333E0D77
Mar 15 17:57:06 batleth postfix/lmtp[5077]: send attr original_recipient = foo-bar at sapienti-sat.org
Mar 15 17:57:06 batleth postfix/lmtp[5077]: send attr recipient = foo-bar at sapienti-sat.org
Mar 15 17:57:06 batleth postfix/lmtp[5077]: send attr offset = 700
Mar 15 17:57:06 batleth postfix/lmtp[5077]: send attr dsn_orig_rcpt = rfc822;foo-bar at sapienti-sat.org
Mar 15 17:57:06 batleth postfix/lmtp[5077]: send attr notify_flags = 0
Mar 15 17:57:06 batleth postfix/lmtp[5077]: send attr status = 5.1.1
Mar 15 17:57:06 batleth postfix/lmtp[5077]: send attr diag_type = smtp
Mar 15 17:57:06 batleth postfix/lmtp[5077]: send attr diag_text = 550 5.1.1 <foo-bar at sapienti-sat.org> User doesn't exist: foo at sapienti-sat.org
Mar 15 17:57:06 batleth postfix/lmtp[5077]: send attr mta_type = dns
Mar 15 17:57:06 batleth postfix/lmtp[5077]: send attr mta_mname = batleth.sapienti-sat.org
Mar 15 17:57:06 batleth postfix/lmtp[5077]: send attr action = failed
Mar 15 17:57:06 batleth postfix/lmtp[5077]: send attr reason = host batleth.sapienti-sat.org[private/dovecot-lmtp] said: 550 5.1.1
<foo-bar at sapienti-sat.org> User doesn't exist: foo at sapienti-sat.org (in reply to RCPT TO command)
Mar 15 17:57:06 batleth postfix/lmtp[5077]: private/bounce socket: wanted attribute: status
Mar 15 17:57:06 batleth postfix/lmtp[5077]: input attribute name: status
Mar 15 17:57:06 batleth postfix/lmtp[5077]: input attribute value: 0
Mar 15 17:57:06 batleth postfix/lmtp[5077]: private/bounce socket: wanted attribute: (list terminator)
Mar 15 17:57:06 batleth postfix/lmtp[5077]: input attribute name: (end)
Mar 15 17:57:06 batleth postfix/lmtp[5077]: B75A333E0D77: to=<foo-bar at sapienti-sat.org>, relay=batleth.sapienti-sat.org[private/dovecot-lmtp],
delay=0.31, delays=0.21/0/0.01/0.08, dsn=5.1.1, status=bounced (host batleth.sapienti-sat.org[private/dovecot-lmtp] said: 550 5.1.1
<foo-bar at sapienti-sat.org> User doesn't exist: foo at sapienti-sat.org (in reply to RCPT TO command))
Mar 15 17:57:06 batleth postfix/lmtp[5077]: smtp_stream_setup: maxtime=120 enable_deadline=0
Mar 15 17:57:06 batleth postfix/lmtp[5077]: < batleth.sapienti-sat.org[private/dovecot-lmtp]: 503 5.5.0 No valid recipients
Mar 15 17:57:07 batleth postfix/lmtp[5077]: > batleth.sapienti-sat.org[private/dovecot-lmtp]: RSET
Mar 15 17:57:07 batleth postfix/lmtp[5077]: > batleth.sapienti-sat.org[private/dovecot-lmtp]: QUIT
Mar 15 17:57:07 batleth postfix/lmtp[5077]: smtp_stream_setup: maxtime=20 enable_deadline=0
Mar 15 17:57:07 batleth postfix/lmtp[5077]: < batleth.sapienti-sat.org[private/dovecot-lmtp]: 250 2.0.0 OK
Mar 15 17:57:07 batleth postfix/lmtp[5077]: smtp_stream_setup: maxtime=300 enable_deadline=0
Mar 15 17:57:07 batleth postfix/lmtp[5077]: < batleth.sapienti-sat.org[private/dovecot-lmtp]: 221 2.0.0 Bye
Mar 15 17:57:07 batleth postfix/lmtp[5077]: name_mask: resource
Mar 15 17:57:07 batleth postfix/lmtp[5077]: name_mask: software
Mar 15 17:57:07 batleth dovecot: lmtp(5154): Disconnect from local: Client has quit the connection (state=READY)
Mar 15 17:25:55 batleth dovecot: lmtp(32357): Connect from local
Mar 15 17:25:55 batleth dovecot: lmtp(foo at sapienti-sat.org)<32357></O/wBxNXbl5lfgAAOCqtvw>: Debug: auth-master: userdb lookup(foo at sapienti-sat.org):
Started userdb lookup
Mar 15 17:25:55 batleth dovecot: lmtp(foo at sapienti-sat.org)<32357></O/wBxNXbl5lfgAAOCqtvw>: Debug: auth-master: conn
unix:/var/run/dovecot/auth-userdb: Connecting
Mar 15 17:25:55 batleth dovecot: lmtp(foo at sapienti-sat.org)<32357></O/wBxNXbl5lfgAAOCqtvw>: Debug: auth-master: conn unix:/var/run/dovecot/auth-userdb
(pid=32319,uid=0): Client connected (fd=17)
Mar 15 17:25:55 batleth dovecot: lmtp(foo at sapienti-sat.org)<32357></O/wBxNXbl5lfgAAOCqtvw>: Debug: auth-master: userdb lookup(foo at sapienti-sat.org):
auth USER input:
Mar 15 17:25:55 batleth dovecot: lmtp(foo at sapienti-sat.org)<32357></O/wBxNXbl5lfgAAOCqtvw>: Debug: auth-master: userdb lookup(foo at sapienti-sat.org):
Userdb lookup failed
Mar 15 17:25:55 batleth postfix/lmtp[31931]: 055C233E13EE: to=<foo-bar at sapienti-sat.org>, relay=batleth.sapienti-sat.org[private/dovecot-lmtp],
delay=0.23, delays=0.15/0/0.01/0.07, dsn=5.1.1, status=bounced (host batleth.sapienti-sat.org[private/dovecot-lmtp] said: 550 5.1.1
<foo-bar at sapienti-sat.org> User doesn't exist: foo at sapienti-sat.org (in reply to RCPT TO command))
Mar 15 17:25:55 batleth dovecot: lmtp(32357): Disconnect from local: Client has quit the connection (state=READY)
More information about the dovecot
mailing list