]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.4-20060720
authorWietse Venema <wietse@porcupine.org>
Thu, 20 Jul 2006 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:32:28 +0000 (06:32 +0000)
postfix/HISTORY
postfix/README_FILES/TLS_README
postfix/html/TLS_README.html
postfix/html/postconf.5.html
postfix/man/man5/postconf.5
postfix/proto/TLS_README.html
postfix/proto/postconf.proto
postfix/src/global/mail_version.h
postfix/src/milter/milter8.c
postfix/src/milter/test-list
postfix/src/milter/test-milter.c

index c2752fce677961eb5c0fd89b8130ae3200573ae7..1ea8da4d3fed4501af59fd5212ddda9b10ceff31 100644 (file)
@@ -12568,13 +12568,19 @@ Apologies for any names omitted.
        underlying problem more directly as described next. File:
        smtp/smtp_proto.c.
 
-       Safety: with plaintext fallback after failed TLS handshake,
-       the Postfix SMTP client defers mail if the server does not
-       support SASL over plaintext, while the Postfix SMTP client
-       would have attempted to log in with SASL after successful
-       TLS handshake.  This prevents mail from being rejected with
-       insufficient mail relay permission.  Files: smtp/smtp_connect.c,
-       smtp/smtp_session.c, smtp/smtp_proto.c.
+       Safety: don't fall back to plaintext delivery after failed
+       TLS handshake, when the Postfix SMTP client would have
+       attempted to log in with SASL after successful TLS handshake.
+       This avoids undesirable behavior regardless of whether the
+       server does support SASL over plaintext (unexpected password
+       disclosure) and whether the server doesn't support SASL
+       over plaintext (insufficient mail relay permission).  Files:
+       smtp/smtp_connect.c, smtp/smtp_session.c, smtp/smtp_proto.c.
+
+20060720
+
+       Compatibility: replace %% in milter replies by %, and strip
+       single (i.e. invalid) % characters. File: milter/milter8.c.
 
 Wish list:
 
index 49194798a3f153cf44acacf842cf16b6c4173ab3..0a17d82fc458e24a1e68613680ed648de760c166 100644 (file)
@@ -1358,7 +1358,13 @@ information:
         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. Use of the hostname lookup key is
-        discouraged; always use the next-hop destination instead.
+        discouraged; always use the next-hop destination instead. The hostname
+        lookup key may not behave as you expect when SMTP connection caching is
+        enabled (with the smtp_connection_cache_destinations or
+        smtp_connection_cache_on_demand configuration parameter). Multiple
+        hostnames may resolve to the same IP address, and the hostname from the
+        SMTP connection cache overrides the hostname that Postfix uses for TLS
+        policy lookup or server certificate verification.
     next-hop destination
         This is normally the domain portion of the recipient address, but it
         may be overridden by information from the transport(5) table, from the
@@ -1432,15 +1438,19 @@ 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 all of the following steps:
 
- 1. Use a dedicated transport for all secure-channel deliveries.
+ 1. Use a dedicated transport that does not cache SMTP connections. Otherwise,
+    the hostname from the SMTP connection cache overrides the hostname that
+    Postfix uses for TLS policy lookup and server certificate verification.
 
  2. 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 Postfix's notion of the server hostname that is used
-    for TLS policy lookup and server certificate verification.
+    sensitive domains with explicit securetls:[mailhost] or securetls:
+    [mailhost]:port destinations (you can assure security of this table unlike
+    DNS). This prevents false hostname information in DNS MX records from
+    changing Postfix's notion of the server hostname that is used for TLS
+    policy lookup and server certificate verification. The "securetls"
+    transport is configured to enforce TLS with peername verification, and to
+    disable the SMTP connection cache which could interfere with enforcement of
+    smtp_tls_per_site policies.
 
  3. Disallow CNAME hostname overrides. In main.cf, specify
     "smtp_cname_overrides_servername = no". This prevents false hostname
