Recipe 9.7 Setting Protocol Timers

Problem

Clients require special configuration to quickly move problem mail to the queue server.

Solution

Create a queue server as described in Recipe 9.6.

On the clients of that server, add defines to the sendmail configuration to quickly timeout bad connections and to quickly timeout remote systems that fail to respond to or provide SMTP commands in a timely manner. Here are sample protocol timer defines that could be used with the confFALLBACK_MX define:

 dnl Use jamis as the fallback mail exchanger define(`confFALLBACK_MX', `jamis.wrotethebook.com') dnl Set the protocol timers to low levels define(`confTO_CONNECT',          `15s') define(`confTO_COMMAND',          `5m') define(`confTO_DATABLOCK',        `5m') define(`confTO_DATAFINAL',        `5m') define(`confTO_DATAINIT',         `15s') define(`confTO_HELO',             `15s') define(`confTO_HOSTSTATUS',       `15s') define(`confTO_ICONNECT',         `15s') define(`confTO_INITIAL',          `15s') define(`confTO_MAIL',             `15s') define(`confTO_QUIT',             `15s') define(`confTO_RCPT',             `15s') define(`confTO_RSET',             `15s') 

Build sendmail.cf , copy it to /etc/mail/sendmail.cf , and restart sendmail, as described in Recipe 1.8.

Discussion

The confFALLBACK_MX define sets the value of the FallbackMXhost option in the sendmail.cf file. Mail is sent to the server defined by FallbackMXhost when the client cannot successfully deliver the mail.

This recipe sets various protocol timers low so that mail to slow or unresponsive hosts is also passed to the queue server for delivery. This recipe also optimizes the client for the average case ”quick, successful mail deliveries ”and sends all problematic mail to the queue server for delivery.

By default, sendmail has very generous SMTP protocol timers. These generous timers mean that sendmail will not give up delivery until it is sure the remote end is dead. This is great for ensuring delivery, but it ties up the sending system waiting for the remote system to respond. Setting short timeouts, such as those in this recipe, means that more deliveries fail, but it also means that the client is not tied up by slow deliveries. Because the queue server uses the default timeouts, much of the undelivered mail that timed out on the client is successfully delivered by the queue server on the first attempt.

Table 9-2 lists each timeout define used in this recipe, its purpose, and the default that is normally used.

Table 9-2. The SMTP protocol timers used in this recipe

The define command

Sets timeout for

Default

confTO_CONNECT

The connect system call to finish

5m

confTO_COMMAND

Waiting for the next command

1h

confTO_DATABLOCK

A read to complete

1h

confTO_DATAFINAL

Acknowledgment of the . at the end of the DATA block

1h

confTO_DATAINIT

Acknowledgment of the DATA command

5m

confTO_HELO

Acknowledgment of the HELO / EHLO command

5m

confTO_HOSTSTATUS

How long host status information is saved

30m

confTO_ICONNECT

Completion of the initial connection attempt

5m

confTO_INITIAL

Receipt of the greetings message

5m

confTO_MAIL

Acknowledgment of the MAIL From : command

10m

confTO_QUIT

Acknowledgment of the QUIT command

2m

confTO_RCPT

Acknowledgment of the RCPT To : command

1h

confTO_RSET

Acknowledgment of the RSET command

5m

This recipe reduces the timeout for most of these protocol timers to 15 seconds ( 15s ), which is enough time for most computers to respond. Some exceptions are the timeout values set for confTO_DATAFINAL , confTO_DATABLOCK , and confTO_COMMAND , which are given a more generous five minute timeout.

The values set in this recipe are based on the fast daemon example in Section 6.2.1 of the sendmail book. The values used here are more generous than those used in the sendmail book, but these values are more appropriate for our sample network. You need to create your own values based on the performance of your system and your network. The sendmail Performance Tuning book discusses protocol timers in Section 6.1.1.

See Also

Recipe 9.6 provides related material that should be reviewed before implementing this recipe. The sendmail book covers the use of these timers in Section 6.2, and, in particular, covers an alternate solution that uses the quick timers and the default timers on a system that does not use a queue server. The sendmail book also covers the timers in Section 24.9.109. sendmail Performance Tuning , by Nick Christenson (Addison Wesley), covers fallback MX hosts in Section 6.3.1.



Sendmail Cookbook
sendmail Cookbook
ISBN: 0596004710
EAN: 2147483647
Year: 2005
Pages: 178
Authors: Craig Hunt

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net