Enabling the Postfix fast ETRN service
======================================
-Add an entry to the master.cf file for the new flush daemon:
+Postfix "fast ETRN" speeds up deliveries by looking only at mail
+that is queued for a given destination site. Postfix ordinary ETRN
+attempts to deliver all queued mail. Postfix fast ETRN service is
+available only for destinations that the local MTA is willing to
+relay mail to.
+
+But first you need to configure Postfix to provide fast ETRN service.
+
+- Execute "postfix stop"
+
+- Execute "make install" if you are running an older Postfix version
+ that does not have "fast flush" logfile support,
+
+- Add a "flush" service entry to /etc/postfix/master.cf if you were
+ running an older Postfix version:
- /etc/postfix/master.cf:
flush unix n - n - 0 flushd
-Configure a list of domains that have fast ETRN service and
-what clients can use the service:
+- Execute "postconf hash_queue_names" and verify that the output
+ includes at the very least the "active", "bounce", "defer", and
+ "flush" queue names. If any queue name is missing, edit the
+ main.cf file and either delete the explicit hash_queue_names
+ entry, or add the missing queue names.
+
+- Execute "postconf hash_queue_names" again, just to be sure.
+
+- Edit the main.cf file and specify
- /etc/postfix/etrn:
- domain.name permit_mynetworks
+ enable_fast_flush = yes
-Run the postmap command:
+- Execute "postconf enable_fast_flush", to verify that the fast
+ flush feature is indeed enabled.
- # postmap /etc/postfix/etrn
+- Execute "postfix start"
-Create any missing directories that are needed for fast ETRN service:
+- From a client that is allowed to execute ETRN commands, connect
+ to the Postfix SMTP server and type:
- # postfix check
+ helo my.client.name
+ etrn some.customer.domain
-Configure Postfix to use the fast ETRN service:
+ where "some.customer.domain" is the name of a domain that your
+ mail server is willing to relay mail to.
- /etc/postfix/main.cf:
- etrn_maps = hash:/etc/postfix/etrn
+ In the maillog file, you should see something logged like:
-(specify dbm instead of hash if your machine uses DBM databases
-rather than DB).
+ created fast ETRN cache for some.customer.domain
-Refresh Postfix:
+ If Postfix logs that it cannot create a fast ETRN cache then
+ execute the command "postfix check". You probably skipped some
+ of the above instructions so that the necessary directories were
+ not created.
- # postfix reload
+ If Postfix logs that it refuses fast ETRN service, then either
+ "some.customer.domain" does not exist, or it is not listed as a
+ valid relay destination. Check your relay_domains setting.
-Incompatible changes with snapshot-20000924
+Incompatible changes with snapshot-20000928
===========================================
-After building and installing, you need to "postfix check"
-and "postfix reload".
+You must execute "postfix stop" before installing this release,
+and "postfix start" after updating the software. Some default
+parameter settings have changed, as detailed below.
+
+If this release does not work for you, you can go back to a previous
+Postfix version without losing your mail, subject to the "incompatible
+changes" listed for previous Postfix releases below.
+
+In order to improve performance of one-to-one deliveries, Postfix
+by default now looks at up to 10000 messages at a time (was: 1000).
+This change affects the following main.cf configuration parameters:
-The ETRN service is no longer enabled by default. You need to
-configure what domains and what clients can use ETRN. See the
-ETRN_README file for more information.
+ qmgr_message_active_limit: default setting increased to 10000
+ hash_queue_names: default setting now includes the active queue
-The smtpd_etrn_restrictions are gone.
+With this change, the active queue must no longer be a flat directory.
+
+If your main.cf file has an explicit hash_queue_names setting, and
+the active queue is not listed there, Postfix will perform very
+poorly when delivering lots of mail.
+
+Major changes with snapshot-20000929
+====================================
-The "flush" queue should be listed in "hash_queue_names".
+Until now, Postfix does a rather lame effort at implementing the
+SMTP ETRN command - it attempts to deliver all mail in the queue,
+regardless of its destination. This is slow if your mail server
+queues mail for lots of different sites.
+
+This release introduces "fast ETRN", which delivers only mail that
+is known to be queued for a site. The per-destination queue info
+is kept in so-called "fast flush" logfiles. A "fast flush" logfile
+is "flushed" after Postfix receives an appropriate ETRN command,
+or after someone executes the command "sendmail -qRsite" for an
+appropriate site.
+
+A missing "fast flush" logfile is created automatically when an
+SMTP client issues the ETRN command - but only for destinations
+that the local MTA is willing to relay mail to. This policy is
+currently hard coded. Other destinations remain stuck with the
+old "slow" ETRN service that attempts to deliver all mail in the
+queue.
+
+See the file ETRN_README for how to turn on the "fast ETRN" service.
Incompatible changes with snapshot-20000924
===========================================
+++ /dev/null
-#
-# ETRN(5) ETRN(5)
-#
-# NAME
-# etrn - format of Postfix etrn table
-#
-# SYNOPSIS
-# etrn_maps = hash:/etc/postfix/etrn
-# etrn_maps = dbm:/etc/postfix/etrn
-#
-# postmap /etc/postfix/etrn
-#
-# DESCRIPTION
-# The optional etrn file specifies what destination domain
-# names can be specified in SMTP ETRN commands. This infor-
-# mation is used by the smtpd(8) and flushd(8) daemon.
-#
-# Normally, the file serves as input to the postmap(1) com-
-# mand. The result, an indexed file in dbm or db format, is
-# used for fast searching by the mail system. Execute the
-# command postmap /etc/postfix/etrn in order to rebuild the
-# indexed file after changing the etrn table.
-#
-# When the table is provided via other means such as NIS,
-# LDAP, SQL, or as regular expressions, the same lookups are
-# done as for ordinary indexed files.
-#
-# TABLE FORMAT
-# The format of the etrn table is as follows:
-#
-# blanks and comments
-# Blank lines are ignored, as are lines beginning
-# with `#'.
-#
-# domain restrictions
-# The left-hand side, domain, specifies a destination
-# domain name that can be specified in ETRN commands.
-#
-# The right-hand side specifies one or more access
-# restrictions. Restrictions are processed in the
-# given order and the search stops at the first
-# match.
-#
-# reject_unknown_client
-# Reject the request if the client hostname is
-# unknown.
-#
-# permit_mynetworks
-# Permit the request if the client address
-# matches $mynetworks.
-#
-# reject_maps_rbl
-# Reject the request if the reverse client
-# network address is listed under
-# $maps_rbl_domains.
-#
-# reject Reject the request. Place this at the end of
-#
-# 1
-#
-# ETRN(5) ETRN(5)
-#
-# a restriction list.
-#
-# permit Permit the request. Place this at the end of
-# a restriction list.
-#
-# CONFIGURATION PARAMETERS
-# The following main.cf parameters are especially relevant
-# to this topic. See the Postfix main.cf file for syntax
-# details and for default values. Use the postfix reload
-# command after a configuration change.
-#
-# etrn_maps
-# Tables that specify what domains have ETRN service.
-# For each table entry, the left-hand side specifies
-# a destination domain name that can be specified in
-# an ETRN request, and the right-hand side specifies
-# a list of access restrictions for SMTP clients that
-# issue ETRN for the domain.
-#
-# fast_flush_maps
-# The table with names of destinations that this MTA
-# provides the fast flush service for. By default,
-# this is set to $etrn_maps.
-#
-# relay_domains
-# The list of domains that this MTA is willing to
-# forward mail from or to. This defaults to $mydesti-
-# nation, $fast_flush_maps.
-#
-# SEE ALSO
-# smtpd(8) Postfix SMTP server
-# flushd(1) Postfix fast flush service
-# sendmail(5) sendmail-compatible interface
-# pcre_table(5) format of PCRE tables
-# regexp_table(5) format of POSIX regular expression tables
-#
-# LICENSE
-# The Secure Mailer license must be distributed with this
-# software.
-#
-# AUTHOR(S)
-# Wietse Venema
-# IBM T.J. Watson Research
-# P.O. Box 704
-# Yorktown Heights, NY 10598, USA
-#
-# 2
-#
#mynetworks = 168.100.189.0/28, 127.0.0.0/8
#mynetworks = $config_directory/mynetworks
+# FAST ETRN SERVICE
+#
+# By default, Postfix does a rather lame effort at implementing the
+# SMTP ETRN command - it attempts to deliver all queued mail regardless
+# of its destination. This does not work well if your mail server
+# queues mail for lots of sites. In order to enable a faster ETRN
+# that only delivers mail that is known to be queued for a site,
+# enable the fast flush cache. Currently, "fast ETRN" is available
+# only for destinations that the local system is willing to relay
+# mail to (as specified in the relay_domains parameter).
+#
+#enable_fast_flush = yes
+#enable_fast_flush = no
+
# SHOW SOFTWARE VERSION OR NOT
#
# The smtpd_banner parameter specifies the text that follows the 220
#
double_bounce_sender = double-bounce
-# The fast_flush_maps parameter specifies what destination domain
-# names can be used in SMTP ETRN requests and in "sendmail -qRdomain.name"
-# commands. By default, the value is $etrn_maps, the set of domain names
-# that can be used in SMTP ETRN requests (see sample-smtpd.cf).
-#
-# The fast_flush_maps parameter is also used in the default settings
-# of the relay_domains configuration parameter.
-#
-fast_flush_maps =
-
# The hash_queue_depth parameter specifies the number of subdirectory
# levels below the queue directories listed in the hash_queue_names
# parameter.
#
#disable_vrfy_command = no
-# The etrn_maps parameter specifies what domains have ETRN service.
-# For each table entry, the left-hand side specifies a destination
-# domain name, and the right-hand side specifies a list of access
-# restrictions for clients that issue ETRN for the domain.
-#
-# The default is to disallow ETRN commands. The following restrictions
-# are available:
-#
-# reject_unknown_client: reject the request if the client hostname is unknown.
-# permit_mynetworks: permit if the client address matches $mynetworks.
-# reject_maps_rbl: reject if the reverse client network address
-# is listed under $maps_rbl_domains.
-# reject: reject the request. Place this at the end of a restriction.
-# permit: permit the request. Place this at the end of a restriction.
-#
-# etrn_maps is also the default value for the fast_flush_maps parameter
-# which controls the fast flush service which is used for ETRN and for
-# "sendmail -qRdomain.name"
-#
-etrn_maps =
-
# The smtpd_banner parameter specifies the text that follows the 220
# status code in the SMTP greeting banner. Some people like to see
# the mail version advertised. By default, Postfix shows no version.
# smtpd_banner = $myhostname ESMTP $mail_name ($mail_version)
smtpd_banner = $myhostname ESMTP $mail_name
+# The smtpd_etrn_restrictions parameter restricts what clients are
+# allowed to issue the ETRN command. The present Postfix ETRN differs
+# from other ETRN implementations in that it flushes mail for all
+# destinations. This will change in the future.
+#
+# The default is to allow ETRN from any host. The following restrictions
+# are available:
+#
+# reject_unknown_client: reject the request if the client hostname is unknown.
+# permit_mynetworks: permit if the client address matches $mynetworks.
+# check_client_access maptype:mapname
+# maptype:mapname: look up client name, parent domains, client address,
+# or networks obtained by stripping octets.
+# Reject if result is REJECT or "[45]xx text"
+# Permit otherwise.
+# reject_maps_rbl: reject if the reverse client network address
+# is listed under $maps_rbl_domains.
+# reject: reject the request. Place this at the end of a restriction.
+# permit: permit the request. Place this at the end of a restriction.
+smtpd_etrn_restrictions =
+
# The smtpd_recipient_limit parameter restricts the number of recipients
# that the SMTP server accepts per message delivery.
#
# permit_mx_backup restriction, in the description of the
# smtpd_recipient_restrictions parameter.
#
-relay_domains = $mydestination $fast_flush_maps
+relay_domains = $mydestination
#
# RESPONSE CODES
postlog.1.html postdrop.1.html postmap.1.html sendmail.1.html \
postsuper.1.html
CONFIG = access.5.html aliases.5.html canonical.5.html relocated.5.html \
- transport.5.html virtual.5.html pcre_table.5.html regexp_table.5.html \
- etrn.5.html
+ transport.5.html virtual.5.html pcre_table.5.html regexp_table.5.html
update: $(DAEMONS) $(COMMANDS) $(CONFIG)
canonical.5.html: ../proto/canonical
srctoman - $? | nroff -man | man2html | postlink >$@
-etrn.5.html: ../proto/etrn
- srctoman - $? | nroff -man | man2html | postlink >$@
-
pcre_table.5.html: ../proto/pcre_table
srctoman - $? | nroff -man | man2html | postlink >$@
+++ /dev/null
-<html> <head> </head> <body> <pre>
-
-
-
-ETRN(5) ETRN(5)
-
-
-<b>NAME</b>
- etrn - format of Postfix etrn table
-
-<b>SYNOPSIS</b>
- <b>etrn</b><i>_</i><b>maps</b> <b>=</b> <b>hash:/etc/postfix/etrn</b>
- <b>etrn</b><i>_</i><b>maps</b> <b>=</b> <b>dbm:/etc/postfix/etrn</b>
-
- <b>postmap</b> <b>/etc/postfix/etrn</b>
-
-<b>DESCRIPTION</b>
- The optional <b>etrn</b> file specifies what destination domain
- names can be specified in SMTP <b>ETRN</b> commands. This infor-
- mation is used by the <a href="smtpd.8.html"><b>smtpd</b>(8)</a> and <a href="flushd.8.html"><b>flushd</b>(8)</a> daemon.
-
- Normally, the file serves as input to the <a href="postmap.1.html"><b>postmap</b>(1)</a> com-
- mand. The result, an indexed file in <b>dbm</b> or <b>db</b> format, is
- used for fast searching by the mail system. Execute the
- command <b>postmap</b> <b>/etc/postfix/etrn</b> in order to rebuild the
- indexed file after changing the etrn table.
-
- When the table is provided via other means such as NIS,
- LDAP, SQL, or as regular expressions, the same lookups are
- done as for ordinary indexed files.
-
-<b>TABLE</b> <b>FORMAT</b>
- The format of the <b>etrn</b> table is as follows:
-
- blanks and comments
- Blank lines are ignored, as are lines beginning
- with `#'.
-
- <i>domain</i> <i>restrictions</i>
- The left-hand side, <i>domain</i>, specifies a destination
- domain name that can be specified in <b>ETRN</b> commands.
-
- The right-hand side specifies one or more access
- restrictions. Restrictions are processed in the
- given order and the search stops at the first
- match.
-
- <b>reject</b><i>_</i><b>unknown</b><i>_</i><b>client</b>
- Reject the request if the client hostname is
- unknown.
-
- <b>permit</b><i>_</i><b>mynetworks</b>
- Permit the request if the client address
- matches $mynetworks.
-
- <b>reject</b><i>_</i><b>maps</b><i>_</i><b>rbl</b>
- Reject the request if the reverse client
- network address is listed under
- $maps_rbl_domains.
-
- <b>reject</b> Reject the request. Place this at the end of
-
-
-
- 1
-
-
-
-
-
-ETRN(5) ETRN(5)
-
-
- a restriction list.
-
- <b>permit</b> Permit the request. Place this at the end of
- a restriction list.
-
-
-<b>CONFIGURATION</b> <b>PARAMETERS</b>
- The following <b>main.cf</b> parameters are especially relevant
- to this topic. See the Postfix <b>main.cf</b> file for syntax
- details and for default values. Use the <b>postfix</b> <b>reload</b>
- command after a configuration change.
-
- <b>etrn</b><i>_</i><b>maps</b>
- Tables that specify what domains have <b>ETRN</b> service.
- For each table entry, the left-hand side specifies
- a destination domain name that can be specified in
- an <b>ETRN</b> request, and the right-hand side specifies
- a list of access restrictions for SMTP clients that
- issue <b>ETRN</b> for the domain.
-
- <b>fast</b><i>_</i><b>flush</b><i>_</i><b>maps</b>
- The table with names of destinations that this MTA
- provides the fast flush service for. By default,
- this is set to $<b>etrn</b><i>_</i><b>maps</b>.
-
- <b>relay</b><i>_</i><b>domains</b>
- The list of domains that this MTA is willing to
- forward mail from or to. This defaults to <b>$mydesti-</b>
- <b>nation,</b> <b>$fast</b><i>_</i><b>flush</b><i>_</i><b>maps</b>.
-
-<b>SEE</b> <b>ALSO</b>
- <a href="smtpd.8.html">smtpd(8)</a> Postfix SMTP server
- flushd(1) Postfix fast flush service
- sendmail(5) sendmail-compatible interface
- <a href="pcre_table.5.html">pcre_table(5)</a> format of PCRE tables
- <a href="regexp_table.5.html">regexp_table(5)</a> format of POSIX regular expression tables
-
-<b>LICENSE</b>
- The Secure Mailer license must be distributed with this
- software.
-
-<b>AUTHOR(S)</b>
- Wietse Venema
- IBM T.J. Watson Research
- P.O. Box 704
- Yorktown Heights, NY 10598, USA
-
-
-
-
-
-
-
-
-
-
-
- 2
-
-
-</pre> </body> </html>
This server implements the following requests:
<b>FLUSH</b><i>_</i><b>REQ</b><i>_</i><b>ADD</b> <i>sitename</i> <i>queue_id</i>
- Append <i>queue_id</i> to the fast flush logfile for the
- specified site.
+ Append <i>queue_id</i> to the fast flush log for the spec-
+ ified site.
<b>FLUSH</b><i>_</i><b>REQ</b><i>_</i><b>SEND</b> <i>sitename</i>
Arrange for the delivery of all messages that are
name, bad request parameter value).
<b>FLUSH</b><i>_</i><b>STAT</b><i>_</i><b>UNKNOWN</b>
- The specified site has no fast flush logfile and is
- not configured to have one.
+ The specified site has no fast flush log.
- Fast flush logfiles are truncated only after a flush
- request. In order to prevent fast flush logfiles from
- growing without bounds, and to prevent them from accumu-
- lating too much outdated information, the flush service
- generates a pro-active flush request once every every 1000
- append requests. This should not impact operation.
+ Fast flush logfiles are truncated only after a flush
+ request. In order to prevent fast flush logs from growing
+ too large, and to prevent them from accumulating too much
+ outdated information, the flush service generates a pro-
+ active flush request once every every 1000 append
+ requests. This should not impact operation.
<b>SECURITY</b>
The fast flush server is moderately security-sensitive. It
- does not talk to the network, but it does talk to local
+ does not talk to the network, but it does talk to local
unprivileged users, in order to emulate "sendmail -qRsite"
- behavior. For this reason all strings in a request are
- truncated at <i>line_length_limit</i>.
+ behavior. For this reason all strings in a request are
+ truncated at <i>line_length_limit</i>, before they are subjected
+ to further validation.
The fast flush server can run chrooted at fixed low privi-
lege.
details and for default values. Use the <b>postfix</b> <b>reload</b>
command after a configuration change.
- <b>etrn</b><i>_</i><b>maps</b>
- Tables that specify what domains have <b>ETRN</b> service.
- For each table entry, the left-hand side specifies
- a destination domain name that can be specified in
- an <b>ETRN</b> request, and the right-hand side specifies
- a list of access restrictions for SMTP clients that
- issue <b>ETRN</b> for the domain.
-
- <b>fast</b><i>_</i><b>flush</b><i>_</i><b>maps</b>
- The table with names of destinations that this MTA
- provides the fast flush service for. By default,
- this is set to $<b>etrn</b><i>_</i><b>maps</b>.
-
<b>line</b><i>_</i><b>length</b><i>_</i><b>limit</b>
- Maximal length of strings in a fast flush client
+ Maximal length of strings in a fast flush client
request.
<b>SEE</b> <b>ALSO</b>
syslogd(8) system logging
<b>LICENSE</b>
- The Secure Mailer license must be distributed with this
+ The Secure Mailer license must be distributed with this
software.
<b>AUTHOR(S)</b>
+
+
+
+
+
+
+
+
+
+
+
+
+
<b>-qR</b><i>site</i>
Schedule immediate delivery of all mail that is
queued for the named <i>site</i>. This functionality is
- available only for sites that are configured for
- the <b>fast</b> <b>flush</b> service support as described in
- <b>flushd</b>(8). For other sites, use the slower
+ available only for sites that have a so-called <b>fast</b>
+ <b>flush</b> logfile as described in <a href="flushd.8.html"><b>flushd</b>(8)</a>. For other
+ sites, use the slower <b>sendmail</b> <b>-q</b> command instead.
SENDMAIL(1) SENDMAIL(1)
- <b>sendmail</b> <b>-q</b> command instead.
-
<b>-qS</b><i>site</i>
This command is not implemented. Use the slower
<b>sendmail</b> <b>-q</b> command instead.
The amount of original message context that is sent
along with a non-delivery notification.
+ <b>database</b><i>_</i><b>type</b>
+ Default alias etc. database type. On many UNIX
SENDMAIL(1) SENDMAIL(1)
- <b>database</b><i>_</i><b>type</b>
- Default alias etc. database type. On many UNIX sys-
- tems the default type is either <b>dbm</b> or <b>hash</b>.
+ systems the default type is either <b>dbm</b> or <b>hash</b>.
<b>debugger</b><i>_</i><b>command</b>
Command that is executed after a Postfix daemon has
ging level by the amount specified in the
<b>debug</b><i>_</i><b>peer</b><i>_</i><b>level</b> parameter.
- <b>etrn</b><i>_</i><b>maps</b>
- Tables that specify what domains have <b>ETRN</b> service.
- For each table entry, the left-hand side specifies
- a destination domain name that can be specified in
- an <b>ETRN</b> request, and the right-hand side specifies
- a list of access restrictions for SMTP clients that
- issue <b>ETRN</b> for the domain.
-
- <b>fast</b><i>_</i><b>flush</b><i>_</i><b>maps</b>
- The table with names of destinations that this MTA
- provides the fast flush service for. By default,
- this is set to $<b>etrn</b><i>_</i><b>maps</b>.
-
<b>fork</b><i>_</i><b>attempts</b>
- Number of attempts to <b>fork</b>() a process before giv-
+ Number of attempts to <b>fork</b>() a process before giv-
ing up.
<b>fork</b><i>_</i><b>delay</b>
- Delay in seconds between successive <b>fork</b>()
+ Delay in seconds between successive <b>fork</b>()
attempts.
<b>hopcount</b><i>_</i><b>limit</b>
Limit the number of <b>Received:</b> message headers.
<b>mail</b><i>_</i><b>owner</b>
- The owner of the mail queue and of most Postfix
+ The owner of the mail queue and of most Postfix
processes.
<b>command</b><i>_</i><b>directory</b>
- Directory with Postfix support commands (default:
+ Directory with Postfix support commands (default:
<b>$program</b><i>_</i><b>directory</b>).
<b>daemon</b><i>_</i><b>directory</b>
- Directory with Postfix daemon programs (default:
+ Directory with Postfix daemon programs (default:
<b>$program</b><i>_</i><b>directory</b>).
-
-
- 5
-
-
-
-
-
-SENDMAIL(1) SENDMAIL(1)
-
-
<b>queue</b><i>_</i><b>directory</b>
- Top-level directory of the Postfix queue. This is
+ Top-level directory of the Postfix queue. This is
also the root directory of Postfix daemons that run
chrooted.
<b>queue</b><i>_</i><b>run</b><i>_</i><b>delay</b>
- The time between successive scans of the deferred
+ The time between successive scans of the deferred
queue.
<b>SEE</b> <b>ALSO</b>
<a href="postalias.1.html">postalias(1)</a> maintain alias database
<a href="postdrop.1.html">postdrop(1)</a> privileged posting agent
<a href="postfix.1.html">postfix(1)</a> mail system control
+
+
+
+ 5
+
+
+
+
+
+SENDMAIL(1) SENDMAIL(1)
+
+
<a href="postkick.1.html">postkick(1)</a> kick a Postfix daemon
<a href="qmgr.8.html">qmgr(8)</a> queue manager
<a href="showq.8.html">showq(8)</a> list mail queue
<a href="smtpd.8.html">smtpd(8)</a> SMTP server
- flushd(8) fast flush service
+ <a href="flushd.8.html">flushd(8)</a> fast flush service
syslogd(8) system logging
<b>LICENSE</b>
- The Secure Mailer license must be distributed with this
+ The Secure Mailer license must be distributed with this
software.
<b>AUTHOR(S)</b>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
The SMTP server implements a variety of policies for con-
nection requests, and for parameters given to <b>HELO,</b> <b>ETRN,</b>
- <b>MAIL</b> <b>FROM,</b> <b>VRFY</b>, and <b>RCPT</b> <b>TO</b> commands. They are detailed
+ <b>MAIL</b> <b>FROM,</b> <b>VRFY</b> and <b>RCPT</b> <b>TO</b> commands. They are detailed
below and in the <b>main.cf</b> configuration file.
<b>SECURITY</b>
ging level by the amount specified in the
<b>debug</b><i>_</i><b>peer</b><i>_</i><b>level</b> parameter.
+ <b>enable</b><i>_</i><b>fast</b><i>_</i><b>flush</b>
+ Enable the "fast flush" cache for improved ETRN
+ performance. By default, Postfix attempts to
+ deliver all messages in the queue after receiving
+ an ETRN command. The "fast flush" cache keeps a
+ record of what mail is queued up for specific des-
+ tinations. Currently, "fast flush" support is
+ available only for destinations that the local MTA
+ is willing to relay mail to (i.e. the policy is
+ hard coded).
+
<b>error</b><i>_</i><b>notice</b><i>_</i><b>recipient</b>
Recipient of protocol/policy/resource/software
error notices.
- <b>etrn</b><i>_</i><b>maps</b>
- Tables that specify what domains have <b>ETRN</b> service.
- For each table entry, the left-hand side specifies
- a destination domain name that can be specified in
- an <b>ETRN</b> request, and the right-hand side specifies
- a list of access restrictions for clients that
- issue <b>ETRN</b> for the domain.
-
<b>hopcount</b><i>_</i><b>limit</b>
Limit the number of <b>Received:</b> message headers.
<b>local</b><i>_</i><b>recipient</b><i>_</i><b>maps</b>
- List of maps with user names that are local to
+ List of maps with user names that are local to
<b>$myorigin</b> or <b>$inet</b><i>_</i><b>interfaces</b>. If this parameter is
- defined, then the SMTP server rejects mail for
+ defined, then the SMTP server rejects mail for
unknown local users.
<b>notify</b><i>_</i><b>classes</b>
List of error classes. Of special interest are:
- <b>policy</b> When a client violates any policy, mail a
+ <b>policy</b> When a client violates any policy, mail a
transcript of the entire SMTP session to the
postmaster.
<b>protocol</b>
- When a client violates the SMTP protocol or
+ When a client violates the SMTP protocol or
issues an unimplemented command, mail a
transcript of the entire SMTP session to the
postmaster.
<b>smtpd</b><i>_</i><b>banner</b>
- Text that follows the <b>220</b> status code in the SMTP
+ Text that follows the <b>220</b> status code in the SMTP
greeting banner.
<b>smtpd</b><i>_</i><b>recipient</b><i>_</i><b>limit</b>
- Restrict the number of recipients that the SMTP
+ Restrict the number of recipients that the SMTP
server accepts per message delivery.
<b>smtpd</b><i>_</i><b>timeout</b>
- Limit the time to send a server response and to
+ Limit the time to send a server response and to
receive a client request.
-<b>Resource</b> <b>controls</b>
-
-
3
SMTPD(8) SMTPD(8)
+<b>Resource</b> <b>controls</b>
<b>line</b><i>_</i><b>length</b><i>_</i><b>limit</b>
- Limit the amount of memory in bytes used for the
+ Limit the amount of memory in bytes used for the
handling of partial input lines.
<b>message</b><i>_</i><b>size</b><i>_</i><b>limit</b>
ing on-disk storage for envelope information.
<b>queue</b><i>_</i><b>minfree</b>
- Minimal amount of free space in bytes in the queue
- file system for the SMTP server to accept any mail
+ Minimal amount of free space in bytes in the queue
+ file system for the SMTP server to accept any mail
at all.
<b>Tarpitting</b>
<b>smtpd</b><i>_</i><b>soft</b><i>_</i><b>error</b><i>_</i><b>limit</b>
When an SMTP client has made this number of errors,
- wait <i>error_count</i> seconds before responding to any
+ wait <i>error_count</i> seconds before responding to any
client request.
<b>smtpd</b><i>_</i><b>hard</b><i>_</i><b>error</b><i>_</i><b>limit</b>
- Disconnect after a client has made this number of
+ Disconnect after a client has made this number of
errors.
<b>smtpd</b><i>_</i><b>junk</b><i>_</i><b>command</b><i>_</i><b>limit</b>
Limit the number of times a client can issue a junk
- command such as NOOP, VRFY, ETRN or RSET in one
- SMTP session before it is penalized with tarpit
+ command such as NOOP, VRFY, ETRN or RSET in one
+ SMTP session before it is penalized with tarpit
delays.
+<b>ETRN</b> <b>service</b>
+ <b>smtpd</b><i>_</i><b>etrn</b><i>_</i><b>restrictions</b>
+ Restrict what domain names can be used in <b>ETRN</b> com-
+ mands, and what clients may issue <b>ETRN</b> commands.
+ The restrictions are like the UCE restrictions
+ below. Fast <b>ETRN</b> service is limited to destinations
+ that list this MTA as mail exchanger.
+
<b>UCE</b> <b>control</b> <b>restrictions</b>
<b>smtpd</b><i>_</i><b>client</b><i>_</i><b>restrictions</b>
Restrict what clients may connect to this mail sys-
tem.
<b>smtpd</b><i>_</i><b>helo</b><i>_</i><b>required</b>
- Require that clients introduce themselves at the
+ Require that clients introduce themselves at the
beginning of an SMTP session.
<b>smtpd</b><i>_</i><b>helo</b><i>_</i><b>restrictions</b>
- Restrict what client hostnames are allowed in <b>HELO</b>
+ Restrict what client hostnames are allowed in <b>HELO</b>
and <b>EHLO</b> commands.
- <b>smtpd</b><i>_</i><b>sender</b><i>_</i><b>restrictions</b>
- Restrict what sender addresses are allowed in <b>MAIL</b>
- <b>FROM</b> commands.
-
- <b>smtpd</b><i>_</i><b>recipient</b><i>_</i><b>restrictions</b>
- Restrict what recipient addresses are allowed in
- <b>RCPT</b> <b>TO</b> commands.
-
-
4
SMTPD(8) SMTPD(8)
+ <b>smtpd</b><i>_</i><b>sender</b><i>_</i><b>restrictions</b>
+ Restrict what sender addresses are allowed in <b>MAIL</b>
+ <b>FROM</b> commands.
+
+ <b>smtpd</b><i>_</i><b>recipient</b><i>_</i><b>restrictions</b>
+ Restrict what recipient addresses are allowed in
+ <b>RCPT</b> <b>TO</b> commands.
+
<b>allow</b><i>_</i><b>untrusted</b><i>_</i><b>routing</b>
- Allow untrusted clients to specify addresses with
- sender-specified routing. Enabling this opens up
- nasty relay loopholes involving trusted backup MX
+ Allow untrusted clients to specify addresses with
+ sender-specified routing. Enabling this opens up
+ nasty relay loopholes involving trusted backup MX
hosts.
<b>restriction</b><i>_</i><b>classes</b>
- Declares the name of zero or more parameters that
- contain a list of UCE restrictions. The names of
- these parameters can then be used instead of the
+ Declares the name of zero or more parameters that
+ contain a list of UCE restrictions. The names of
+ these parameters can then be used instead of the
restriction lists that they represent.
<b>maps</b><i>_</i><b>rbl</b><i>_</i><b>domains</b>
- List of DNS domains that publish the addresses of
+ List of DNS domains that publish the addresses of
blacklisted hosts.
<b>relay</b><i>_</i><b>domains</b>
- Restrict what domains or networks this mail system
+ Restrict what domains or networks this mail system
will relay mail from or to.
<b>UCE</b> <b>control</b> <b>responses</b>
<b>access</b><i>_</i><b>map</b><i>_</i><b>reject</b><i>_</i><b>code</b>
- Server response when a client violates an access
+ Server response when a client violates an access
database restriction.
<b>invalid</b><i>_</i><b>hostname</b><i>_</i><b>reject</b><i>_</i><b>code</b>
- Server response when a client violates the
+ Server response when a client violates the
<b>reject</b><i>_</i><b>invalid</b><i>_</i><b>hostname</b> restriction.
<b>maps</b><i>_</i><b>rbl</b><i>_</i><b>reject</b><i>_</i><b>code</b>
- Server response when a client violates the
+ Server response when a client violates the
<b>maps</b><i>_</i><b>rbl</b><i>_</i><b>domains</b> restriction.
<b>reject</b><i>_</i><b>code</b>
- Response code when the client matches a <b>reject</b>
+ Response code when the client matches a <b>reject</b>
restriction.
<b>relay</b><i>_</i><b>domains</b><i>_</i><b>reject</b><i>_</i><b>code</b>
- Server response when a client attempts to violate
+ Server response when a client attempts to violate
the mail relay policy.
<b>unknown</b><i>_</i><b>address</b><i>_</i><b>reject</b><i>_</i><b>code</b>
- Server response when a client violates the
+ Server response when a client violates the
<b>reject</b><i>_</i><b>unknown</b><i>_</i><b>address</b> restriction.
- <b>unknown</b><i>_</i><b>client</b><i>_</i><b>reject</b><i>_</i><b>code</b>
- Server response when a client without address to
- name mapping violates the <b>reject</b><i>_</i><b>unknown</b><i>_</i><b>clients</b>
- restriction.
-
- <b>unknown</b><i>_</i><b>hostname</b><i>_</i><b>reject</b><i>_</i><b>code</b>
- Server response when a client violates the
- <b>reject</b><i>_</i><b>unknown</b><i>_</i><b>hostname</b> restriction.
SMTPD(8) SMTPD(8)
+ <b>unknown</b><i>_</i><b>client</b><i>_</i><b>reject</b><i>_</i><b>code</b>
+ Server response when a client without address to
+ name mapping violates the <b>reject</b><i>_</i><b>unknown</b><i>_</i><b>clients</b>
+ restriction.
+
+ <b>unknown</b><i>_</i><b>hostname</b><i>_</i><b>reject</b><i>_</i><b>code</b>
+ Server response when a client violates the
+ <b>reject</b><i>_</i><b>unknown</b><i>_</i><b>hostname</b> restriction.
+
<b>SEE</b> <b>ALSO</b>
<a href="cleanup.8.html">cleanup(8)</a> message canonicalization
<a href="master.8.html">master(8)</a> process manager
syslogd(8) system logging
<b>LICENSE</b>
- The Secure Mailer license must be distributed with this
+ The Secure Mailer license must be distributed with this
software.
<b>AUTHOR(S)</b>
-
-
-
-
-
-
-
-
-
<dt>Default:
<dd><b>relay_domains = <a href="basic.html#mydestination">
-$mydestination $fast_flush_maps</a></b>
-
-<p>
-
-(The <b>$fast_flush_maps</b> parameter specifies, among others,
-what destinations can be used in SMTP ETRN requests or in <b>sendmail
--qR</b><i>sitename</i> commands. This parameter defaults to
-<b>$etrn_maps</b>, the list of destinations that can be used in
-SMTP ETRN requests. More details in the <a href="etrn.5.html">etrn</a>
-manual page.)
+$mydestination</a></b>
<p>
man1/postmap.1 man1/sendmail.1 man1/mailq.1 man1/newaliases.1 \
man1/postsuper.1
CONFIG = man5/access.5 man5/aliases.5 man5/canonical.5 man5/relocated.5 \
- man5/transport.5 man5/virtual.5 man5/pcre_table.5 man5/regexp_table.5 \
- man5/etrn.5
+ man5/transport.5 man5/virtual.5 man5/pcre_table.5 man5/regexp_table.5
update: $(DAEMONS) $(COMMANDS) $(CONFIG)
man5/canonical.5: ../proto/canonical
../mantools/srctoman - $? >$@
-man5/etrn.5: ../proto/etrn
- ../mantools/srctoman - $? >$@
-
man5/pcre_table.5: ../proto/pcre_table
../mantools/srctoman - $? >$@
.IP \fB-qR\fIsite\fR
Schedule immediate delivery of all mail that is queued for the named
\fIsite\fR.
-This functionality is available only for sites that are configured
-for the \fBfast flush\fR service support as described in
-\fBflushd\fR(8). For other sites, use the slower \fBsendmail -q\fR
-command instead.
+This functionality is available only for sites that have a so-called
+\fBfast flush\fR logfile as described in \fBflushd\fR(8). For other
+sites, use the slower \fBsendmail -q\fR command instead.
.IP \fB-qS\fIsite\fR
This command is not implemented. Use the slower \fBsendmail -q\fR
command instead.
List of domain or network patterns. When a remote host matches
a pattern, increase the verbose logging level by the amount
specified in the \fBdebug_peer_level\fR parameter.
-.IP \fBetrn_maps\fR
-Tables that specify what domains have \fBETRN\fR service. For each
-table entry, the left-hand side specifies a destination domain name
-that can be specified in an \fBETRN\fR request, and the right-hand
-side specifies a list of access restrictions for SMTP clients that
-issue \fBETRN\fR for the domain.
-.IP \fBfast_flush_maps\fR
-The table with names of destinations that this MTA provides the
-fast flush service for. By default, this is set to $\fBetrn_maps\fR.
.IP \fBfork_attempts\fR
Number of attempts to \fBfork\fR() a process before giving up.
.IP \fBfork_delay\fR
+++ /dev/null
-.TH ETRN 5
-.ad
-.fi
-.SH NAME
-etrn
-\-
-format of Postfix etrn table
-.SH SYNOPSIS
-.na
-.nf
-\fBetrn_maps = hash:/etc/postfix/etrn\fR
-\fBetrn_maps = dbm:/etc/postfix/etrn\fR
-
-\fBpostmap /etc/postfix/etrn\fR
-.SH DESCRIPTION
-.ad
-.fi
-The optional \fBetrn\fR file specifies what destination domain
-names can be specified in SMTP \fBETRN\fR commands. This information
-is used by the \fBsmtpd\fR(8) and \fBflushd\fR(8) daemon.
-
-Normally, the file serves as input to the \fBpostmap\fR(1) command.
-The result, an indexed file in \fBdbm\fR or \fBdb\fR format,
-is used for fast searching by the mail system. Execute the command
-\fBpostmap /etc/postfix/etrn\fR in order to rebuild the indexed
-file after changing the etrn table.
-
-When the table is provided via other means such as NIS, LDAP,
-SQL, or as regular expressions, the same lookups are done as
-for ordinary indexed files.
-.SH TABLE FORMAT
-.na
-.nf
-.ad
-.fi
-The format of the \fBetrn\fR table is as follows:
-.IP "blanks and comments"
-Blank lines are ignored, as are lines beginning with `#'.
-.IP "\fIdomain restrictions\fR"
-The left-hand side, \fIdomain\fR, specifies a destination domain
-name that can be specified in \fBETRN\fR commands.
-.sp
-The right-hand side specifies one or more access restrictions.
-Restrictions are processed in the given order and the search
-stops at the first match.
-.RS
-.IP \fBreject_unknown_client\fR
-Reject the request if the client hostname is unknown.
-.IP \fBpermit_mynetworks\fR
-Permit the request if the client address matches $mynetworks.
-.IP \fBreject_maps_rbl\fR
-Reject the request if the reverse client network address
-is listed under $maps_rbl_domains.
-.IP \fBreject\fR
-Reject the request. Place this at the end of a restriction list.
-.IP \fBpermit\fR
-Permit the request. Place this at the end of a restriction list.
-.RE
-.PP
-.SH CONFIGURATION PARAMETERS
-.na
-.nf
-.ad
-.fi
-The following \fBmain.cf\fR parameters are especially relevant to
-this topic. See the Postfix \fBmain.cf\fR file for syntax details
-and for default values. Use the \fBpostfix reload\fR command after
-a configuration change.
-.IP \fBetrn_maps\fR
-Tables that specify what domains have \fBETRN\fR service. For each
-table entry, the left-hand side specifies a destination domain name
-that can be specified in an \fBETRN\fR request, and the right-hand
-side specifies a list of access restrictions for SMTP clients that
-issue \fBETRN\fR for the domain.
-.IP \fBfast_flush_maps\fR
-The table with names of destinations that this MTA provides the
-fast flush service for. By default, this is set to $\fBetrn_maps\fR.
-.IP \fBrelay_domains\fR
-The list of domains that this MTA is willing to forward mail from
-or to. This defaults to \fB$mydestination, $fast_flush_maps\fR.
-.SH SEE ALSO
-.na
-.nf
-smtpd(8) Postfix SMTP server
-flushd(1) Postfix fast flush service
-sendmail(5) sendmail-compatible interface
-pcre_table(5) format of PCRE tables
-regexp_table(5) format of POSIX regular expression tables
-.SH LICENSE
-.na
-.nf
-.ad
-.fi
-The Secure Mailer license must be distributed with this software.
-.SH AUTHOR(S)
-.na
-.nf
-Wietse Venema
-IBM T.J. Watson Research
-P.O. Box 704
-Yorktown Heights, NY 10598, USA
This server implements the following requests:
.IP "\fBFLUSH_REQ_ADD\fI sitename queue_id\fR"
-Append \fIqueue_id\fR to the fast flush logfile for the
+Append \fIqueue_id\fR to the fast flush log for the
specified site.
.IP "\fBFLUSH_REQ_SEND\fI sitename\fR"
Arrange for the delivery of all messages that are listed in the fast
The flush server rejected the request (bad request name, bad
request parameter value).
.IP \fBFLUSH_STAT_UNKNOWN\fR
-The specified site has no fast flush logfile and is not configured
-to have one.
+The specified site has no fast flush log.
.PP
Fast flush logfiles are truncated only after a flush request. In
-order to prevent fast flush logfiles from growing without bounds,
-and to prevent them from accumulating too much outdated information,
-the flush service generates a pro-active flush request once every
+order to prevent fast flush logs from growing too large, and to
+prevent them from accumulating too much outdated information, the
+flush service generates a pro-active flush request once every
every 1000 append requests. This should not impact operation.
.SH SECURITY
.na
The fast flush server is moderately security-sensitive. It does not
talk to the network, but it does talk to local unprivileged users, in
order to emulate "sendmail -qRsite" behavior. For this reason all
-strings in a request are truncated at \fIline_length_limit\fR.
+strings in a request are truncated at \fIline_length_limit\fR,
+before they are subjected to further validation.
The fast flush server can run chrooted at fixed low privilege.
.SH DIAGNOSTICS
this program. See the Postfix \fBmain.cf\fR file for syntax details
and for default values. Use the \fBpostfix reload\fR command after
a configuration change.
-.IP \fBetrn_maps\fR
-Tables that specify what domains have \fBETRN\fR service. For each
-table entry, the left-hand side specifies a destination domain name
-that can be specified in an \fBETRN\fR request, and the right-hand
-side specifies a list of access restrictions for SMTP clients that
-issue \fBETRN\fR for the domain.
-.IP \fBfast_flush_maps\fR
-The table with names of destinations that this MTA provides the
-fast flush service for. By default, this is set to $\fBetrn_maps\fR.
.IP \fBline_length_limit\fR
Maximal length of strings in a fast flush client request.
.SH SEE ALSO
system is not running.
The SMTP server implements a variety of policies for connection
-requests, and for parameters given to \fBHELO, ETRN, MAIL FROM, VRFY\fR,
+requests, and for parameters given to \fBHELO, ETRN, MAIL FROM, VRFY\fR
and \fBRCPT TO\fR commands. They are detailed below and in the
\fBmain.cf\fR configuration file.
.SH SECURITY
List of domain or network patterns. When a remote host matches
a pattern, increase the verbose logging level by the amount
specified in the \fBdebug_peer_level\fR parameter.
+.IP \fBenable_fast_flush\fR
+Enable the "fast flush" cache for improved ETRN performance.
+By default, Postfix attempts to deliver all messages in the queue
+after receiving an ETRN command.
+The "fast flush" cache keeps a record of what mail is queued up for
+specific destinations.
+Currently, "fast flush" support is available only for destinations
+that the local MTA is willing to relay mail to (i.e. the policy
+is hard coded).
.IP \fBerror_notice_recipient\fR
Recipient of protocol/policy/resource/software error notices.
-.IP \fBetrn_maps\fR
-Tables that specify what domains have \fBETRN\fR service. For
-each table entry, the left-hand side specifies a destination
-domain name that can be specified in an \fBETRN\fR request, and
-the right-hand side specifies a list of access restrictions for
-clients that issue \fBETRN\fR for the domain.
.IP \fBhopcount_limit\fR
Limit the number of \fBReceived:\fR message headers.
.IP \fBlocal_recipient_maps\fR
Limit the number of times a client can issue a junk command
such as NOOP, VRFY, ETRN or RSET in one SMTP session before
it is penalized with tarpit delays.
+.SH "ETRN service"
+.ad
+.fi
+.IP \fBsmtpd_etrn_restrictions\fR
+Restrict what domain names can be used in \fBETRN\fR commands,
+and what clients may issue \fBETRN\fR commands. The restrictions
+are like the UCE restrictions below. Fast \fBETRN\fR service is
+limited to destinations that list this MTA as mail exchanger.
.SH "UCE control restrictions"
.ad
.fi
CONFIG = ../conf/access ../conf/aliases ../conf/canonical ../conf/relocated \
../conf/transport ../conf/virtual ../conf/pcre_table \
- ../conf/regexp_table ../conf/etrn
+ ../conf/regexp_table
update: $(CONFIG)
../conf/canonical: canonical
srctoman - $? | nroff -man | col -bx | uniq | sed 's/^/# /' >$@
-../conf/etrn: etrn
- srctoman - $? | nroff -man | col -bx | uniq | sed 's/^/# /' >$@
-
../conf/pcre_table: pcre_table
srctoman - $? | nroff -man | col -bx | uniq | sed 's/^/# /' >$@
+++ /dev/null
-#++
-# NAME
-# etrn 5
-# SUMMARY
-# format of Postfix etrn table
-# SYNOPSIS
-# \fBetrn_maps = hash:/etc/postfix/etrn\fR
-# \fBetrn_maps = dbm:/etc/postfix/etrn\fR
-#
-# \fBpostmap /etc/postfix/etrn\fR
-# DESCRIPTION
-# The optional \fBetrn\fR file specifies what destination domain
-# names can be specified in SMTP \fBETRN\fR commands. This information
-# is used by the \fBsmtpd\fR(8) and \fBflushd\fR(8) daemon.
-#
-# Normally, the file serves as input to the \fBpostmap\fR(1) command.
-# The result, an indexed file in \fBdbm\fR or \fBdb\fR format,
-# is used for fast searching by the mail system. Execute the command
-# \fBpostmap /etc/postfix/etrn\fR in order to rebuild the indexed
-# file after changing the etrn table.
-#
-# When the table is provided via other means such as NIS, LDAP,
-# SQL, or as regular expressions, the same lookups are done as
-# for ordinary indexed files.
-# TABLE FORMAT
-# .ad
-# .fi
-# The format of the \fBetrn\fR table is as follows:
-# .IP "blanks and comments"
-# Blank lines are ignored, as are lines beginning with `#'.
-# .IP "\fIdomain restrictions\fR"
-# The left-hand side, \fIdomain\fR, specifies a destination domain
-# name that can be specified in \fBETRN\fR commands.
-# .sp
-# The right-hand side specifies one or more access restrictions.
-# Restrictions are processed in the given order and the search
-# stops at the first match.
-# .RS
-# .IP \fBreject_unknown_client\fR
-# Reject the request if the client hostname is unknown.
-# .IP \fBpermit_mynetworks\fR
-# Permit the request if the client address matches $mynetworks.
-# .IP \fBreject_maps_rbl\fR
-# Reject the request if the reverse client network address
-# is listed under $maps_rbl_domains.
-# .IP \fBreject\fR
-# Reject the request. Place this at the end of a restriction list.
-# .IP \fBpermit\fR
-# Permit the request. Place this at the end of a restriction list.
-# .RE
-# .PP
-# CONFIGURATION PARAMETERS
-# .ad
-# .fi
-# The following \fBmain.cf\fR parameters are especially relevant to
-# this topic. See the Postfix \fBmain.cf\fR file for syntax details
-# and for default values. Use the \fBpostfix reload\fR command after
-# a configuration change.
-# .IP \fBetrn_maps\fR
-# Tables that specify what domains have \fBETRN\fR service. For each
-# table entry, the left-hand side specifies a destination domain name
-# that can be specified in an \fBETRN\fR request, and the right-hand
-# side specifies a list of access restrictions for SMTP clients that
-# issue \fBETRN\fR for the domain.
-# .IP \fBfast_flush_maps\fR
-# The table with names of destinations that this MTA provides the
-# fast flush service for. By default, this is set to $\fBetrn_maps\fR.
-# .IP \fBrelay_domains\fR
-# The list of domains that this MTA is willing to forward mail from
-# or to. This defaults to \fB$mydestination, $fast_flush_maps\fR.
-# SEE ALSO
-# smtpd(8) Postfix SMTP server
-# flushd(1) Postfix fast flush service
-# sendmail(5) sendmail-compatible interface
-# pcre_table(5) format of PCRE tables
-# regexp_table(5) format of POSIX regular expression tables
-# LICENSE
-# .ad
-# .fi
-# The Secure Mailer license must be distributed with this software.
-# AUTHOR(S)
-# Wietse Venema
-# IBM T.J. Watson Research
-# P.O. Box 704
-# Yorktown Heights, NY 10598, USA
-#--
-
-# By default, this file is not used. See sample-smtpd.cf
/*
/* This server implements the following requests:
/* .IP "\fBFLUSH_REQ_ADD\fI sitename queue_id\fR"
-/* Append \fIqueue_id\fR to the fast flush logfile for the
+/* Append \fIqueue_id\fR to the fast flush log for the
/* specified site.
/* .IP "\fBFLUSH_REQ_SEND\fI sitename\fR"
/* Arrange for the delivery of all messages that are listed in the fast
/* The flush server rejected the request (bad request name, bad
/* request parameter value).
/* .IP \fBFLUSH_STAT_UNKNOWN\fR
-/* The specified site has no fast flush logfile and is not configured
-/* to have one.
+/* The specified site has no fast flush log.
/* .PP
/* Fast flush logfiles are truncated only after a flush request. In
-/* order to prevent fast flush logfiles from growing without bounds,
-/* and to prevent them from accumulating too much outdated information,
-/* the flush service generates a pro-active flush request once every
+/* order to prevent fast flush logs from growing too large, and to
+/* prevent them from accumulating too much outdated information, the
+/* flush service generates a pro-active flush request once every
/* every 1000 append requests. This should not impact operation.
/* SECURITY
/* .ad
/* The fast flush server is moderately security-sensitive. It does not
/* talk to the network, but it does talk to local unprivileged users, in
/* order to emulate "sendmail -qRsite" behavior. For this reason all
-/* strings in a request are truncated at \fIline_length_limit\fR.
+/* strings in a request are truncated at \fIline_length_limit\fR,
+/* before they are subjected to further validation.
/*
/* The fast flush server can run chrooted at fixed low privilege.
/* DIAGNOSTICS
/* this program. See the Postfix \fBmain.cf\fR file for syntax details
/* and for default values. Use the \fBpostfix reload\fR command after
/* a configuration change.
-/* .IP \fBetrn_maps\fR
-/* Tables that specify what domains have \fBETRN\fR service. For each
-/* table entry, the left-hand side specifies a destination domain name
-/* that can be specified in an \fBETRN\fR request, and the right-hand
-/* side specifies a list of access restrictions for SMTP clients that
-/* issue \fBETRN\fR for the domain.
-/* .IP \fBfast_flush_maps\fR
-/* The table with names of destinations that this MTA provides the
-/* fast flush service for. By default, this is set to $\fBetrn_maps\fR.
/* .IP \fBline_length_limit\fR
/* Maximal length of strings in a fast flush client request.
/* SEE ALSO
#include <mail_server.h>
- /*
- * Tunable parameters.
- */
-char *var_etrn_maps;
-char *var_fflush_maps;
-
/* Application-specific. */
#define STR(x) vstring_str(x)
-#define MAX_DUP_FILTER 10000
-
-static MAPS *fflush_maps;
+#define FLUSHD_DUP_FILTER_SIZE 10000 /* graceful degradation */
+#define FLUSHD_COMMAND_TIMEOUT 60 /* don't get stuck */
+#define FLUSHD_CHECK_RATE 1000 /* don't accumulate cruft */
-/* flush_append - append queue ID to per-site fast flush logfile */
+/* flush_append - append queue ID to per-site fast flush log */
static int flush_append(const char *site, const char *queue_id)
{
msg_info("%s: site %s queue_id %s", myname, site, queue_id);
/*
- * Open or create the logfile. We allow for the fact that a logfile
- * exists for a site that is no longer listed in the fast flush maps.
+ * Open the logfile.
*/
if ((log = mail_queue_open(MAIL_QUEUE_FLUSH, site, O_APPEND | O_WRONLY, 0600)) == 0) {
if (errno != ENOENT)
msg_fatal("%s: open fast flush log for site %s: %m", myname, site);
- if (maps_find(fflush_maps, site, 0) == 0) {
- msg_warn("no fast flush support configured for site %s", site);
- return (FLUSH_STAT_UNKNOWN);
- }
- log = mail_queue_open(MAIL_QUEUE_FLUSH, site, O_CREAT | O_APPEND | O_WRONLY, 0600);
- if (log == 0)
- msg_fatal("%s: open fast flush log for site %s: %m", myname, site);
+ return (FLUSH_STAT_UNKNOWN);
}
/*
* Clean up.
*/
if (myflock(vstream_fileno(log), MYFLOCK_NONE) < 0)
- msg_fatal("%s: unlock fast flush logfile for site %s: %m",
+ msg_fatal("%s: unlock fast flush log for site %s: %m",
myname, site);
if (vstream_fclose(log) != 0)
- msg_warn("write fast flush logfile for site %s: %m", site);
+ msg_warn("write fast flush log for site %s: %m", site);
return (FLUSH_STAT_OK);
}
if ((log = mail_queue_open(MAIL_QUEUE_FLUSH, site, O_RDWR, 0600)) == 0) {
if (errno != ENOENT)
msg_fatal("%s: open fast flush log for site %s: %m", myname, site);
- if (maps_find(fflush_maps, site, 0)) {
- msg_warn("no fast flush log for site %s", site);
- return (FLUSH_STAT_OK);
- } else {
- msg_warn("no fast flush support configured for site %s", site);
- return (FLUSH_STAT_UNKNOWN);
- }
+ return (FLUSH_STAT_UNKNOWN);
}
/*
dup_filter = htable_create(10);
tbuf.actime = tbuf.modtime = event_time();
while (vstring_get_nonl(queue_id, log) != VSTREAM_EOF) {
- if (dup_filter->used >= MAX_DUP_FILTER
+ if (!mail_queue_id_ok(STR(queue_id))) {
+ msg_warn("bad queue id %.30s... in fast flush log for site %s",
+ STR(queue_id), site);
+ continue;
+ }
+ if (dup_filter->used >= FLUSHD_DUP_FILTER_SIZE
|| htable_find(dup_filter, STR(queue_id)) == 0) {
if (msg_verbose)
msg_info("%s: site %s: update %s time stamps",
myname, site, STR(queue_file));
- if (dup_filter->used <= MAX_DUP_FILTER)
+ if (dup_filter->used <= FLUSHD_DUP_FILTER_SIZE)
htable_enter(dup_filter, STR(queue_id), 0);
mail_queue_path(queue_file, MAIL_QUEUE_DEFERRED, STR(queue_id));
vstring_free(queue_id);
/*
- * Truncate the fast flush logfile.
+ * Truncate the fast flush log.
*/
if (ftruncate(vstream_fileno(log), (off_t) 0) < 0)
- msg_fatal("%s: truncate fast flush logfile for site %s: %m",
+ msg_fatal("%s: truncate fast flush log for site %s: %m",
myname, site);
/*
* Request delivery and clean up.
*/
if (myflock(vstream_fileno(log), MYFLOCK_NONE) < 0)
- msg_fatal("%s: unlock fast flush logfile for site %s: %m",
+ msg_fatal("%s: unlock fast flush log for site %s: %m",
myname, site);
if (vstream_fclose(log) != 0)
- msg_warn("read fast flush logfile for site %s: %m", site);
+ msg_warn("read fast flush log for site %s: %m", site);
if (msg_verbose)
msg_info("%s: requesting delivery for site %s", myname, site);
mail_trigger(MAIL_CLASS_PUBLIC, MAIL_SERVICE_QUEUE,
/*
* Vandalism control. Read no unlimited amounts of garbage from a public
- * socket.
+ * socket. Of course we also have to make sure the content is sane.
*/
vstring_ctl(request, VSTRING_CTL_MAXLEN, var_line_limit, VSTRING_CTL_END);
vstring_ctl(site, VSTRING_CTL_MAXLEN, var_line_limit, VSTRING_CTL_END);
-
+ vstream_control(client_stream, VSTREAM_CTL_TIMEOUT, FLUSHD_COMMAND_TIMEOUT,
+ VSTREAM_CTL_END);
/*
* This routine runs whenever a client connects to the UNIX-domain socket
* dedicated to the fast flush service. What we see below is a little
queue_id = vstring_alloc(10);
vstring_ctl(queue_id, VSTRING_CTL_MAXLEN, var_line_limit,
VSTRING_CTL_END);
- if (mail_scan(client_stream, "%s", queue_id) == 1)
+ if (mail_scan(client_stream, "%s", queue_id) == 1
+ && mail_queue_id_ok(STR(queue_id)))
status = flush_append(STR(site), STR(queue_id));
vstring_free(queue_id);
} else if (STREQ(STR(request), FLUSH_REQ_SEND)) {
* so that it does not have to wait while the pro-active flush happens.
*/
if (status == FLUSH_STAT_OK && STREQ(STR(request), FLUSH_REQ_ADD)
- && (++counter + event_time() + getpid()) % 1000 == 0) {
+ && (++counter + event_time() + getpid()) % FLUSHD_CHECK_RATE == 0) {
vstream_fflush(client_stream);
if (msg_verbose)
msg_info("site %s: time for a pro-active flush", STR(site));
vstring_free(request);
}
-/* pre_accept - see if tables have changed */
-
-static void pre_accept(char *unused_name, char **unused_argv)
-{
- if (dict_changed()) {
- msg_info("table has changed -- exiting");
- exit(0);
- }
-}
-
-/* pre_jail_init - pre-chroot initialization */
-
-static void pre_jail_init(char *unused_service, char **unused_argv)
-{
- fflush_maps = maps_create(VAR_FFLUSH_MAPS, var_fflush_maps,
- DICT_FLAG_LOCK);
-}
-
-/* pre_accept_init - check map status */
-
-
/* main - pass control to the single-threaded skeleton */
int main(int argc, char **argv)
{
- static CONFIG_STR_TABLE str_table[] = {
- VAR_ETRN_MAPS, DEF_ETRN_MAPS, &var_etrn_maps, 0, 0,
- VAR_FFLUSH_MAPS, DEF_FFLUSH_MAPS, &var_fflush_maps, 0, 0,
- 0,
- };
-
- single_server_main(argc, argv, flush_service,
- MAIL_SERVER_PRE_INIT, pre_jail_init,
- MAIL_SERVER_PRE_ACCEPT, pre_accept,
- MAIL_SERVER_STR_TABLE, str_table,
- 0);
+ single_server_main(argc, argv, flush_service, 0);
}
/* closes the queue file,
/* and destroys the DELIVER_REQUEST structure. The result is
/* non-zero when the status could not be reported to the client.
+/*
+/* When the fast flush cache is enabled, the fast flush server is
+/* notified of deferred mail.
/* DIAGNOSTICS
/* Warnings: bad data sent by the client. Fatal errors: out of
/* memory, queue file open errors.
#include "mail_open_ok.h"
#include "recipient_list.h"
#include "deliver_request.h"
+#include "mail_flush.h"
+#include "mail_params.h"
/* deliver_request_initial - send initial status code */
{
int err;
+ /*
+ * Optionally add this message to the fast flush log for this site.
+ */
err = deliver_request_final(stream, request->hop_status, status);
+ if (var_enable_fflush)
+ mail_flush_append(request->nexthop, request->queue_id);
deliver_request_free(request);
return (err);
}
/* const char *site;
/* const char *queue_id;
/* DESCRIPTION
-/* This module deals with delivery of backed up mail.
+/* This module deals with delivery of delayed mail.
/*
/* mail_flush_deferred() triggers delivery of all deferred
/* or incoming mail.
/*
-/* mail_flush_site() uses the "fash flush" service to trigger
+/* The following services are available only for sites have a
+/* "fast flush" logfile. These files list all mail that is queued
+/* for a given site, and are created on demand when, for example,
+/* an eligible SMTP client issues the ETRN command.
+/*
+/* mail_flush_site() uses the "fast flush" service to trigger
/* delivery of messages queued for the specified site.
-/* This service is available only for sites that are configured
-/* to have a deferred mail logfile.
/*
-/* mail_flush_append() appends a record to the "fash flush"
+/* mail_flush_append() appends a record to the "fast flush"
/* logfile of the specified site, with the queue ID of mail
/* that should still be delivered.
/* DIAGNOSTICS
/* The request completed normally.
/* .IP MAIL_FLUSH_FAIL
/* The request failed.
-/* .IP "MAIL_FLUSH_UNKNOWN (mail_flush_site() only)"
-/* The specified site is not configured for the fast flush service.
-/* .IP "MAIL_FLUSH_BAD (mail_flush_site() only)"
-/* The fast flush server rejected the request.
+/* .IP MAIL_FLUSH_UNKNOWN
+/* The specified site has no "fast flush" logfile.
+/* .IP MAIL_FLUSH_BAD
+/* The "fast flush" server rejected the request (invalid request
+/* parameter).
/* LICENSE
/* .ad
/* .fi
/* mail_flush_clnt - generic fast flush service client */
-static int mail_flush_clnt(const char *format, ...)
+static int mail_flush_clnt(const char *format,...)
{
VSTREAM *flush;
int status;
/* LICENSE
+/* .ad
/* .fi
/* The Secure Mailer license must be distributed with this software.
/* AUTHOR(S)
/* P.O. Box 704
/* Yorktown Heights, NY 10598, USA
/*--*/
-/**INDENT** Error@33: Unmatched #endif */
#endif
/* int var_ownreq_special;
/* int var_daemon_timeout;
/* char *var_syslog_facility;
+/* int var_enable_fflush;
/*
/* void mail_params_init()
/* DESCRIPTION
int var_ownreq_special;
int var_daemon_timeout;
char *var_syslog_facility;
+int var_enable_fflush;
/* check_myhostname - lookup hostname and validate */
VAR_SOFT_BOUNCE, DEF_SOFT_BOUNCE, &var_soft_bounce,
VAR_OWNREQ_SPECIAL, DEF_OWNREQ_SPECIAL, &var_ownreq_special,
VAR_MAILTOOL_COMPAT, DEF_MAILTOOL_COMPAT, &var_mailtool_compat,
+ VAR_ENABLE_FFLUSH, DEF_ENABLE_FFLUSH, &var_enable_fflush,
0,
};
* Queue manager: various in-core message and recipient limits.
*/
#define VAR_QMGR_ACT_LIMIT "qmgr_message_active_limit"
-#define DEF_QMGR_ACT_LIMIT 1000
+#define DEF_QMGR_ACT_LIMIT 10000
extern int var_qmgr_active_limit;
#define VAR_QMGR_RCPT_LIMIT "qmgr_message_recipient_limit"
* subdirectories, and how deep the forest is.
*/
#define VAR_HASH_QUEUE_NAMES "hash_queue_names"
-#define DEF_HASH_QUEUE_NAMES "defer,flush"
+#define DEF_HASH_QUEUE_NAMES "active,bounce,defer,flush"
extern char *var_hash_queue_names;
#define VAR_HASH_QUEUE_DEPTH "hash_queue_depth"
extern char *var_mynetworks;
#define VAR_RELAY_DOMAINS "relay_domains"
-#define DEF_RELAY_DOMAINS "$mydestination $fast_flush_maps"
+#define DEF_RELAY_DOMAINS "$mydestination"
extern char *var_relay_domains;
#define VAR_CLIENT_CHECKS "smtpd_client_restrictions"
extern char *var_filter_xport;
/*
- * ETRN and fast flush support.
- */
-#define VAR_ETRN_MAPS "etrn_maps"
-#define DEF_ETRN_MAPS ""
-extern char *var_etrn_maps;
-
-#define VAR_FFLUSH_MAPS "fast_flush_maps"
-#define DEF_FFLUSH_MAPS "$etrn_maps"
-extern char *var_fflush_maps;
+Fast flush service support. */
+#define VAR_ENABLE_FFLUSH "enable_fast_flush"
+#define DEF_ENABLE_FFLUSH 0
+extern bool var_enable_fflush;
/* LICENSE
/* .ad
for (cp = queue_name; *cp; cp++)
if (!ISALNUM(*cp))
return (0);
+ if (strlen(queue_name) > 100)
+ return (0);
return (1);
}
{
const char *cp;
+ if (strlen(queue_id) > 100)
+ return (0);
+
/*
* Must be in valid hostname form.
*/
* Version of this program.
*/
#define VAR_MAIL_VERSION "mail_version"
-#define DEF_MAIL_VERSION "Snapshot-20000928"
+#define DEF_MAIL_VERSION "Snapshot-20000929"
extern char *var_mail_version;
/* LICENSE
char *var_virtual_maps;
char *var_defer_xports;
bool var_allow_min_user;
-char *var_fflush_maps;
static QMGR_SCAN *qmgr_incoming;
static QMGR_SCAN *qmgr_deferred;
MAPS *qmgr_relocated;
MAPS *qmgr_virtual;
-MAPS *qmgr_fflush;
/* qmgr_deferred_run_event - queue manager heartbeat */
if (*var_virtual_maps)
qmgr_virtual = maps_create("virtual", var_virtual_maps,
DICT_FLAG_LOCK);
- if (*var_fflush_maps)
- qmgr_fflush = maps_create(VAR_FFLUSH_MAPS, var_fflush_maps,
- DICT_FLAG_LOCK);
}
/* qmgr_post_init - post-jail initialization */
VAR_RELOCATED_MAPS, DEF_RELOCATED_MAPS, &var_relocated_maps, 0, 0,
VAR_VIRTUAL_MAPS, DEF_VIRTUAL_MAPS, &var_virtual_maps, 0, 0,
VAR_DEFER_XPORTS, DEF_DEFER_XPORTS, &var_defer_xports, 0, 0,
- VAR_FFLUSH_MAPS, DEF_FFLUSH_MAPS, &var_fflush_maps, 0, 0,
0,
};
static CONFIG_INT_TABLE int_table[] = {
extern int qmgr_recipient_count;
extern MAPS *qmgr_relocated;
extern MAPS *qmgr_virtual;
-extern MAPS *qmgr_fflush;
extern void qmgr_message_free(QMGR_MESSAGE *);
extern void qmgr_message_update_warn(QMGR_MESSAGE *);
/* Global library. */
#include <defer.h>
+#include <mail_params.h>
+#include <mail_flush.h>
/* Application-specific. */
recipient = entry->rcpt_list.info + nrcpt;
qmgr_defer_recipient(message, recipient->address, reason);
}
+ if (var_enable_fflush)
+ mail_flush_append(queue->name, message->queue_id);
qmgr_entry_done(entry, QMGR_QUEUE_TODO);
}
}
if (queue->window == 0)
qmgr_defer_todo(queue, queue->reason);
}
-
- /*
- * Optionally add this message to the fast flush log for this site.
- */
- if (qmgr_fflush && maps_find(qmgr_fflush, queue->name, 0))
- mail_flush_append(queue->name, message->queue_id);
}
/*
*/
while ((queue_name = *queues++) != 0) {
+ if (msg_verbose)
+ msg_info("queue: %s", queue_name);
+
/*
* Look up queue-specific properties: desired hashing depth, what
* file permissions to look for, and whether or not it is desirable
MAIL_QUEUE_DEFERRED,
MAIL_QUEUE_DEFER,
MAIL_QUEUE_BOUNCE,
+ MAIL_QUEUE_FLUSH,
0,
};
qmgr_deliver.o: ../../include/recipient_list.h
qmgr_deliver.o: ../../include/mail_params.h
qmgr_deliver.o: ../../include/deliver_request.h
-qmgr_deliver.o: ../../include/mail_flush.h
qmgr_deliver.o: qmgr.h
qmgr_deliver.o: ../../include/scan_dir.h
qmgr_deliver.o: ../../include/maps.h
int var_qmgr_fudge;
int var_qmgr_hog;
int var_local_rcpt_lim; /* XXX */
-char *var_fflush_maps;
static QMGR_SCAN *qmgr_incoming;
static QMGR_SCAN *qmgr_deferred;
MAPS *qmgr_relocated;
MAPS *qmgr_virtual;
-MAPS *qmgr_fflush;
/* qmgr_deferred_run_event - queue manager heartbeat */
if (*var_virtual_maps)
qmgr_virtual = maps_create("virtual", var_virtual_maps,
DICT_FLAG_LOCK);
- if (*var_fflush_maps)
- qmgr_fflush = maps_create(VAR_FFLUSH_MAPS, var_fflush_maps,
- DICT_FLAG_LOCK);
}
/* qmgr_post_init - post-jail initialization */
VAR_RELOCATED_MAPS, DEF_RELOCATED_MAPS, &var_relocated_maps, 0, 0,
VAR_VIRTUAL_MAPS, DEF_VIRTUAL_MAPS, &var_virtual_maps, 0, 0,
VAR_DEFER_XPORTS, DEF_DEFER_XPORTS, &var_defer_xports, 0, 0,
- VAR_FFLUSH_MAPS, DEF_FFLUSH_MAPS, &var_fflush_maps, 0, 0,
0,
};
static CONFIG_INT_TABLE int_table[] = {
extern int qmgr_recipient_count;
extern MAPS *qmgr_relocated;
extern MAPS *qmgr_virtual;
-extern MAPS *qmgr_fflush;
extern void qmgr_message_free(QMGR_MESSAGE *);
extern void qmgr_message_update_warn(QMGR_MESSAGE *);
/* Global library. */
#include <defer.h>
+#include <mail_params.h>
+#include <mail_flush.h>
/* Application-specific. */
recipient = entry->rcpt_list.info + nrcpt;
qmgr_defer_recipient(message, recipient->address, reason);
}
+ if (var_enable_fflush)
+ mail_flush_append(queue->name, message->queue_id);
qmgr_entry_done(entry, QMGR_QUEUE_TODO);
}
}
#include <recipient_list.h>
#include <mail_params.h>
#include <deliver_request.h>
-#include <mail_flush.h>
/* Application-specific. */
if (queue->window == 0)
qmgr_defer_todo(queue, queue->reason);
}
-
- /*
- * Optionally add this message to the fast flush log for this site.
- */
- if (qmgr_fflush && maps_find(qmgr_fflush, queue->name, 0))
- mail_flush_append(queue->name, message->queue_id);
}
/*
} else if (dict_errno != 0) {
qmgr_defer_recipient(message, recipient->address,
"relocated map lookup failure");
+XXX mail_flush_append
continue;
}
}
if (*cpp) {
qmgr_defer_recipient(message, recipient->address,
"deferred transport");
+XXX mail_flush_append
continue;
}
}
*/
if ((transport->flags & QMGR_TRANSPORT_STAT_DEAD) != 0) {
qmgr_defer_recipient(message, recipient->address, transport->reason);
+XXX mail_flush_append
continue;
}
*/
if (queue->window == 0) {
qmgr_defer_recipient(message, recipient->address, queue->reason);
+XXX mail_flush_append
continue;
}
qmgr_message_count : var_qmgr_active_limit)) {
qmgr_defer_recipient(message, recipient->address,
"site destination queue overflow");
+XXX mail_flush_append
continue;
}
}
/* .IP \fB-qR\fIsite\fR
/* Schedule immediate delivery of all mail that is queued for the named
/* \fIsite\fR.
-/* This functionality is available only for sites that are configured
-/* for the \fBfast flush\fR service support as described in
-/* \fBflushd\fR(8). For other sites, use the slower \fBsendmail -q\fR
-/* command instead.
+/* This functionality is available only for sites that have a so-called
+/* \fBfast flush\fR logfile as described in \fBflushd\fR(8). For other
+/* sites, use the slower \fBsendmail -q\fR command instead.
/* .IP \fB-qS\fIsite\fR
/* This command is not implemented. Use the slower \fBsendmail -q\fR
/* command instead.
/* List of domain or network patterns. When a remote host matches
/* a pattern, increase the verbose logging level by the amount
/* specified in the \fBdebug_peer_level\fR parameter.
-/* .IP \fBetrn_maps\fR
-/* Tables that specify what domains have \fBETRN\fR service. For each
-/* table entry, the left-hand side specifies a destination domain name
-/* that can be specified in an \fBETRN\fR request, and the right-hand
-/* side specifies a list of access restrictions for SMTP clients that
-/* issue \fBETRN\fR for the domain.
-/* .IP \fBfast_flush_maps\fR
-/* The table with names of destinations that this MTA provides the
-/* fast flush service for. By default, this is set to $\fBetrn_maps\fR.
/* .IP \fBfork_attempts\fR
/* Number of attempts to \fBfork\fR() a process before giving up.
/* .IP \fBfork_delay\fR
#include <tok822.h>
#include <mail_flush.h>
#include <mail_stream.h>
-#include <sys_exits.h>
/* Application-specific. */
case FLUSH_STAT_OK:
break;
case FLUSH_STAT_UNKNOWN:
- msg_fatal("No \"sendmail -qR\" support is configured for %s", site);
+ msg_fatal("No \"sendmail -qR\" support available for %s - use \"sendmail -q\" instead", site);
break;
case FLUSH_STAT_BAD:
msg_fatal("invalid request: %s", site);
/* system is not running.
/*
/* The SMTP server implements a variety of policies for connection
-/* requests, and for parameters given to \fBHELO, ETRN, MAIL FROM, VRFY\fR,
+/* requests, and for parameters given to \fBHELO, ETRN, MAIL FROM, VRFY\fR
/* and \fBRCPT TO\fR commands. They are detailed below and in the
/* \fBmain.cf\fR configuration file.
/* SECURITY
/* List of domain or network patterns. When a remote host matches
/* a pattern, increase the verbose logging level by the amount
/* specified in the \fBdebug_peer_level\fR parameter.
+/* .IP \fBenable_fast_flush\fR
+/* Enable the "fast flush" cache for improved ETRN performance.
+/* By default, Postfix attempts to deliver all messages in the queue
+/* after receiving an ETRN command.
+/* The "fast flush" cache keeps a record of what mail is queued up for
+/* specific destinations.
+/* Currently, "fast flush" support is available only for destinations
+/* that the local MTA is willing to relay mail to (i.e. the policy
+/* is hard coded).
/* .IP \fBerror_notice_recipient\fR
/* Recipient of protocol/policy/resource/software error notices.
-/* .IP \fBetrn_maps\fR
-/* Tables that specify what domains have \fBETRN\fR service. For
-/* each table entry, the left-hand side specifies a destination
-/* domain name that can be specified in an \fBETRN\fR request, and
-/* the right-hand side specifies a list of access restrictions for
-/* clients that issue \fBETRN\fR for the domain.
/* .IP \fBhopcount_limit\fR
/* Limit the number of \fBReceived:\fR message headers.
/* .IP \fBlocal_recipient_maps\fR
/* Limit the number of times a client can issue a junk command
/* such as NOOP, VRFY, ETRN or RSET in one SMTP session before
/* it is penalized with tarpit delays.
+/* .SH "ETRN service"
+/* .ad
+/* .fi
+/* .IP \fBsmtpd_etrn_restrictions\fR
+/* Restrict what domain names can be used in \fBETRN\fR commands,
+/* and what clients may issue \fBETRN\fR commands. The restrictions
+/* are like the UCE restrictions below. Fast \fBETRN\fR service is
+/* limited to destinations that list this MTA as mail exchanger.
/* .SH "UCE control restrictions"
/* .ad
/* .fi
char *var_smtpd_sasl_opts;
char *var_smtpd_sasl_realm;
char *var_filter_xport;
-char *var_fflush_maps;
/*
* Global state, for stand-alone mode queue file cleanup. When this is
*/
if (msg_verbose)
msg_info("%s: input: %s", myname, STR(arg->vstrval));
-
- /*
- * Workaround: Sendmail allows arbitrary nesting of <>, so that overpaid
- * peecee programmers can get away with monstrosities such as <the dude
- * <dude@site>>. By peeling off the outermost <> we can deal with the
- * most common problem instance. Don't destroy the input so that we can
- * provide accurate diagnostics.
- */
- if (arg->strval[0] == '<' && vstring_end(arg->vstrval)[-1] == '>') {
- vstring_end(arg->vstrval)[-1] = 0;
- tree = tok822_parse(STR(arg->vstrval) + 1);
- vstring_end(arg->vstrval)[-1] = '>';
- } else {
- tree = tok822_parse(STR(arg->vstrval));
- }
+ tree = tok822_parse(STR(arg->vstrval));
/*
* Find trouble.
static int etrn_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv)
{
+ VSTREAM *fp;
char *err;
/*
smtpd_chat_reply(state, "501 Error: invalid parameter syntax");
return (-1);
}
+ if (SMTPD_STAND_ALONE(state)) {
+ smtpd_chat_reply(state, "458 Unable to queue messages");
+ return (-1);
+ }
/*
* XXX The implementation borrows heavily from the code that implements
* rejected. RFC 1985 requires that 459 be sent when the server refuses
* to perform the request.
*/
- if (SMTPD_STAND_ALONE(state) == 0
- && (err = smtpd_check_etrn(state, argv[1].strval)) != 0) {
+ if ((err = smtpd_check_etrn(state, argv[1].strval)) != 0) {
smtpd_chat_reply(state, "%s", err);
return (-1);
}
+ if (!var_enable_fflush) {
+ mail_flush_deferred();
+ smtpd_chat_reply(state, "250 Queuing started");
+ return (0);
+ }
/*
- * XXX The preliminary implementation causes a full deferred queue scan.
+ * Create a fast ETRN cache file on the fly for an eligible site.
*/
- if (mail_flush_site(argv[1].strval) != 0)
- smtpd_chat_reply(state, "458 Unable to queue messages");
- else
+ switch (mail_flush_site(argv[1].strval)) {
+ case FLUSH_STAT_UNKNOWN:
+ if (smtpd_check_etrn_cache_policy_ok(state, argv[1].strval)) {
+ if ((fp = mail_queue_open(MAIL_QUEUE_FLUSH, argv[1].strval,
+ O_CREAT | O_APPEND | O_WRONLY, 0600)) == 0) {
+ msg_warn("create fast ETRN cache for %s: %m", argv[1].strval);
+ } else {
+ vstream_fclose(fp);
+ msg_info("created fast ETRN cache for %s (client=%s)",
+ argv[1].strval, state->namaddr);
+ }
+ } else {
+ msg_info("refused fast ETRN service for %s (client=%s)",
+ argv[1].strval, state->namaddr);
+ }
+ /* Fallthrough. */
+ case FLUSH_STAT_FAIL:
+ mail_flush_deferred();
+ /* Fallthrough. */
+ case FLUSH_STAT_OK:
smtpd_chat_reply(state, "250 Queuing started");
- return (0);
+ return (0);
+ default:
+ smtpd_chat_reply(state, "458 Unable to queue messages");
+ msg_warn("bad ETRN destination %.100s... from %s",
+ argv[1].strval, state->namaddr);
+ return (-1);
+ }
}
/* quit_cmd - process QUIT command */
VAR_SMTPD_SASL_OPTS, DEF_SMTPD_SASL_OPTS, &var_smtpd_sasl_opts, 0, 0,
VAR_SMTPD_SASL_REALM, DEF_SMTPD_SASL_REALM, &var_smtpd_sasl_realm, 1, 0,
VAR_FILTER_XPORT, DEF_FILTER_XPORT, &var_filter_xport, 0, 0,
- VAR_FFLUSH_MAPS, DEF_FFLUSH_MAPS, &var_fflush_maps, 0, 0,
0,
};
/* SMTPD_STATE *state;
/* char *recipient;
/*
-/* char *smtpd_check_etrn(state, recipient)
+/* char *smtpd_check_etrn(state, destination)
/* SMTPD_STATE *state;
-/* char *recipient;
+/* char *destination;
+/*
+/* int smtpd_check_etrn_cache_policy_ok(state, destination)
+/* SMTPD_STATE *state;
+/* char *destination;
/* DESCRIPTION
/* This module implements additional checks on SMTP client requests.
/* A client request is validated in the context of the session state.
/* .IP "check_recipient_access maptype:mapname"
/* Look up the resolved recipient address in the named access table,
/* any parent domains of the recipient domain, and the localpart@.
-/* .IP "check_etrn_access maptype:mapname"
-/* Look up the client hostname or IP address in the named access table.
-/* This table is used for ETRN command access control only.
/* .IP reject_maps_rbl
/* Look up the reversed client network address in the real-time blackhole
/* DNS zones below the domains listed in the "maps_rbl_domains"
/* smtpd_check_etrn() validates the domain name provided with the
/* ETRN command, and other client-provided information. Relevant
/* configuration parameters:
+/* .IP smtpd_etrn_restrictions
+/* Restrictions on the hostname that is sent with the HELO/EHLO
+/* command.
/* .PP
+/* smtpd_check_etrn_cache_policy_ok() returns "true" if it is OK to
+/* create a fast ETRN cache file for the specified destination.
+/* Currently, the hard-coded policy is that the local MTA must be
+/* is willing to relay mail to that destination.
+/*
/* smtpd_check_size() checks if a message with the given size can
/* be received (zero means that the message size is unknown). The
/* message is rejected when:
static MAPS *canonical_maps;
static MAPS *virtual_maps;
static MAPS *relocated_maps;
-static MAPS *fflush_maps;
/*
* Pre-opened access control lists.
static ARGV *helo_restrctions;
static ARGV *mail_restrctions;
static ARGV *rcpt_restrctions;
+static ARGV *etrn_restrctions;
static HTABLE *smtpd_rest_classes;
DICT_FLAG_LOCK);
relocated_maps = maps_create(VAR_RELOCATED_MAPS, var_relocated_maps,
DICT_FLAG_LOCK);
- fflush_maps = maps_create(VAR_FFLUSH_MAPS, var_fflush_maps,
- DICT_FLAG_LOCK);
/*
* Reply is used as a cache for resolved addresses, and error_text is
helo_restrctions = smtpd_check_parse(var_helo_checks);
mail_restrctions = smtpd_check_parse(var_mail_checks);
rcpt_restrctions = smtpd_check_parse(var_rcpt_checks);
+ etrn_restrctions = smtpd_check_parse(var_etrn_checks);
/*
* Parse the pre-defined restriction classes.
msg_info("%s: host %s", myname, host);
/*
- * If we can't lookup the host, play safe and assume it is OK.
+ * If we can't lookup the host, say we're not listed.
*/
#define YUP 1
#define NOPE 0
if ((hp = gethostbyname(host)) == 0) {
if (msg_verbose)
msg_info("%s: host %s: not found", myname, host);
- return (YUP);
+ return (NOPE);
}
if (hp->h_addrtype != AF_INET || hp->h_length != sizeof(addr)) {
msg_warn("address type %d length %d for %s",
hp->h_addrtype, hp->h_length, host);
- return (YUP);
+ return (NOPE);
}
for (cpp = hp->h_addr_list; *cpp; cpp++) {
memcpy((char *) &addr, *cpp, sizeof(addr));
int status;
char *saved_etrn_name;
char *err;
- const char *pattern;
- ARGV *restrictions;
/*
* Initialize.
SMTPD_CHECK_ETRN_RETURN(err);
/*
- * Apply restrictions in the order as specified. If the domain is not
- * configured for ETRN, reject the request.
+ * Apply restrictions in the order as specified.
*/
- if (*var_fflush_maps == 0
- || (pattern = maps_find(fflush_maps, domain, 0)) == 0) {
- status = smtpd_check_reject(state, MAIL_ERROR_POLICY,
- "458 Unable to start queueing for %s",
- domain);
- } else if (strchr(pattern, ':') != 0) {
- msg_warn("A fast flush map has an entry with lookup table: %s",
- pattern);
- msg_warn("do not specify lookup tables inside fast flush maps");
- msg_warn("define a restriction class and specify its name instead");
- status = SMTPD_CHECK_DUNNO;
- } else {
- restrictions = argv_split(pattern, " \t\r\n");
- state->recursion = 0;
- status = setjmp(smtpd_check_buf);
- if (status == 0)
- status = generic_checks(state, restrictions, domain,
- SMTPD_NAME_ETRN, CHECK_ETRN_ACL);
- argv_free(restrictions);
- }
+ state->recursion = 0;
+ status = setjmp(smtpd_check_buf);
+ if (status == 0 && etrn_restrctions->argc)
+ status = generic_checks(state, etrn_restrctions, domain,
+ SMTPD_NAME_ETRN, CHECK_ETRN_ACL);
+
SMTPD_CHECK_ETRN_RETURN(status == SMTPD_CHECK_REJECT ? STR(error_text) : 0);
}
+/* smtpd_check_etrn_cache_policy_ok - is it OK to create a fast ETRN cache? */
+
+int smtpd_check_etrn_cache_policy_ok(SMTPD_STATE *unused_state, char *domain)
+{
+
+ /*
+ * The domain name must be an authorized relay destination.
+ */
+ if (domain_list_match(relay_domains, domain) == 0)
+ return (0);
+
+ /*
+ * The domain name must exist.
+ */
+ if (dns_lookup_types(domain, 0, (DNS_RR **) 0, (VSTRING *) 0,
+ (VSTRING *) 0, T_A, T_MX, 0) != DNS_OK)
+ return (0);
+
+ /*
+ * Must be OK then.
+ */
+ return (1);
+}
+
/* smtpd_check_rcptmap - permit if recipient address matches lookup table */
char *smtpd_check_rcptmap(SMTPD_STATE *state, char *recipient)
"helo_restrictions", &helo_restrctions,
"sender_restrictions", &mail_restrctions,
"recipient_restrictions", &rcpt_restrctions,
+ "etrn_restrictions", &etrn_restrctions,
0,
};
extern char *smtpd_check_size(SMTPD_STATE *, off_t);
extern char *smtpd_check_rcpt(SMTPD_STATE *, char *);
extern char *smtpd_check_etrn(SMTPD_STATE *, char *);
+extern int smtpd_check_etrn_cache_policy_ok(SMTPD_STATE *, char *);
/* LICENSE
/* .ad