index b3f30dadd56ff92a20368589cbd8c791562bd70f..dcd74d23221d95374a9bdf1ede7204356941318f 100644 (file)
@@ -1839,10 +1839,16 @@ the following information:  </p>
 <dl>
 
 <dt> remote SMTP server hostname </dt> <dd> 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. Use of the hostname lookup key is discouraged; always use the
-next-hop destination instead. </dd>
+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. Use of the hostname lookup key is discouraged; always
+use the next-hop destination instead. The hostname lookup key may
+not behave as you expect when SMTP connection caching is enabled
+(with the <a href="postconf.5.html#smtp_connection_cache_destinations">smtp_connection_cache_destinations</a> or
+<a href="postconf.5.html#smtp_connection_cache_on_demand">smtp_connection_cache_on_demand</a> configuration parameter).  Multiple
+hostnames may resolve to the same IP address, and the hostname from
+the SMTP connection cache overrides the hostname that Postfix uses
+for TLS policy lookup or server certificate verification.  </dd>
 
 <dt> next-hop destination </dt> <dd> This is normally the domain portion
 of the recipient address, but it may be overridden by information from
@@ -1941,17 +1947,21 @@ steps: </p>
 
 <ol>
 
-<li> <p> Use a dedicated transport for all secure-channel deliveries. </p>
+<li> <p> Use a dedicated transport that does not cache SMTP
+connections. Otherwise, the hostname from the SMTP connection cache
+overrides the hostname that Postfix uses for TLS policy lookup and
+server certificate verification.  </p>
 
 <li> <p> Eliminate MX lookups. Specify local <a href="transport.5.html">transport(5)</a> table
-entries for sensitive domains with explicit <a href="smtp.8.html">smtp</a>:[<i>mailhost</i>]
-or <a href="smtp.8.html">smtp</a>:[<i>mailhost</i>]:<i>port</i> destinations (you can assure
-security of this table unlike DNS); in the <a href="postconf.5.html#smtp_tls_per_site">smtp_tls_per_site</a>
-table, specify the value "MUST" for the key [<i>mailhost</i>] or
-<a href="smtp.8.html">smtp</a>:[<i>mailhost</i>]:<i>port</i>. This prevents false hostname
-information in DNS MX records from changing Postfix's notion of the
-server hostname that is used for TLS policy lookup and server certificate
-verification. </p>
+entries for sensitive domains with explicit securetls:[<i>mailhost</i>]
+or securetls:[<i>mailhost</i>]:<i>port</i> destinations (you can
+assure security of this table unlike DNS). This prevents false
+hostname information in DNS MX records from changing Postfix's
+notion of the server hostname that is used for TLS policy lookup
+and server certificate verification. The "securetls" transport is
+configured to enforce TLS with peername verification, and to disable
+the SMTP connection cache which could interfere with enforcement
+of <a href="postconf.5.html#smtp_tls_per_site">smtp_tls_per_site</a> policies. </p>
 
 <li> <p> Disallow CNAME hostname overrides. In <a href="postconf.5.html">main.cf</a>, specify
 "<a href="postconf.5.html#smtp_cname_overrides_servername">smtp_cname_overrides_servername</a> = no". This prevents false hostname
index b485dc1d8b7cc706e45442e6dc88d9f992e07628..cf3ea6b113b55867f2c64cb54988cf40dddbf209 100644 (file)
@@ -8229,7 +8229,13 @@ use <a href="postconf.5.html#smtp_tls_policy_maps">smtp_tls_policy_maps</a> inst
 discouraged. Always use the full destination nexthop (enclosed in
 [] with a possible ":port" suffix). A recipient domain or MX-enabled
 transport next-hop with no port suffix may look like a bare hostname,
