svarshavchik / courier

Courier Mail Server
http://www.courier-mta.org
76 stars 15 forks source link

Unexpected character in EHLO keyword. #50

Open ploink opened 1 year ago

ploink commented 1 year ago

I noticed these warnings in my system journal. They always come in twins and they happen when dovecot/sieve forwards an email to courier-mta:

Apr 13 20:18:16 host.domain dovecot[405952]: lda(from@email.com)<405952><QOuhOGJHAGTAMQYAEaMxkg>: Warning: smtp-client: conn localhost:25 (127.0.0.1:25) [1]: Received invalid EHLO response line: Unexpected character in EHLO keyword
Apr 13 20:18:16 host.domain dovecot[405952]: lda(from@email.com)<405952><QOuhOGJHAGTAMQYAEaMxkg>: Warning: smtp-client: conn localhost:25 (127.0.0.1:25) [1]: Received invalid EHLO response line: Unexpected character in EHLO keyword

The issue is very similar to this one: https://dovecot.org/mailman3/archives/list/dovecot@dovecot.org/thread/JCOPFPTGBBKMBMODMXE2SU3RR3XIBUSE/ They conclude that the problem is with Fastmail for responding to EHLO with the illegal character "=" in a keyword. In my case the issue then is with courier-mta.

When I test this using telnet:

$ telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 my.server.name.com ESMTP
ehlo localhost
250-my.server.name.com Ok.
250-STARTTLS
250-XVERP=Courier
250-XEXDATA
250-XSECURITY=NONE,STARTTLS
250-PIPELINING
250-8BITMIME
250-SMTPUTF8
250-SIZE
250 DSN

Note the "=" character with XVERP= and XSECURITY= that are not allowed there according to RFC5321 section 4.1.1.1. This may explain why the warning is logged twice.

ehlo-line = ehlo-keyword *( SP ehlo-param )

If I understand correctly, the "=" character should be a space.

svarshavchik commented 1 year ago

That seems to be the case.

Courier has been doing this for almost twenty years, and it will take some time to migrate to an alternative syntax.