svarshavchik / courier

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

esmtpd seems to freeze when invoked from couriertls #43

Closed pcn closed 2 years ago

pcn commented 2 years ago

I've been working on a small project to run various courier components from inside of docker containers to make it easier for me to test and upgrade my personal mail server (well, that's the idea, anyway). I've been using courier for many years, so I believe I may have forgotten some critical part of the configuration, however I've gotten most of my issues worked out, but surprisingly when I try to run esmtpd-ssl, or esmtpd-msa with STARTTLS, it seems like as soon as esmtpd under couriertls receives any input, it fails to reply. Here is a snapshot of some strace info when this happens:

https://github.com/pcn/mailbag/commit/43be9d27ba91018624c25922e9cfdfba75e421e3#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R81-R122

I'm pretty sure I've missed something here, but I'm very surprised that in this configuration that this is only occurring when invoked via couriertls, and doesn't seem to do this when it's directly invoked via couriertcpd. I've tried running esmtpd from the command line by setting the documented environment variables plus sourcing /etc/courier/esmtpd-ssl where the process similarly hangs, but I'm not sure that's a valid test in this case.

Any advice would be appreciated.


Update after @svarshavchik answered - you are correct, openssl s_client does not use telnet-like \r\n insertion, so my testing was bad. Adding some python scripts to do the mail login and checking that is working fine. Thanks!

svarshavchik commented 2 years ago

read(0, "ehlo baby\n", 5120) = 10

SMTP commands are terminated by \r\n. courieresmtpd is pretty strict, and won't recognize a command until it sees \r\n. Use addcr in a pipe, to have it inserted for you (telnet will do that for you, too).

pcn commented 1 year ago

Oh man. And openssl s_client will not. Thanks, I was using the wrong tools for testing.

On Wed, Jun 22, 2022 at 05:06:25PM -0700, Sam Varshavchik wrote:

read(0, "ehlo baby\n", 5120) = 10

SMTP commands are terminated by \r\n. courieresmtpd is pretty strict, and won't recognize a command until it sees \r\n. Use addcr in a pipe, to have it inserted for you (telnet will do that for you, too).

-- Reply to this email directly or view it on GitHub: https://github.com/svarshavchik/courier/issues/43#issuecomment-1163783406 You are receiving this because you authored the thread.

Message ID: @.***>