-but is still a suitable <i>destination</i>. </p>
+but is still a suitable <i>destination</i>. The hostname lookup key
+may not behave as you expect when SMTP connection caching is enabled
+(see <a href="postconf.5.html#smtp_connection_cache_destinations">smtp_connection_cache_destinations</a> and
+<a href="postconf.5.html#smtp_connection_cache_on_demand">smtp_connection_cache_on_demand</a>). Different hostnames may resolve
+to the same IP address, and the hostname from the SMTP connection
+cache overrides the hostname that Postfix uses for TLS policy lookup
+and server certificate verification. </p>
 
 <p> Specify a next-hop destination or server hostname on the left-hand
 side; no wildcards are allowed. The next-hop destination is either
index 8484d021615c0985f29c2c0d93f6024ffc676085..4a085fda4e9e59b1f55068cc4fa04c1b8488dc71 100644 (file)
@@ -4683,7 +4683,13 @@ Use of the bare hostname as the per-site table lookup key is
 discouraged. Always use the full destination nexthop (enclosed in
 [] with a possible ":port" suffix). A recipient domain or MX-enabled
 transport next-hop with no port suffix may look like a bare hostname,
-but is still a suitable \fIdestination\fR.
+but is still a suitable \fIdestination\fR. The hostname lookup key
+may not behave as you expect when SMTP connection caching is enabled
+(see smtp_connection_cache_destinations and
+smtp_connection_cache_on_demand). Different hostnames may resolve
+to the same IP address, and the hostname from the SMTP connection
+cache overrides the hostname that Postfix uses for TLS policy lookup
+and server certificate verification.
 .PP
 Specify a next-hop destination or server hostname on the left-hand
 side; no wildcards are allowed. The next-hop destination is either
index 7247efedcb1383aab260752b1c47febfe59098b4..00e7cbd9367b9b21037f958fd444e83997b8bf38 100644 (file)
@@ -1839,10 +1839,16 @@ the following information:  </p>
 <dl>
 
 <dt> remote SMTP server hostname </dt> <dd> 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. Use of the hostname lookup key is discouraged; always use the
-next-hop destination instead. </dd>
+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. Use of the hostname lookup key is discouraged; always
+use the next-hop destination instead. The hostname lookup key may
+not behave as you expect when SMTP connection caching is enabled
+(with the smtp_connection_cache_destinations or
+smtp_connection_cache_on_demand configuration parameter).  Multiple
+hostnames may resolve to the same IP address, and the hostname from
+the SMTP connection cache overrides the hostname that Postfix uses
+for TLS policy lookup or server certificate verification.  </dd>
 
 <dt> next-hop destination </dt> <dd> This is normally the domain portion
 of the recipient address, but it may be overridden by information from
@@ -1941,17 +1947,21 @@ steps: </p>
 
 <ol>
 
-<li> <p> Use a dedicated transport for all secure-channel deliveries. </p>
+<li> <p> Use a dedicated transport that does not cache SMTP
+connections. Otherwise, the hostname from the SMTP connection cache
+overrides the hostname that Postfix uses for TLS policy lookup and
+server certificate verification.  </p>
 
 <li> <p> Eliminate MX lookups. Specify local transport(5) table
-entries for sensitive domains with explicit smtp:[<i>mailhost</i>]
-or smtp:[<i>mailhost</i>]:<i>port</i> destinations (you can assure
-security of this table unlike DNS); in the smtp_tls_per_site
-table, specify the value "MUST" for the key [<i>mailhost</i>] or
-smtp:[<i>mailhost</i>]:<i>port</i>. This prevents false hostname
-information in DNS MX records from changing Postfix's notion of the
-server hostname that is used for TLS policy lookup and server certificate
-verification. </p>
+entries for sensitive domains with explicit securetls:[<i>mailhost</i>]
+or securetls:[<i>mailhost</i>]:<i>port</i> destinations (you can
+assure security of this table unlike DNS). This prevents false
+hostname information in DNS MX records from changing Postfix's
+notion of the server hostname that is used for TLS policy lookup
+and server certificate verification. The "securetls" transport is
+configured to enforce TLS with peername verification, and to disable
+the SMTP connection cache which could interfere with enforcement
+of smtp_tls_per_site policies. </p>
 
 <li> <p> Disallow CNAME hostname overrides. In main.cf, specify
 "smtp_cname_overrides_servername = no". This prevents false hostname
