OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: feature request: timeouts in smtpd

From: Victor Duchovni (Victor.DuchovniMorganStanley.com)
Date: Thu Feb 01 2007 - 11:49:05 CST


On Thu, Feb 01, 2007 at 08:13:38PM +0300, Anton Yuzhaninov wrote:

> Hello.
>
> Is planed to implement different timeouts for smtpd?
>
> We need small timeout for:
> timeout after CONNECT
> and big timeout for:
> timeout after DATA

It is perhaps a reasonable request, but there is not much operational
experience about the possible impact of this. RFC 2821 provides a
single recomendation without regard to the transaction context:

    4.5.3.2 Timeouts

       ...

       An SMTP server SHOULD have a timeout of at least 5 minutes while
       it is awaiting the next command from the sender.

This limit is very large.

It is appealing to propose a feature to control "connection hogging"
and implement a lower limit after "." and "RSET" and before the start
of the next mail transaction.

To make this completely correct, and also enforce a low limit for "NOOP"
and other junk commands after the transaction, it makes more sense to
define this lower limit as applying to all commands that are not part of
a delivery transaction, i.e. those are not after "MAIL" or that are after
"." and before the next "MAIL".

    # Timeout outside an SMTP transaction:
    #
    # Backwards compatible default, anything much smaller than 30s is
    # probably aggressive, and would need extensive field testing:
    #
    smtpd_idle_timeout = 300s

    # Timeout during an SMTP transaction:
    #
    smtpd_timeout = 300s

The $smtpd_idle_timeout would apply until "MAIL" is received, at which
point the timeout would be changed to "$smtpd_timeout". The timeout would
be set back to $smtpd_idle_timeout when the server:

    - Sends a "." response.
    - Responds to a command that resets the mail transaction
      (RSET, EHLO, HELO, but not "STARTTLS", because we already
      have a separate smtpd_starttls_timeout).
    - Rejects the "DATA" command.

Would this meet your needs? How short a timeout are you considering and
why?

--
        Viktor.

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the "Reply-To" header.

To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:
<mailto:majordomopostfix.org?body=unsubscribe%20postfix-users>

If my response solves your problem, the best way to thank me is to not
send an "it worked, thanks" follow-up. If you must respond, please put
"It worked, thanks" in the "Subject" so I can delete these quickly.