SmtpServer icon indicating copy to clipboard operation
SmtpServer copied to clipboard

SecureServerExample blocked by telnet

Open mrFred489 opened this issue 2 years ago • 5 comments

I have a problem where the server stops receiving emails if a telnet connection is open. The telnet connection is stuck in AuthenticateAsServerAsync within SecurableDuplexPipe. I can reproduce this issue by using the SecureServerExample from the repo. If this can either be fixed, or you have a workaround allowing me to block/reject the telnet connects, I would be happy.

I test it by:

  1. Running the server.
  2. Starting a jmeter script that continuously sends emails.
  3. Starting telnet - Observe that the jmeter script stops sending emails.
  4. Stop telnet - Observe that jmeter starts sending emails again.

mrFred489 avatar Mar 15 '22 12:03 mrFred489

Looking at the code it seams that the server performs SSL upgrade syncronously (i.e. it'll start listening to next connection, when previous is authenticated with SSL). I can see 3 possible ways, you could try to fix it:

  1. disable SSL (only, if you're sure it's safe - closed network, vpn etc.)
  2. Decrease read timeout - by default it's 2 minutes, you probably can have it safely much lower
  3. Fix code, so that this line is called in background: https://github.com/cosullivan/SmtpServer/blob/master/Src/SmtpServer/SmtpServer.cs#L160

BTW, @cosullivan - what's the status of this project? Is it still supported?

karol-gro avatar Jun 18 '22 13:06 karol-gro

Hi @karol-gro yes it is still supported, but only when time permits.

I will have a look at this in the next few days.

cosullivan avatar Jun 19 '22 02:06 cosullivan

Hi @cosullivan What is the status on this? Do you expect to get the time to look into it?

mrFred489 avatar Sep 15 '22 12:09 mrFred489

Hi @mrFred489 ,

I've uploaded 9.0.2-beta1 which should solve this. If you are able to test to confirm that would be good.

cosullivan avatar Sep 16 '22 05:09 cosullivan

Hi @cosullivan

It seems to be working. It looks like you took the suggestion from @karol-gro, so the server can handle messages while attempting to secure another connection.

Thank you for fixing this!

mrFred489 avatar Sep 16 '22 07:09 mrFred489