index 0918f8db92191d4c0b514c12dae9ed05aa28c07c..b0e1099334a04680fea3a210e001a414eaceaed3 100644 (file)
@@ -8670,7 +8670,13 @@ use smtp_tls_policy_maps instead. </p>
 discouraged. Always use the full destination nexthop (enclosed in
 [] with a possible ":port" suffix). A recipient domain or MX-enabled
 transport next-hop with no port suffix may look like a bare hostname,
-but is still a suitable <i>destination</i>. </p>
+but is still a suitable <i>destination</i>. The hostname lookup key
+may not behave as you expect when SMTP connection caching is enabled
+(see smtp_connection_cache_destinations and
+smtp_connection_cache_on_demand). Different hostnames may resolve
+to the same IP address, and the hostname from the SMTP connection
+cache overrides the hostname that Postfix uses for TLS policy lookup
+and server certificate verification. </p>
 
 <p> Specify a next-hop destination or server hostname on the left-hand
 side; no wildcards are allowed. The next-hop destination is either
index edd0ad6508cfb4aeb8a9c70f8b0661aac4916ade..aefe5c413f13350b1a1d89e648f607c6406c4638 100644 (file)
@@ -20,7 +20,7 @@
   * Patches change both the patchlevel and the release date. Snapshots have no
   * patchlevel; they change the release date only.
   */
-#define MAIL_RELEASE_DATE      "20060719"
+#define MAIL_RELEASE_DATE      "20060720"
 #define MAIL_VERSION_NUMBER    "2.4"
 
 #ifdef SNAPSHOT
