diff --git a/postfix/HISTORY b/postfix/HISTORY
index 8a4f3200f..7d3de16e4 100644
--- a/postfix/HISTORY
+++ b/postfix/HISTORY
@@ -11823,14 +11823,123 @@ Apologies for any names omitted.
bounce/bounce_one_service.c, bounce/bounce_notify_verp.c,
bounce/bounce_warn_service.c, bounce/bounce_trace_service.c.
+ Fudge: when translating recipient DSN codes into sender DSN
+ codes, map sender address problems that have no DSN code
+ to *.1.7 (Bad sender's mailbox address syntax) instead of
+ *.1.0 (Other address status) because that loses the distinction
+ between sender and recipient. File: smtpd/smtpd_dsn_fix.c.
+
+20060113
+
+ Cleanup: preserve upper case information of address localpart
+ or extension when mapping one address to another with
+ non-regexp/pcre tables. Files: global/mail_addr_find.c,
+ global/maps_find.c.
+
+20060115
+
+ Bugfix: don't ignore the per-site policy when SSL library
+ initialization fails. Introduced after adopting the TLS
+ patch. File: smtp/smtp_session.c.
+
+20060117
+
+ Safety: daemon processes that need no privileges now insist
+ that they are configured to run without privileges. Files:
+ master/single_server.c, master/multi_server.c,
+ master/trigger_server.c.
+
+ Cleanup: preserve upper case information of address localpart
+ or extension when mapping addresses via regexp/pcre tables.
+ This requires that Postfix does not case fold the search
+ string when searching regexp or pcre tables, so that $number
+ substitutions produce the expected result.
+
+ In order to get a consistent handling of table operations,
+ the search string case folding logic was moved from the
+ application to the individual lookup table modules; the
+ application specifies its case folding preference when it
+ opens a table, and the table folds the search or update
+ string as needed.
+
+ Files: everything that opens a map or multiple maps (to
+ specify the case folding preference), and everything that
+ contained ad-hoc code to lowercase search strings (which
+ is no longer needed).
+
+ Bugfix: as a side effect of this revision of all code that
+ opens tables, the postmap/postalias -n/-N options are no
+ longer silently ignored when the -q (query) and -d (delete)
+ options are specified. Files: postmap/postmap.c,
+ postalias/postalias.c.
+
+ Cleanup: smtp_sasl_passwd_maps lookup keys are folded to
+ lowercase before searching tables such as btree:, dbm: or
+ hash: that have fixed-case fields. File: smtp/smtp_sasl_glue.c.
+
+ Bugfix: per-sender relayhost maps were not locked for shared
+ access.
+
+20060119
+
+ Cleanup: don't look up parent domain substrings in regexp/pcre
+ like tables while searching a hostname in a domain/namaddr_list.
+ File: util/match_ops.c.
+
+20060120
+
+ Cleanup: multiple boolean variables were replaced by a
+ single TLS enforcement level (none, may, encrypt, verify).
+ With Victor Duchovni. Files: smtp_session.c, smtp_proto.c,
+ smtp.h.
+
+ Cleanup: the SMTP per-site policy table was re-implemented
+ in terms of enforcement levels instead of multiple boolean
+ variables. This greatly simplified the code and led to the
+ elimination of non-intuitive behavior as documented next.
+ With Victor Duchovni. Files: smtp_session.c, smtp.h.
+
+ Bugfix: a per-site MUST_NOPEERMATCH policy could not override
+ a main.cf MUST (with peer match) policy.
+
+ Bugfix: a combined TLS per-site (host, next-hop) policy of
+ (NONE, MAY) would change the strongest main.cf MUST policy
+ into NONE, while it changed all weaker main.cf policies
+ into MAY. The result is now NONE for all main.cf policy
+ settings.
+
+20060123
+
+ Feature: recipient_count attribute in SMTPD policy protocol.
+ This is available only in the DATA and END-OF-MESSAGE stage.
+ Based on code by Guo Black. Files: smtpd_check.c.
+
+ Cleanup: renamed MUMBLE_NUM to MUMBLE_INT to make type
+ discrepancies more explicit.
+
+ Bugfix: change 20051208 broke when a connection could not
+ be established. File: util/auto_clnt.c.
+
Open problems:
+ Centralize main.cf parameter input so that defaults work
+ consistently.
+
+ In second-line servers such as proxymap and trivial-rewrite,
+ set the max_idle time limit to a relatively small value so
+ that processes will refresh more often.
+
+ After the 20051222 ISASCII paranoia, lowercase() lowercases
+ ASCII text only.
+
Privacy: remove local command/pathname details from remote
delivery status reports, and log them via local msg_warn().
Remove defer(8) and trace(8) references and man pages. These
are services not program names.
+ dsb_formal -> dsb_form_all, dsb_status -> dsb_form_status
+
"postsuper -r" no longer resets the message arrival time,
because pickup(8) no longer overrides queue file time stamp
information. This can be a problem when mail "on hold" is
@@ -11849,11 +11958,6 @@ Open problems:
deferred queue scan needs to be done, and have the pickup
server stat() the maildrop directory before searching it.
- Mapping from errno to diagnostic text. Or do we just slap
- an SMTP code in front of what is now reported as X-Postfix.
- Or do we punt the issue and issue X-Postfix for all errors
- except SMTP?
-
Low: replace_sender/replace_recipient actions in access
maps?
@@ -11898,8 +12002,6 @@ Open problems:
Med: the TLS certificate verification depth parameters never
worked.
- Med: eliminate the tls_info data structure.
-
Low: reject HELO with any domain name or IP address that
this MTA is the final destination for.
diff --git a/postfix/README_FILES/CDB_README b/postfix/README_FILES/CDB_README
index 8c32ee4dd..0d00bf59a 100644
--- a/postfix/README_FILES/CDB_README
+++ b/postfix/README_FILES/CDB_README
@@ -33,7 +33,7 @@ Postfix is compatible with two CDB implementations:
Tinycdb is preferred, since it is a bit faster, has additional useful
functionality and is much simpler to use.
-To build Postfix after you have installed CDB, use something like:
+To build Postfix after you have installed tinycdb, use something like:
% make tidy
% CDB=../../../tinycdb-0.5
@@ -41,7 +41,7 @@ To build Postfix after you have installed CDB, use something like:
"AUXLIBS=$CDB/libcdb.a"
% make
- for tinycdb, or alternatively, for the D.J.B. version:
+Alternatively, for the D.J.B. version of CDB:
% make tidy
% CDB=../../../cdb-0.75
diff --git a/postfix/README_FILES/OVERVIEW b/postfix/README_FILES/OVERVIEW
index c9d40269f..1d9ae180f 100644
--- a/postfix/README_FILES/OVERVIEW
+++ b/postfix/README_FILES/OVERVIEW
@@ -210,12 +210,11 @@ queues.
Network -> smtpd(8) <-> anvil(8)
- * The bounce(8) server implements the bounce, defer and trace services, which
- maintain separate directory trees with per-message logfiles. This
- information is used to send delivery or non-delivery notifications to the
- sender.
+ * The bounce(8), defer(8) and trace(8) servers each maintain their own queue
+ directory trees with per-message logfiles. This information is used to send
+ delivery or non-delivery notifications to the sender.
- The trace service implements support for the Postfix "sendmail -bv" and
+ The trace(8) service implements support for the Postfix "sendmail -bv" and
"sendmail -v" commands which produce reports about how Postfix delivers
mail, and is available with Postfix version 2.1 and later. See DEBUG_README
for examples.
@@ -228,8 +227,8 @@ queues.
| v v
(Non-) bounce(8) Queue id,
- delivery <- defer <- recipient,
- notice trace status
+ delivery <- defer(8) <- recipient,
+ notice trace(8) status
^ |
| v
diff --git a/postfix/README_FILES/SMTPD_POLICY_README b/postfix/README_FILES/SMTPD_POLICY_README
index ecaa5151a..e58508cdd 100644
--- a/postfix/README_FILES/SMTPD_POLICY_README
+++ b/postfix/README_FILES/SMTPD_POLICY_README
@@ -47,6 +47,7 @@ a delegated SMTPD access policy request:
queue_id=8045F2AB23
sender=foo@bar.tld
recipient=bar@foo.tld
+ recipient_count=0
client_address=1.2.3.4
client_name=another.domain.tld
reverse_client_name=another.domain.tld
@@ -77,7 +78,16 @@ Notes:
the first value or the last attribute value.
* When an attribute value is unavailable, the client either does not send the
- attribute, or sends the attribute with an empty value ("name=").
+ attribute, sends the attribute with an empty value ("name="), or sends a
+ zero value ("name=0") in the case of a numerical attribute.
+
+ * The "recipient" attribute is available only in the "RCPT TO" stage, and in
+ the "DATA" and "END-OF-MESSAGE" stages when Postfix accepted only one
+ recipient for the current message.
+
+ * The "recipient_count" attribute (Postfix 2.3 and later) is non-zero only in
+ the "DATA" and "END-OF-MESSAGE" stages. It specifies the number of
+ recipients that Postfix accepted for the current message.
* The client address is an IPv4 dotted quad in the form 1.2.3.4 or it is an
IPv6 address in the form 1:2:3::4:5:6.
diff --git a/postfix/README_FILES/TLS_README b/postfix/README_FILES/TLS_README
index 676b4005a..e30f9fbbe 100644
--- a/postfix/README_FILES/TLS_README
+++ b/postfix/README_FILES/TLS_README
@@ -68,6 +68,10 @@ To build Postfix with TLS support, first we need to generate the make(1) files
with the necessary definitions. This is done by invoking the command "make
makefiles" in the Postfix top-level directory and with arguments as shown next.
+NNOOTTEE:: DDoo nnoott uussee GGnnuu TTLLSS.. IItt wwiillll ssppoonnttaanneeoouussllyy tteerrmmiinnaattee aa pprroocceessss wwiitthh eexxiitt
+ssttaattuuss ccooddee 22,, iinnsstteeaadd ooff pprrooppeerrllyy rreeppoorrttiinngg pprroobblleemmss ttoo PPoossttffiixx,, ssoo tthhaatt iitt
+ccaann lloogg tthheemm ttoo tthhee mmaaiilllloogg ffiillee..
+
* If the OpenSSL include files (such as ssl.h) are in directory /usr/include/
openssl, and the OpenSSL libraries (such as libssl.so and libcrypto.so) are
in directory /usr/lib:
@@ -487,7 +491,12 @@ Topics covered in this section:
* Client-side TLS activity logging
* Client-side TLS session cache
* Enabling TLS in the Postfix SMTP client
- * Server certificate verification
+ * Requiring TLS encryption
+ * Disabling server certificate verification
+ * Per-site TLS policies
+ * Closing a DNS loophole with per-site TLS policies
+ * Discovering servers that support TLS
+ * Server certificate verification depth
* Client-side cipher controls
* Miscellaneous client controls
@@ -532,12 +541,12 @@ If you want the Postfix SMTP client to accept remote SMTP server certificates
issued by these CAs, append the root certificate to $smtp_tls_CAfile or install
it in the $smtp_tls_CApath directory. When you configure trust in a root CA, it
is not necessary to explicitly trust intermediary CAs signed by the root CA,
-unless $smtp_tls_verify_depth is less than the number of CAs in the certificate
-chain for the servers of interest. With a verify depth of 1 you can only verify
-certificates directly signed by a trusted CA, and all trusted intermediary CAs
-need to be configured explicitly. With a verify depth of 2 you can verify
-servers signed by a root CA or a direct intermediary CA (so long as the server
-is correctly configured to supply its intermediate CA certificate).
+unless $smtp_tls_scert_verifydepth is less than the number of CAs in the
+certificate chain for the servers of interest. With a verify depth of 1 you can
+only verify certificates directly signed by a trusted CA, and all trusted
+intermediary CAs need to be configured explicitly. With a verify depth of 2 you
+can verify servers signed by a root CA or a direct intermediary CA (so long as
+the server is correctly configured to supply its intermediate CA certificate).
RSA key and certificate examples:
@@ -635,20 +644,19 @@ By default, TLS is disabled in the Postfix SMTP client, so no difference to
plain Postfix is visible. If you enable TLS, the Postfix SMTP client will send
STARTTLS when TLS support is announced by the remote SMTP server.
-WARNING: MS Exchange servers will announce STARTTLS support even when the
-service is not configured, so that the TLS handshake will fail. It may be wise
-to not use this option on your central mail hub, as you don't know in advance
-whether you are going to connect to such a host. Instead, use the
-smtp_tls_per_site recipient/site specific options that are described below.
-
-When the TLS handshake fails and no other server is available, the Postfix SMTP
-client defers the delivery attempt, and the mail stays in the queue.
+When the server accepts the STARTTLS command, but the subsequent TLS handshake
+fails, and no other server is available, the Postfix SMTP client defers the
+delivery attempt, and the mail stays in the queue. After a handshake failure,
+the communications channel is in an indeterminate state and cannot be used for
+non-TLS deliveries.
Example:
/etc/postfix/main.cf:
smtp_use_tls = yes
+RReeqquuiirriinngg TTLLSS eennccrryyppttiioonn
+
You can ENFORCE the use of TLS, so that the Postfix SMTP client will not
deliver mail over unencrypted connections. In this mode, the remote SMTP server
hostname must match the information in the remote server certificate, and the
@@ -657,21 +665,22 @@ client. If the remote server certificate doesn't verify or the remote SMTP
server hostname doesn't match, and no other server is available, the delivery
attempt is deferred and the mail stays in the queue.
-The remote SMTP server hostname used in the check is beyond question, as it
-must be the principal hostname (no CNAME allowed here). Checks are performed
-against all names provided as dNSNames in the SubjectAlternativeName. If no
-dNSNames are specified, the CommonName is checked. The behavior may be changed
-with the smtp_tls_enforce_peername option which is discussed below.
+The remote SMTP server hostname is verified against all names provided as
+dNSNames in the SubjectAlternativeName. If no dNSNames are specified, the
+CommonName is checked. Verification may be turned off with the
+smtp_tls_enforce_peername option which is discussed below.
-This option is useful only if you know that you will only connect to servers
-that support RFC 2487 _and_ that present server certificates that meet the
-above requirements. An example would be a client only sends email to one
+Enforcing the use of TLS is useful if you know that you will only connect to
+servers that support RFC 2487 _and_ that present server certificates that meet
+the above requirements. An example would be a client only sends email to one
specific mailhub that offers the necessary STARTTLS support.
Example:
/etc/postfix/main.cf:
- smtp_enforce_tls = no
+ smtp_enforce_tls = yes
+
+DDiissaabblliinngg sseerrvveerr cceerrttiiffiiccaattee vveerriiffiiccaattiioonn
As of RFC 2487 the requirements for hostname checking for MTA clients are not
set. When TLS is required (smtp_enforce_tls = yes), the option
@@ -679,79 +688,138 @@ smtp_tls_enforce_peername can be set to "no" to disable strict remote SMTP
server hostname checking. In this case, the mail delivery will proceed
regardless of the CommonName etc. listed in the certificate.
-Note: the smtp_tls_enforce_peername setting has no effect on sessions that are
-controlled via the smtp_tls_per_site table.
-
-Disabling the remote SMTP server hostname verification can make sense in closed
-environment where special CAs are created. If not used carefully, this option
-opens the danger of a "man-in-the-middle" attack (the CommonName of this
-possible attacker is logged).
+Despite the potential for eliminating "man-in-the-middle" and other attacks,
+mandatory certificate/peername verification is not viable as a default Internet
+mail delivery policy at this time. A significant fraction of TLS enabled MTAs
+uses self-signed certificates, or certificates that are signed by a private
+certificate authority. On a machine that delivers mail to the Internet, if you
+set smtp_enforce_tls = yes, you should probably also set
+smtp_tls_enforce_peername = no. You can use the per-site TLS policies (see
+below) to enable full peer verification for specific destinations that are
+known to have verifiable TLS server certificates.
Example:
/etc/postfix/main.cf:
- smtp_tls_enforce_peername = yes
+ smtp_enforce_tls = yes
+ smtp_tls_enforce_peername = no
-Generally, trying TLS can be a bad idea, as some servers offer STARTTLS but the
-negotiation will fail leading to unexplainable failures. Instead, it may be a
-good idea to choose the TLS usage policy based on the recipient or the mailhub
-to which you are connecting.
+PPeerr--ssiittee TTLLSS ppoolliicciieess
-Deciding the TLS usage policy per recipient may be difficult, since a single
-email delivery attempt can involve several recipients. Instead, use of TLS is
-controlled by the Postfix next-hop destination domain name and by the remote
-SMTP server hostname. If either of these matches an entry in the
-smtp_tls_per_site table, appropriate action is taken.
+A small fraction of servers offer STARTTLS but the negotiation consistently
+fails, leading to mail aging out of the queue and bouncing back to the sender.
+In such cases, you can use the per-site policies to disable TLS for the problem
+sites. Alternatively, you can enable TLS for just a few specific sites and not
+enable it for all sites.
-The remote SMTP server hostname is simply the DNS name of the server that the
-Postfix SMTP client connects to. The next-hop destination is Postfix specific.
-By default, this is the domain name in the recipient address, but this
-information can be overruled by the transport(5) table or by the relayhost
-parameter setting. In these cases the relayhost etc. must be listed in the
-smtp_tls_per_site table, instead of the recipient domain name.
+The smtp_tls_per_site table is searched for a policy that matches the following
+information:
-Format of the table: domain or host names are specified on the left-hand side;
-no wildcards are allowed. On the right hand side specify one of the following
-keywords:
+ remote SMTP server hostname
+ This is simply the DNS name of the server that the Postfix SMTP client
+ connects to; this name may be obtained from other DNS lookups, such as
+ MX lookups or CNAME lookups.
+ next-hop destination
+ This is normally the domain portion of the recipient address, but it
+ may be overruled by information from the transport(5) table, from the
+ relayhost parameter setting, or from the relay_transport setting. When
+ it's not the recipient domain, the next-hop destination can have the
+ Postfix-specific form "[name]", [name]:port", "name" or "name:port".
+
+When both the hostname lookup and the next-hop lookup succeed, the host policy
+does not automatically override the next-hop policy. Instead, precedence is
+given to either the more specific or the more secure per-site policy as
+described below.
+
+The smtp_tls_per_site table uses a simple "name whitespace value" format.
+Specify host names or next-hop destinations on the left-hand side; no wildcards
+are allowed. On the right hand side specify one of the following keywords:
NONE
- Don't use TLS at all.
+ Don't use TLS at all. This overrides a less specific MMAAYY lookup result
+ from the alternate host or next-hop lookup key, and overrides the
+ global smtp_use_tls, smtp_enforce_tls, and smtp_tls_enforce_peername
+ settings.
MAY
- Try to use STARTTLS if offered, otherwise use the unencrypted
- connection.
+ Try to use TLS if the server announces support, otherwise use the
+ unencrypted connection. This has less precedence than a more specific
+ result (including NNOONNEE) from the alternate host or next-hop lookup key,
+ and has less precedence than the more specific global "smtp_enforce_tls
+ = yes" or "smtp_tls_enforce_peername = yes".
+ MUST_NOPEERMATCH
+ Require TLS encryption, but do not require that the remote SMTP server
+ hostname matches the information in the remote SMTP server certificate,
+ or that the server certificate was issued by a trusted CA. This
+ overrides a less secure NNOONNEE or a less specific MMAAYY lookup result from
+ the alternate host or next-hop lookup key, and overrides the global
+ smtp_use_tls, smtp_enforce_tls and smtp_tls_enforce_peername settings.
MUST
- Require usage of STARTTLS, require that the remote SMTP server hostname
+ Require TLS encryption, require that the remote SMTP server hostname
matches the information in the remote SMTP server certificate, and
require that the remote SMTP server certificate was issued by a trusted
- CA.
- MUST_NOPEERMATCH
- Require usage of STARTTLS, but do not require that the remote SMTP
- server hostname matches the information in the remote SMTP server
- certificate, or that the server certificate was issued by a trusted CA.
+ CA. This overrides a less secure NNOONNEE and MMUUSSTT__NNOOPPEEEERRMMAATTCCHH or a less
+ specific MMAAYY lookup result from the alternate host or next-hop lookup
+ key, and overrides the global smtp_use_tls, smtp_enforce_tls and
+ smtp_tls_enforce_peername settings.
-The actual TLS usage policy depends not only on whether the next-hop
-destination or remote SMTP server hostname are found in the smtp_tls_per_site
-table, but also on the smtp_enforce_tls setting:
+The precedences between global (main.cf) and per-site TLS policies can be
+summarized as follows:
- * If no match was found, the policy is applied as specified with
- smtp_enforce_tls.
+ * When neither the remote SMTP server hostname nor the next-hop destination
+ are found in the smtp_tls_per_site table, the policy is based on
+ smtp_use_tls, smtp_enforce_tls and smtp_tls_enforce_peername. Note:
+ "smtp_enforce_tls = yes" and "smtp_tls_enforce_peername = yes" imply
+ "smtp_use_tls = yes".
- * If a match was found, and the smtp_enforce_tls policy is "enforce", NONE
- explicitly switches it off; otherwise the "enforce" mode is used even for
- entries that specify MAY.
+ * When both hostname and next-hop destination lookups produce a result, the
+ more specific per-site policy (NONE, MUST, etc) overrides the less specific
+ one (MAY), and the more secure per-site policy (MUST, etc) overrides the
+ less secure one (NONE).
-Special hint for TLS enforcement mode: since no secure DNS lookup mechanism is
-available, mail can be delivered to the wrong remote SMTP server. This is not
-prevented by specifying MUST for the next-hop domain name. The recommended
-setup is: specify local transport(5) table entries for sensitive domains with
-explicit smtp:[mailhost] destinations (since you can assure security of this
-table unlike DNS), then specify MUST for these mail hosts in the
-smtp_tls_per_site table.
+ * After the per-site policy lookups are combined, the result generally
+ overrides the global policy. The exception is the less specific MMAAYY per-
+ site policy, which is overruled by the more specific global
+ "smtp_enforce_tls = yes" with server certificate verification as specified
+ with the smtp_tls_enforce_peername parameter.
+
+CClloossiinngg aa DDNNSS lloooopphhoollee wwiitthh ppeerr--ssiittee TTLLSS ppoolliicciieess
+
+As long as no secure DNS lookup mechanism is available, false hostnames may
+appear in MX or CNAME responses. Even with a perfect match between the server
+hostname and the server certificate, there is no guarantee that Postfix is
+connected to the right server. To avoid this loophole take the following steps:
+
+ * Eliminate MX lookups. Specify local transport(5) table entries for
+ sensitive domains with explicit smtp:[mailhost] or smtp:[mailhost]:port
+ destinations (you can assure security of this table unlike DNS); in the
+ smtp_tls_per_site table specify the value MMUUSSTT for the key [mailhost] or
+ smtp:[mailhost]:port. This prevents false hostname information in DNS MX
+ records from changing the server hostname that Postfix uses for TLS policy
+ lookup and server certificate verification.
+
+ * Disallow CNAME hostname overrides. In main.cf specify
+ "smtp_cname_overrides_servername = no". This prevents false hostname
+ information in DNS CNAME records from changing the server hostname that
+ Postfix uses for TLS policy lookup and server certificate verification.
+ This feature requires Postfix 2.2.9 or later.
Example:
/etc/postfix/main.cf:
smtp_tls_per_site = hash:/etc/postfix/tls_per_site
+ relayhost = [msa.example.net]:587
+
+ /etc/postfix/tls_per_site:
+ # relayhost exact nexthop match
+ [msa.example.net]:587 MUST
+
+ # example.org (as nexthop) has MX hosts with broken TLS.
+ example.org NONE
+
+ # Except for (as host) mx1.example.org which works.
+ mx1.example.org MAY
+
+DDiissccoovveerriinngg sseerrvveerrss tthhaatt ssuuppppoorrtt TTLLSS
As we decide on a "per site" basis whether or not to use TLS, it would be good
to have a list of sites that offered "STARTTLS". We can collect it ourselves
@@ -768,7 +836,7 @@ Example:
/etc/postfix/main.cf:
smtp_tls_note_starttls_offer = yes
-SSeerrvveerr cceerrttiiffiiccaattee vveerriiffiiccaattiioonn
+SSeerrvveerr cceerrttiiffiiccaattee vveerriiffiiccaattiioonn ddeepptthh
When verifying a remote SMTP server certificate, a verification depth of 1 is
sufficient if the certificate is directly issued by a CA specified with
@@ -1017,10 +1085,25 @@ J
and in order to access the TLS session cache databases. Such a protocol
cannot be run across fifos.
+ * smtp_tls_per_site: the MUST_NOPEERMATCH per-site policy cannot override the
+ global "smtp_tls_enforce_peername = yes" setting.
+
+ * smtp_tls_per_site: a combined (NONE + MAY) lookup result for (hostname and
+ next-hop destination) produces counter-intuitive results for different
+ main.cf settings. TLS is enabled with "smtp_tls_enforce_peername = no", but
+ it is disabled when both "smtp_enforce_tls = yes" and
+ "smtp_tls_enforce_peername = yes".
+
+The smtp_tls_per_site limitations were removed by the end of the Postfix 2.2
+support cycle.
+
CCrreeddiittss
* TLS support for Postfix was originally developed by Lutz Jänicke at Cottbus
Technical University.
* Wietse Venema adopted the code, did some restructuring, and compiled this
part of the documentation from Lutz's documents.
+ * Victor Duchovni was instrumental with the re-implementation of the
+ smtp_tls_per_site code in terms of enforcement levels, which simplified the
+ implementation greatly.
diff --git a/postfix/RELEASE_NOTES b/postfix/RELEASE_NOTES
index 96233b96b..4dde0c609 100644
--- a/postfix/RELEASE_NOTES
+++ b/postfix/RELEASE_NOTES
@@ -17,6 +17,48 @@ Incompatibility with Postfix 2.1 and earlier
If you upgrade from Postfix 2.1 or earlier, read RELEASE_NOTES-2.2
before proceeding.
+Incompatibility with snapshot 20060123
+======================================
+
+Postfix now preserves uppercase information while mapping addresses
+with canonical, virtual, relocated or generic maps; this happens
+even with lookups from regular expression maps. However, the local(8)
+and virtual(8) delivery agents still fold addresses to lower case.
+
+By default, Postfix now folds the search string to lowercase only
+with tables that have fixed-case lookup fields such as btree:,
+hash:, dbm:, ldap:, or *sql:. The search string is no longer case
+folded with tables whose lookup fields can match both upper or lower
+case, such as regexp:, pcre:, or cidr:.
+
+For safety reasons, Postfix no longer allows $number substitution
+in regexp: or pcre: transport tables or per-sender relayhost tables.
+
+For safety reasons, daemons that don't need privileges now insist
+that they are configured as unprivileged in master.cf.
+
+Major changes with snapshot 20060123
+====================================
+
+Postfix now does a better job at preserving upper/lower case
+information while transforming addresses. The table lookup code
+was revised, and is now more careful about when it folds search
+strings to lower case. As a side effect, Postfix now also does a
+better job at being case insensitive where it should, for example
+while searching per-host TLS policies or SASL passwords.
+
+Some obscure behavior was eliminated from the smtp_tls_per_site
+feature, without changes to the user interface. some Postfix internals
+had to be re-structured in preparation for a more general TLS policy
+mechanism; this required that smtp_tls_per_site be re-implemented
+from scratch.
+
+Postfix 2.3 is expected to provide a new per-site TLS policy mechanism
+that eliminates DNS spoofing attacks more effectively; the legacy
+smtp_tls_per_site feature will be kept intact for a few releases
+so that sites can upgrade Postfix without being forced to use a
+different TLS policy mechanism.
+
Incompatibility with snapshot 20060112
======================================
@@ -28,7 +70,7 @@ and mail will not be delivered.
The Postfix SMTP/LMTP client by default no longer allows DNS CNAME
records to override the server hostname that is used for logging,
SASL password lookup, TLS policy selection and TLS server certificate
-verification. Specify "smtp_cname_overrides_servername = no" to get
+verification. Specify "smtp_cname_overrides_servername = yes" to get
the old behavior.
Postfix DSN reports no longer make up their own surrogate SMTP
diff --git a/postfix/html/CDB_README.html b/postfix/html/CDB_README.html
index 4307cc6f7..9d81ee2f7 100644
--- a/postfix/html/CDB_README.html
+++ b/postfix/html/CDB_README.html
@@ -54,7 +54,7 @@ available from http://www.corpit
Tinycdb is preferred, since it is a bit faster, has additional
useful functionality and is much simpler to use. To build Postfix after you have installed CDB, use something
+ To build Postfix after you have installed tinycdb, use something
like:
@@ -65,7 +65,11 @@ like:
Alternatively, for the D.J.B. version of CDB:
+ +
% make tidy % CDB=../../../cdb-0.75 diff --git a/postfix/html/OVERVIEW.html b/postfix/html/OVERVIEW.html index 84cbd7f21..9bdf973e6 100644 --- a/postfix/html/OVERVIEW.html +++ b/postfix/html/OVERVIEW.html @@ -411,7 +411,7 @@ responsible for starting Postfix server processes to receive and deliver mail, and for restarting servers that terminate prematurely because of some problem. The master(8) server is also responsible for enforcing the server process count limits as specified in the -master.cf configuration file. The picture below gives the +master.cf configuration file. The picture below gives the program hierarchy when Postfix is started up. Only some of the mail handling daemon processes are shown. @@ -687,7 +687,7 @@ queue files. This is a limited, preliminary utility. This program is likely to be superseded by something more powerful that can also edit Postfix queue files. -The postconf(1) command displays or updates Postfix main.cf +
The postconf(1) command displays or updates Postfix main.cf parameters and displays system dependent information about the supported file locking methods, and the supported types of lookup tables.
diff --git a/postfix/html/SMTPD_POLICY_README.html b/postfix/html/SMTPD_POLICY_README.html index 869861c9b..179b22fc2 100644 --- a/postfix/html/SMTPD_POLICY_README.html +++ b/postfix/html/SMTPD_POLICY_README.html @@ -79,6 +79,7 @@ helo_name=some.domain.tld queue_id=8045F2AB23 sender=foo@bar.tld recipient=bar@foo.tld +recipient_count=0 client_address=1.2.3.4 client_name=another.domain.tld reverse_client_name=another.domain.tld @@ -115,8 +116,19 @@ encryption_keysize=256When an attribute value is unavailable, the client - either does not send the attribute, or sends the attribute with - an empty value ("name=").
+ either does not send the attribute, sends the attribute with + an empty value ("name="), or sends a zero value ("name=0") in + the case of a numerical attribute. + +The "recipient" attribute is available only in the + "RCPT TO" stage, and in the "DATA" and "END-OF-MESSAGE" stages + when Postfix accepted only one recipient for the current message. +
+ +The "recipient_count" attribute (Postfix 2.3 and later) + is non-zero only in the "DATA" and "END-OF-MESSAGE" stages. It + specifies the number of recipients that Postfix accepted for + the current message.
The client address is an IPv4 dotted quad in the form 1.2.3.4 or it is an IPv6 address in the form 1:2:3::4:5:6. @@ -217,11 +229,11 @@ daemon, you would use something like this:
- 1 /etc/postfix/master.cf: + 1 /etc/postfix/master.cf: 2 policy unix - n n - - spawn 3 user=nobody argv=/some/where/policy-server 4 - 5 /etc/postfix/main.cf: + 5 /etc/postfix/main.cf: 6 smtpd_recipient_restrictions = 7 ... 8 reject_unauth_destination @@ -239,8 +251,8 @@ daemon, you would use something like this: its child process after 1000 seconds. This is too short for a policy daemon that may run for as long as an SMTP client is connected to an SMTP server process. The default time limit is overruled in -main.cf with an explicit "policy_time_limit" setting. The name of -the parameter is the name of the master.cf entry ("policy") +main.cf with an explicit "policy_time_limit" setting. The name of +the parameter is the name of the master.cf entry ("policy") concatenated with the "_time_limit" suffix.Lines 8, 9: always specify "check_policy_service" AFTER @@ -254,11 +266,11 @@ TCP sockets instead:
- 1 /etc/postfix/master.cf: + 1 /etc/postfix/master.cf: 2 127.0.0.1:9998 inet n n n - - spawn 3 user=nobody argv=/some/where/policy-server 4 - 5 /etc/postfix/main.cf: + 5 /etc/postfix/main.cf: 6 smtpd_recipient_restrictions = 7 ... 8 reject_unauth_destination @@ -320,7 +332,7 @@ $greylist_delay=60;The /var/mta directory (or whatever you choose) should be writable by "nobody", or by whatever username you configure below -in master.cf for the policy service.
+in master.cf for the policy service.Example:
@@ -346,11 +358,11 @@ processes only:@@ -366,8 +378,8 @@ each request and reply. its child process after 1000 seconds. This is too short for a policy daemon that may run for as long as an SMTP client is connected to an SMTP server process. The default time limit is overruled in -main.cf with an explicit "policy_time_limit" setting. The name of -the parameter is the name of the master.cf entry ("policy") +main.cf with an explicit "policy_time_limit" setting. The name of +the parameter is the name of the master.cf entry ("policy") concatenated with the "_time_limit" suffix. @@ -378,11 +390,11 @@ client/server configuration" section above.-1 /etc/postfix/master.cf: +1 /etc/postfix/master.cf: 2 policy unix - n n - - spawn 3 user=nobody argv=/usr/bin/perl /usr/libexec/postfix/greylist.pl 4 -5 /etc/postfix/main.cf: +5 /etc/postfix/main.cf: 6 policy_time_limit = 3600@@ -400,7 +412,7 @@ forged MAIL FROM domains could be found at-1 /etc/postfix/master.cf: +1 /etc/postfix/master.cf: 2 127.0.0.1:9998 inet n n n - - spawn 3 user=nobody argv=/usr/bin/perl /usr/libexec/postfix/greylist.pl 4 -5 /etc/postfix/main.cf: +5 /etc/postfix/main.cf: 6 127.0.0.1:9998_time_limit = 3600- 1 /etc/postfix/main.cf: + 1 /etc/postfix/main.cf: 2 smtpd_recipient_restrictions = 3 reject_unlisted_recipient 4 ... @@ -450,7 +462,7 @@ database relatively quickly.- 1 /etc/postfix/main.cf: + 1 /etc/postfix/main.cf: 2 smtpd_recipient_restrictions = 3 reject_unlisted_recipient 4 ... diff --git a/postfix/html/TLS_README.html b/postfix/html/TLS_README.html index 0ff0d03f2..29d77edff 100644 --- a/postfix/html/TLS_README.html +++ b/postfix/html/TLS_README.html @@ -129,6 +129,11 @@ the make(1) files with the necessary definitions. This is done by invoking the command "make makefiles" in the Postfix top-level directory and with arguments as shown next. +NOTE: Do not use Gnu TLS. It will spontaneously terminate +a process with exit status code 2, instead of properly reporting +problems to Postfix, so that it can log them to the maillog file. +
+
If the OpenSSL include files (such as ssl.h) are @@ -274,7 +279,7 @@ is correctly configured to supply its intermediate CA certificate).
-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtpd_tls_cert_file = /etc/postfix/server.pem smtpd_tls_key_file = $smtpd_tls_cert_file@@ -284,7 +289,7 @@ is correctly configured to supply its intermediate CA certificate).-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtpd_tls_dcert_file = /etc/postfix/server-dsa.pem smtpd_tls_dkey_file = $smtpd_tls_dcert_file@@ -334,7 +339,7 @@ the TLS handshake when client certificates are requested.Example:
-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtpd_tls_CAfile = /etc/postfix/CAcert.pem smtpd_tls_CApath = /etc/postfix/certs@@ -376,7 +381,7 @@ strongly discouraged.@@ -392,7 +397,7 @@ since the headers may be changed by intermediate servers.-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtpd_tls_loglevel = 0@@ -407,7 +412,7 @@ using "smtpd_use_tls = yes".-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtpd_tls_received_header = yes@@ -430,7 +435,7 @@ This option is off by default and should only seldom be used.-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtpd_use_tls = yes@@ -442,8 +447,8 @@ Outlook [Express] prefer the "wrapper" mode. This is true for OE (Win32 < 5.0 and Win32 >=5.0 when run on a port<>25 and OE (5.01 Mac on all ports). --/etc/postfix/main.cf: +/etc/postfix/main.cf: smtpd_enforce_tls = yesIt is strictly discouraged to use this mode from main.cf. If -you want to support this service, enable a special port in master.cf +
It is strictly discouraged to use this mode from main.cf. If +you want to support this service, enable a special port in master.cf and specify "-o smtpd_tls_wrappermode = yes" as an smtpd(8) command line option. Port 465 (smtps) was once chosen for this feature.
@@ -452,7 +457,7 @@ line option. Port 465 (smtps) was once chosen for this feature.-/etc/postfix/master.cf: +/etc/postfix/master.cf: smtps inet n - n - - smtpd -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes@@ -477,7 +482,7 @@ feature.@@ -500,7 +505,7 @@ logged.-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtpd_tls_ask_ccert = no@@ -515,7 +520,7 @@ CA issues special CA which then issues the actual certificate...)-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtpd_tls_req_ccert = no@@ -536,7 +541,7 @@ set "smtpd_tls_auth_only = yes-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtpd_tls_ccert_verifydepth = 5@@ -560,7 +565,7 @@ the cost of repeatedly negotiating TLS session keys is high.-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtpd_tls_auth_only = no@@ -574,7 +579,7 @@ recommends a maximum of 24 hours.-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtpd_tls_session_cache_database = btree:/etc/postfix/smtpd_scache@@ -622,7 +627,7 @@ certificate must no longer be used (e.g. an employee leaving).-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtpd_tls_session_cache_timeout = 3600s-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtpd_recipient_restrictions = ... permit_tls_clientcerts @@ -643,7 +648,7 @@ the user or host.-/etc/postfix/main.cf: +/etc/postfix/main.cf: relay_clientcerts = hash:/etc/postfix/relay_clientcerts /etc/postfix/relay_clientcerts: @@ -665,7 +670,7 @@ don't know what to do with it, simply don't touch it and leave the@@ -691,7 +696,7 @@ those distributed with other TLS packages.-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtpd_tls_cipherlist = DEFAULT-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtpd_tls_dh1024_param_file = /etc/postfix/dh_1024.pem smtpd_tls_dh512_param_file = /etc/postfix/dh_512.pem@@ -707,7 +712,7 @@ handshake procedures.@@ -726,9 +731,23 @@ key configuration-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtpd_starttls_timeout = 300s- Client-side TLS session cache -
- Enabling TLS in the Postfix SMTP client +
- Enabling TLS in the Postfix SMTP client -
- Server certificate verification +
- Requiring TLS encryption + +
- Disabling server certificate verification + +
- Per-site TLS policies + + + +
- Closing a DNS loophole with per-site TLS policies + +
- Discovering servers that support TLS + +
- Server certificate verification depth
- Client-side cipher controls @@ -788,7 +807,7 @@ the overhead of the TLS exchange. certificates issued by these CAs, append the root certificate to $smtp_tls_CAfile or install it in the $smtp_tls_CApath directory. When you configure trust in a root CA, it is not necessary to explicitly trust -intermediary CAs signed by the root CA, unless $smtp_tls_verify_depth +intermediary CAs signed by the root CA, unless $smtp_tls_scert_verifydepth is less than the number of CAs in the certificate chain for the servers of interest. With a verify depth of 1 you can only verify certificates directly signed by a trusted CA, and all trusted intermediary CAs need to @@ -800,7 +819,7 @@ is correctly configured to supply its intermediate CA certificate).
-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtp_tls_cert_file = /etc/postfix/client.pem smtp_tls_key_file = $smtp_tls_cert_file@@ -810,7 +829,7 @@ is correctly configured to supply its intermediate CA certificate).-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtp_tls_dcert_file = /etc/postfix/client-dsa.pem smtp_tls_dkey_file = $smtpd_tls_cert_file@@ -849,7 +868,7 @@ when the certificate is needed.-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtp_tls_CAfile = /etc/postfix/CAcert.pem smtp_tls_CApath = /etc/postfix/certs@@ -888,7 +907,7 @@ transmission after STARTTLS@@ -915,7 +934,7 @@ is allowed to negotiate per unit time.-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtp_tls_loglevel = 0@@ -929,39 +948,37 @@ recommends a maximum of 24 hours.-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtp_tls_session_cache_database = btree:/etc/postfix/smtp_scache--/etc/postfix/main.cf: +/etc/postfix/main.cf: smtp_tls_session_cache_timeout = 3600sEnabling TLS in the Postfix SMTP client -
+Enabling TLS in the Postfix SMTP +client
By default, TLS is disabled in the Postfix SMTP client, so no difference to plain Postfix is visible. If you enable TLS, the Postfix SMTP client will send STARTTLS when TLS support is announced by the remote SMTP server.
-WARNING: MS Exchange servers will announce STARTTLS support -even when the service is not configured, so that the TLS handshake -will fail. It may be wise to not use this option on your central -mail hub, as you don't know in advance whether you are going to -connect to such a host. Instead, use the smtp_tls_per_site -recipient/site specific options that are described below.
- -When the TLS handshake fails and no other server is available, -the Postfix SMTP client defers the delivery attempt, and the mail -stays in the queue.
+When the server accepts the STARTTLS command, but the subsequent +TLS handshake fails, and no other server is available, the Postfix SMTP +client defers the delivery attempt, and the mail stays in the queue. After +a handshake failure, the communications channel is in an indeterminate +state and cannot be used for non-TLS deliveries.
Example:
+-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtp_use_tls = yesRequiring TLS encryption +
+You can ENFORCE the use of TLS, so that the Postfix SMTP client will not deliver mail over unencrypted connections. In this mode, the remote SMTP server hostname must match the information in the @@ -971,14 +988,14 @@ server certificate doesn't verify or the remote SMTP server hostname doesn't match, and no other server is available, the delivery attempt is deferred and the mail stays in the queue.
-The remote SMTP server hostname used in the check is beyond -question, as it must be the principal hostname (no CNAME allowed -here). Checks are performed against all names provided as dNSNames +
The remote SMTP server hostname is verified against all names +provided as dNSNames in the SubjectAlternativeName. If no dNSNames are specified, the -CommonName is checked. The behavior may be changed with the +CommonName is checked. Verification may be turned off with the smtp_tls_enforce_peername option which is discussed below.
-This option is useful only if you know that you will only +
Enforcing the use of TLS is useful if you know that you will +only connect to servers that support RFC 2487 _and_ that present server certificates that meet the above requirements. An example would be a client only sends email to one specific mailhub that offers @@ -988,11 +1005,14 @@ the necessary STARTTLS support.
+-/etc/postfix/main.cf: - smtp_enforce_tls = no +/etc/postfix/main.cf: + smtp_enforce_tls = yesDisabling server certificate +verification
+As of RFC 2487 the requirements for hostname checking for MTA clients are not set. When TLS is required (smtp_enforce_tls = yes), the option smtp_tls_enforce_peername can be set to "no" to disable @@ -1000,106 +1020,198 @@ strict remote SMTP server hostname checking. In this case, the mail delivery will proceed regardless of the CommonName etc. listed in the certificate.
-Note: the smtp_tls_enforce_peername setting has no effect on -sessions that are controlled via the smtp_tls_per_site table.
- -Disabling the remote SMTP server hostname verification can -make sense in closed environment where special CAs are created. -If not used carefully, this option opens the danger of a -"man-in-the-middle" attack (the CommonName of this possible attacker -is logged).
+Despite the potential for eliminating "man-in-the-middle" and +other attacks, mandatory certificate/peername verification is not +viable as a default Internet mail delivery policy at this time. A +significant fraction of TLS enabled MTAs uses self-signed certificates, +or certificates that are signed by a private certificate authority. +On a machine that delivers mail to the Internet, if you set +smtp_enforce_tls = yes, you should probably also set +smtp_tls_enforce_peername = no. You can use the per-site TLS +policies (see below) to enable full peer verification for specific +destinations that are known to have verifiable TLS server certificates. +
Example:
--/etc/postfix/main.cf: - smtp_tls_enforce_peername = yes +/etc/postfix/main.cf: + smtp_enforce_tls = yes + smtp_tls_enforce_peername = noGenerally, trying TLS can be a bad idea, as some servers offer -STARTTLS but the negotiation will fail leading to unexplainable -failures. Instead, it may be a good idea to choose the TLS usage -policy based on the recipient or the mailhub to which you are -connecting.
+Per-site TLS policies
-Deciding the TLS usage policy per recipient may be difficult, -since a single email delivery attempt can involve several recipients. -Instead, use of TLS is controlled by the Postfix next-hop destination -domain name and by the remote SMTP server hostname. If either of these -matches an entry in the smtp_tls_per_site table, appropriate action -is taken.
+A small fraction of servers offer STARTTLS but the negotiation +consistently fails, leading to mail aging out of the queue and +bouncing back to the sender. In such cases, you can use the per-site +policies to disable TLS for the problem sites. Alternatively, you +can enable TLS for just a few specific sites and not enable it for +all sites.
-The remote SMTP server hostname is simply the DNS name of the -server that the Postfix SMTP client connects to. The next-hop -destination is Postfix specific. By default, this is the domain -name in the recipient address, but this information can be overruled -by the transport(5) table or by the relayhost parameter setting. -In these cases the relayhost etc. must be listed in the smtp_tls_per_site -table, instead of the recipient domain name.
+ + +The smtp_tls_per_site table is searched for a policy that matches +the following information:
--
- NONE
- Don't use TLS at all.
+- remote SMTP server hostname
- This is simply the DNS +name of the server that the Postfix SMTP client connects to; this +name may be obtained from other DNS lookups, such as MX lookups or +CNAME lookups.
-- MAY
- Try to use STARTTLS if offered, otherwise use -the unencrypted connection.
- -- MUST
- Require usage of STARTTLS, require that the -remote SMTP server hostname matches the information in the remote -SMTP server certificate, and require that the remote SMTP server -certificate was issued by a trusted CA.
- -- MUST_NOPEERMATCH
- Require usage of STARTTLS, but do -not require that the remote SMTP server hostname matches the -information in the remote SMTP server certificate, or that the -server certificate was issued by a trusted CA.
+- next-hop destination
- This is normally the domain +portion of the recipient address, but it may be overruled by +information from the transport(5) table, from the relayhost parameter +setting, or from the relay_transport setting. When it's not the +recipient domain, the next-hop destination can have the Postfix-specific +form "[name]", [name]:port", "name" or +"name:port".
The actual TLS usage policy depends not only on whether the -next-hop destination or remote SMTP server hostname are found in -the smtp_tls_per_site table, but also on the smtp_enforce_tls -setting:
+When both the hostname lookup and the next-hop lookup succeed, +the host policy does not automatically override the next-hop policy. +Instead, precedence is given to either the more specific or the +more secure per-site policy as described below.
+ +The smtp_tls_per_site table uses a simple "name whitespace +value" format. Specify host names or next-hop destinations on +the left-hand side; no wildcards are allowed. On the right hand +side specify one of the following keywords:
+ ++ ++ ++ +
+ +- NONE
- Don't use TLS at all. This overrides a less +specific MAY lookup result from the alternate host or next-hop +lookup key, and overrides the global smtp_use_tls, smtp_enforce_tls, +and smtp_tls_enforce_peername settings.
+ +- MAY
- Try to use TLS if the server announces support, +otherwise use the unencrypted connection. This has less precedence +than a more specific result (including NONE) from the alternate +host or next-hop lookup key, and has less precedence than the more +specific global "smtp_enforce_tls = yes" or "smtp_tls_enforce_peername += yes".
+ +- MUST_NOPEERMATCH
- Require TLS encryption, but do not +require that the remote SMTP server hostname matches the information +in the remote SMTP server certificate, or that the server certificate +was issued by a trusted CA. This overrides a less secure NONE +or a less specific MAY lookup result from the alternate host +or next-hop lookup key, and overrides the global smtp_use_tls, +smtp_enforce_tls and smtp_tls_enforce_peername settings.
+ +- MUST
- Require TLS encryption, require that the remote +SMTP server hostname matches the information in the remote SMTP +server certificate, and require that the remote SMTP server certificate +was issued by a trusted CA. This overrides a less secure NONE +and MUST_NOPEERMATCH or a less specific MAY lookup +result from the alternate host or next-hop lookup key, and overrides +the global smtp_use_tls, smtp_enforce_tls and smtp_tls_enforce_peername +settings.
+ +The precedences between global (main.cf) and per-site TLS +policies can be summarized as follows:
-
-If no match was found, the policy is applied as specified -with smtp_enforce_tls.
+When neither the remote SMTP server hostname nor the +next-hop destination are found in the smtp_tls_per_site table, the +policy is based on smtp_use_tls, smtp_enforce_tls and +smtp_tls_enforce_peername. Note: "smtp_enforce_tls = yes" and +"smtp_tls_enforce_peername = yes" imply "smtp_use_tls = yes".
-If a match was found, and the smtp_enforce_tls policy is -"enforce", NONE explicitly switches it off; otherwise the "enforce" -mode is used even for entries that specify MAY.
+When both hostname and next-hop destination lookups produce +a result, the more specific per-site policy (NONE, MUST, etc) +overrides the less specific one (MAY), and the more secure per-site +policy (MUST, etc) overrides the less secure one (NONE).
+ +After the per-site policy lookups are combined, the result +generally overrides the global policy. The exception is the less +specific MAY per-site policy, which is overruled by the more +specific global "smtp_enforce_tls = yes" with server certificate +verification as specified with the smtp_tls_enforce_peername +parameter.
Special hint for TLS enforcement mode: since no secure DNS -lookup mechanism is available, mail can be delivered to the wrong -remote SMTP server. This is not prevented by specifying MUST for -the next-hop domain name. The recommended setup is: specify local -transport(5) table entries for sensitive domains with explicit -smtp:[mailhost] destinations (since you can assure security of this -table unlike DNS), then specify MUST for these mail hosts in the -smtp_tls_per_site table.
+Closing a DNS loophole with + per-site TLS policies
+ +As long as no secure DNS lookup mechanism is available, false +hostnames may appear in MX or CNAME responses. Even with a perfect +match between the server hostname and the server certificate, there +is no guarantee that Postfix is connected to the right server. To +avoid this loophole take the following steps:
+ ++ +
Eliminate MX lookups. Specify local transport(5) table +entries for sensitive domains with explicit smtp:[mailhost] +or smtp:[mailhost]:port destinations (you can assure +security of this table unlike DNS); in the smtp_tls_per_site table +specify the value MUST for the key [mailhost] or +smtp:[mailhost]:port. This prevents false hostname +information in DNS MX records from changing the server hostname +that Postfix uses for TLS policy lookup and server certificate +verification.
+ +Disallow CNAME hostname overrides. In main.cf specify +"smtp_cname_overrides_servername = no". This prevents false hostname +information in DNS CNAME records from changing the server hostname +that Postfix uses for TLS policy lookup and server certificate +verification. This feature requires Postfix 2.2.9 or later.
+ +Example:
- ---/etc/postfix/main.cf: + +++/etc/postfix/main.cf: smtp_tls_per_site = hash:/etc/postfix/tls_per_site + relayhost = [msa.example.net]:587 + +/etc/postfix/tls_per_site: + # relayhost exact nexthop match + [msa.example.net]:587 MUST + + # example.org (as nexthop) has MX hosts with broken TLS. + example.org NONE + + # Except for (as host) mx1.example.org which works. + mx1.example.org MAYDiscovering servers that support +TLS
+As we decide on a "per site" basis whether or not to use TLS, it would be good to have a list of sites that offered "STARTTLS". We can collect it ourselves with this option.
@@ -1118,12 +1230,12 @@ postfix/smtp[pid]: Host offered STARTTLS: [hostname.example.com]--/etc/postfix/main.cf: +/etc/postfix/main.cf: smtp_tls_note_starttls_offer = yesServer certificate verification
+Server certificate verification depth
When verifying a remote SMTP server certificate, a verification depth of 1 is sufficient if the certificate is directly issued by @@ -1135,7 +1247,7 @@ special CA which then issues the actual certificate...)
@@ -1154,7 +1266,7 @@ don't know what to do with it, simply don't touch it and leave the-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtp_tls_scert_verifydepth = 5@@ -1171,7 +1283,7 @@ defers delivery if no alternative server is available.-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtp_tls_cipherlist = DEFAULT@@ -1191,7 +1303,7 @@ session key.-/etc/postfix/main.cf: +/etc/postfix/main.cf: smtp_starttls_timeout = 300s@@ -1206,11 +1318,11 @@ regular file, you must prepend the source type to the source name: "dev:" for a device special file, or "egd:" for a source with EGD compatible socket interface. --/etc/postfix/main.cf: +/etc/postfix/main.cf: tls_daemon_random_bytes = 32Examples (specify only one in main.cf):
+Examples (specify only one in main.cf):
-/etc/postfix/main.cf: +/etc/postfix/main.cf: tls_random_source = dev:/dev/urandom tls_random_source = egd:/var/run/egd-pool@@ -1227,7 +1339,7 @@ entropy source, a larger amount of data can be read.@@ -1242,7 +1354,7 @@ The default maximal time interval is 1 hour.-/etc/postfix/main.cf: +/etc/postfix/main.cf: tls_random_bytes = 32@@ -1260,7 +1372,7 @@ the file location should probably be on the /var partition (but-/etc/postfix/main.cf: +/etc/postfix/main.cf: tls_random_reseed_period = 3600s-/etc/postfix/main.cf: +/etc/postfix/main.cf: tls_random_exchange_name = /etc/postfix/prng_exch tls_random_prng_update_period = 3600s@@ -1380,7 +1492,7 @@ super-user privileges.Configure Postfix, by adding the following to -/etc/postfix/main.cf.
+/etc/postfix/main.cf .@@ -1424,7 +1536,7 @@ patch by Lutz Jänicke, but differs in a few minor ways.-
+main.cf: Specify "btree" instead of "sdbm" for TLS +
main.cf: Specify "btree" instead of "sdbm" for TLS session cache databases.
TLS session cache databases are now accessed only by the @@ -1439,7 +1551,7 @@ In most cases, btree databases should be adequate.
NOTE: You cannot use dbm databases. TLS session objects are too large.
-master.cf: Specify "unix" instead of "fifo" as +
master.cf: Specify "unix" instead of "fifo" as the tlsmgr service type.
The smtp(8) and smtpd(8) processes now use a client-server @@ -1447,8 +1559,22 @@ protocol in order to access the tlsmgr(8) pseudo-ran generation (PRNG) pool, and in order to access the TLS session cache databases. Such a protocol cannot be run across fifos.
+smtp_tls_per_site: the MUST_NOPEERMATCH per-site policy +cannot override the global "smtp_tls_enforce_peername = yes" setting. +
+ +smtp_tls_per_site: a combined (NONE + MAY) lookup result +for (hostname and next-hop destination) produces counter-intuitive +results for different main.cf settings. TLS is enabled with +"smtp_tls_enforce_peername = no", but it is disabled when both +"smtp_enforce_tls = yes" and "smtp_tls_enforce_peername = yes". +
+The smtp_tls_per_site limitations were removed by the end of +the Postfix 2.2 support cycle.
+Credits
@@ -1459,6 +1585,10 @@ Jänicke at Cottbus Technical University.
- Wietse Venema adopted the code, did some restructuring, and compiled this part of the documentation from Lutz's documents. +
- Victor Duchovni was instrumental with the re-implementation +of the smtp_tls_per_site code in terms of enforcement levels, which +simplified the implementation greatly. +