Diego Castillo wrote:
I would like to force my Postfix SMTP server to disconnect from
time to time, in order to prevent its clients from reusing the
same connection for too long or for too many transactions.
If you want to hang up a connection then you need an smtpd
policy daemon that sends a 421 reply.
Would such a policy force Postfix to *close* that particular socket?
Yes. 421 is a "special" reply that signals postfix to close
the connection, and requests the client try again later.
I don't want to force a retry at the client side, I want to force
the client to stop reusing the connection and open a new one from
time to time.
Why in the world would you want to do that??? You can
disconnect, but you can't force the client to open a new
connection. There is no guarantee the client will reconnect
quickly, or ever.
Ideally after a max number of messages, if not possible
after a TTL for the connection between the SMTP client and Postfix.
The postfix anvil service can disconnect a client after too
many messages per time interval (independent of the number of
connections used). This is intended as basic protection from
a runaway client, not to be used for traffic shaping.
http://www.postfix.org/TUNING_README.html#conn_limit
I found this other parameter in the documentation:
http://www.postfix.org/postconf.5.html#smtpd_policy_service_max_ttl
My understanding is that this TTL refers to the connection between
smtpd and the policy server, not between smtpd and the SMTP client.
Unrelated. Postfix does not have a parameter that limits how
long an SMTP client may remain connected, or how many messages
may be sent over a single connection.
What problem are you trying to solve?
--
Noel Jones