index 8566d882e61fe06bf2b9d971d25923e83fb6cdef..711f1015a9ebee536c4e83923505a58a96349b5c 100644 (file)
@@ -488,7 +488,7 @@ static void milter8_close_stream(MILTER8 *milter)
 /* milter8_read_resp - receive command code now, receive data later */
 
 static int milter8_read_resp(MILTER8 *milter, int event, unsigned char *command,
-                                   ssize_t *data_len)
+                                    ssize_t *data_len)
 {
     UINT32_TYPE len;
     ssize_t pkt_len;
@@ -963,6 +963,10 @@ static const char *milter8_event(MILTER8 *milter, int event,
 #define IN_CONNECT_EVENT(e) ((e) == SMFIC_CONNECT || (e) == SMFIC_HELO)
 
     for (;;) {
+       char   *cp;
+       char   *rp;
+       char    ch;
+
        if (milter8_read_resp(milter, event, &cmd, &data_size) != 0)
            return (milter->def_reply);
        if (msg_verbose)
@@ -1081,6 +1085,11 @@ static const char *milter8_event(MILTER8 *milter, int event,
             * Decision: "ddd d.d+.d+ text". This decision is final (i.e.
             * Sendmail 8 changes receiver state). Note: the reply may be in
             * multi-line SMTP format.
+            * 
+            * XXX Sendmail compatibility: sendmail 8 uses the reply as a format
+            * string; therefore any '%' characters in the reply are doubled.
+            * Postfix doesn't use replies as format strings; we replace '%%'
+            * by '%', and remove single (i.e. invalid) '%' characters.
             */
        case SMFIR_REPLYCODE:
            if (milter8_read_data(milter, data_size,
@@ -1097,6 +1106,15 @@ static const char *milter8_event(MILTER8 *milter, int event,
                milter8_conf_error(milter);
                return (milter->def_reply);
            }
+           if ((rp = cp = strchr(STR(milter->buf), '%')) != 0) {
+               for (;;) {
+                   if ((ch = *cp++) == '%')
+                       ch = *cp++;
+                   *rp++ = ch;
+                   if (ch == 0)
+                       break;
+               }
+           }
            if (IN_CONNECT_EVENT(event)) {
 #ifdef LIBMILTER_AUTO_DISCONNECT
                milter8_close_stream(milter);
index 70ea9a4c566df884fbf5d1cd7dff20fab545bc71..62c4bb6b322ef848d922d3705a12cb0e64a35dcd 100644 (file)
@@ -1,12 +1,12 @@
 # Reject with text 
-./test-milter -C 1 -a "554 5.7.1 Rejected" -c connect -p inet:9999@127.0.0.1
-./test-milter -C 1 -a "554 5.7.1 Rejected" -c helo -p inet:9999@127.0.0.1
-./test-milter -C 1 -a "554 5.7.1 Rejected" -c mail -p inet:9999@127.0.0.1
-./test-milter -C 1 -a "554 5.7.1 Rejected" -c rcpt -p inet:9999@127.0.0.1
-./test-milter -C 1 -a "554 5.7.1 Rejected" -c header -p inet:9999@127.0.0.1
-./test-milter -C 1 -a "554 5.7.1 Rejected" -c eoh -p inet:9999@127.0.0.1
-./test-milter -C 1 -a "554 5.7.1 Rejected" -c body -p inet:9999@127.0.0.1
-./test-milter -C 1 -a "554 5.7.1 Rejected" -c eom -p inet:9999@127.0.0.1
+./test-milter -C 1 -a "554 5.7.1 1% 2%% 3%%%" -c connect -p inet:9999@127.0.0.1
+./test-milter -C 1 -a "554 5.7.1 1% 2%% 3%%%" -c helo -p inet:9999@127.0.0.1
+./test-milter -C 1 -a "554 5.7.1 1% 2%% 3%%%" -c mail -p inet:9999@127.0.0.1
+./test-milter -C 1 -a "554 5.7.1 1% 2%% 3%%%" -c rcpt -p inet:9999@127.0.0.1
+./test-milter -C 1 -a "554 5.7.1 1% 2%% 3%%%" -c header -p inet:9999@127.0.0.1
+./test-milter -C 1 -a "554 5.7.1 1% 2%% 3%%%" -c eoh -p inet:9999@127.0.0.1
+./test-milter -C 1 -a "554 5.7.1 1% 2%% 3%%%" -c body -p inet:9999@127.0.0.1
+./test-milter -C 1 -a "554 5.7.1 1% 2%% 3%%%" -c eom -p inet:9999@127.0.0.1
 
 # Tempfail tests
 ./test-milter -C 1 -a tempfail -c connect -p inet:9999@127.0.0.1
index d617499d3a8ee753fb37da678a9d3ce64599ab13..ad76eb8001161f2ae31be85f95f1966818316c08 100644 (file)
@@ -328,30 +328,36 @@ int     main(int argc, char **argv)
                exit(1);
            }
            break;
-#ifdef SMFIR_INSHEADER
        case 'i':
+#ifdef SMFIR_INSHEADER
            if (ins_hdr) {
                fprintf(stderr, "too many -i options\n");
                exit(1);
            }
            parse_hdr_info(optarg, &ins_idx, &ins_hdr, &ins_val);
-           break;
+#else
+           fprintf(stderr, "no libmilter support to insert header\n");
+           exit(1);
 #endif
+           break;
        case 'p':
            if (smfi_setconn(optarg) == MI_FAILURE) {
                fprintf(stderr, "smfi_setconn failed\n");
                exit(1);
            }
            break;
-#ifdef SMFIR_CHGHEADER
        case 'r':
+#ifdef SMFIR_CHGHEADER
            if (chg_hdr) {
                fprintf(stderr, "too many -r options\n");
                exit(1);
            }
            parse_hdr_info(optarg, &chg_idx, &chg_hdr, &chg_val);
-           break;
+#else
+           fprintf(stderr, "no libmilter support to change header\n");
+           exit(1);
 #endif
+           break;
        case 'v':
            verbose++;
            break;