Prereq: "3.3.4" diff -ur --new-file /var/tmp/postfix-3.3.4/src/global/mail_version.h ./src/global/mail_version.h --- /var/tmp/postfix-3.3.4/src/global/mail_version.h 2019-03-30 10:37:46.000000000 -0400 +++ ./src/global/mail_version.h 2019-06-29 09:57:40.000000000 -0400 @@ -20,8 +20,8 @@ * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ -#define MAIL_RELEASE_DATE "20190330" -#define MAIL_VERSION_NUMBER "3.3.4" +#define MAIL_RELEASE_DATE "20190629" +#define MAIL_VERSION_NUMBER "3.3.5" #ifdef SNAPSHOT #define MAIL_VERSION_DATE "-" MAIL_RELEASE_DATE diff -ur --new-file /var/tmp/postfix-3.3.4/HISTORY ./HISTORY --- /var/tmp/postfix-3.3.4/HISTORY 2019-03-29 08:19:31.000000000 -0400 +++ ./HISTORY 2019-06-29 09:41:28.000000000 -0400 @@ -23448,3 +23448,31 @@ could exhaust LMTP server resources, resulting in two-second pauses between email deliveries. This problem was investigated by Juliana Rodrigueiro. File: smtp/smtp_connect.c. + +20190403 + + Bugfix (introduced: Postfix 2.3): a censoring filter broke + multiline Milter responses for header/body events. Problem + report by Andreas Thienemann. Files: util/printable.c, + util/stringops.h, smtpd/smtpd.c + + Bugfix (introduced: Postfix 3.3): "smtp_mx_address_limit = + 0" no longer meant 'unlimited'. Problem report by Luc Pardon. + File: smtp/smtp_addr.c. + +20190615 + + Workaround for implementations that hang Postfix while + shutting down a TLS session, until Postfix times out. With + "tls_fast_shutdown_enable = yes" (the default), Postfix no + longer waits for the TLS peer to respond to a TLS 'close' + request. This is recommended with TLSv1.0 and later. Files: + global/mail_params.h, tls/tls_session.c, and documentation. + +20190621 + + Bugfix (introduced: Postfix 3.0): the code to reset Postfix + SMTP server command counts was not called after a HaProxy + handshake failure, causing stale numbers to be reported. + The command counts are now reset in the function that reports + the counts. File: smtpd/smtpd.c. diff -ur --new-file /var/tmp/postfix-3.3.4/RELEASE_NOTES ./RELEASE_NOTES --- /var/tmp/postfix-3.3.4/RELEASE_NOTES 2018-02-11 11:09:16.000000000 -0500 +++ ./RELEASE_NOTES 2019-06-27 19:19:11.000000000 -0400 @@ -16,6 +16,16 @@ If you upgrade from Postfix 3.1 or earlier, read RELEASE_NOTES-3.2 before proceeding. +TLS Workaround for Postfix 3.4.6, 3.3.5, 3.2.10 and 3.1.13 +----------------------------------------------------------- + +This release introduces a workaround for implementations that hang +Postfix while shutting down a TLS session, until Postfix times out. +With "tls_fast_shutdown_enable = yes" (the default), Postfix no +longer waits for a remote TLS peer to respond to a TLS 'close' +request. This behavior is recommended with TLSv1.0 and later. Specify +"tls_fast_shutdown_enable = no" to get historical Postfix behavior. + License change --------------- diff -ur --new-file /var/tmp/postfix-3.3.4/html/lmtp.8.html ./html/lmtp.8.html --- /var/tmp/postfix-3.3.4/html/lmtp.8.html 2018-01-14 11:48:37.000000000 -0500 +++ ./html/lmtp.8.html 2019-06-29 19:12:53.000000000 -0400 @@ -573,6 +573,12 @@ nexthop destination security level is dane, but the MX record was found via an "insecure" MX lookup. + Introduced with Postfix 3.4.6, 3.3.5, 3.2.10, and 3.1.13: + + tls_fast_shutdown_enable (yes) + A workaround for implementations that hang Postfix while shuting + down a TLS session, until Postfix times out. + OBSOLETE STARTTLS CONTROLS The following configuration parameters exist for compatibility with Postfix versions before 2.3. Support for these will be removed in a diff -ur --new-file /var/tmp/postfix-3.3.4/html/postconf.5.html ./html/postconf.5.html --- /var/tmp/postfix-3.3.4/html/postconf.5.html 2018-11-10 19:40:42.000000000 -0500 +++ ./html/postconf.5.html 2019-06-29 09:33:56.000000000 -0400 @@ -17925,6 +17925,21 @@ +
A workaround for implementations that hang Postfix while shuting +down a TLS session, until Postfix times out. With this enabled, +Postfix will not wait for the remote TLS peer to respond to a TLS +'close' notification. This behavior is recommended for TLSv1.0 and +later.
+ +This feature was introduced with Postfix 3.4.6, 3.3.5, 3.2.10, +and 3.1.13.
+ + +This feature is available in Postfix 3.0 and later.
+%PARAM tls_fast_shutdown_enable yes + +A workaround for implementations that hang Postfix while shuting +down a TLS session, until Postfix times out. With this enabled, +Postfix will not wait for the remote TLS peer to respond to a TLS +'close' notification. This behavior is recommended for TLSv1.0 and +later.
+ +This feature was introduced with Postfix 3.4.6, 3.3.5, 3.2.10, +and 3.1.13.
+ %PARAM default_delivery_status_filter Optional filter to replace the delivery status code or explanatory
diff -ur --new-file /var/tmp/postfix-3.3.4/src/global/mail_params.h ./src/global/mail_params.h
--- /var/tmp/postfix-3.3.4/src/global/mail_params.h 2018-02-18 08:38:58.000000000 -0500
+++ ./src/global/mail_params.h 2019-06-27 19:11:36.000000000 -0400
@@ -3337,6 +3337,13 @@
extern bool var_tls_dane_taa_dgst;
/*
+ * The default is backwards-incompatible.
+ */
+#define VAR_TLS_FAST_SHUTDOWN "tls_fast_shutdown"
+#define DEF_TLS_FAST_SHUTDOWN 1
+extern bool var_tls_fast_shutdown;
+
+ /*
* Sendmail-style mail filter support.
*/
#define VAR_SMTPD_MILTERS "smtpd_milters"
diff -ur --new-file /var/tmp/postfix-3.3.4/src/smtp/smtp.c ./src/smtp/smtp.c
--- /var/tmp/postfix-3.3.4/src/smtp/smtp.c 2018-01-14 11:48:25.000000000 -0500
+++ ./src/smtp/smtp.c 2019-06-29 09:33:57.000000000 -0400
@@ -478,6 +478,11 @@
/* The TLS policy for MX hosts with "secure" TLSA records when the
/* nexthop destination security level is \fBdane\fR, but the MX
/* record was found via an "insecure" MX lookup.
+/* .PP
+/* Introduced with Postfix 3.4.6, 3.3.5, 3.2.10, and 3.1.13:
+/* .IP "\fBtls_fast_shutdown_enable (yes)\fR"
+/* A workaround for implementations that hang Postfix while shuting
+/* down a TLS session, until Postfix times out.
/* OBSOLETE STARTTLS CONTROLS
/* .ad
/* .fi
diff -ur --new-file /var/tmp/postfix-3.3.4/src/smtp/smtp_addr.c ./src/smtp/smtp_addr.c
--- /var/tmp/postfix-3.3.4/src/smtp/smtp_addr.c 2017-12-27 16:53:13.000000000 -0500
+++ ./src/smtp/smtp_addr.c 2019-04-03 18:03:38.000000000 -0400
@@ -623,7 +623,7 @@
if (var_smtp_rand_addr)
addr_list = dns_rr_shuffle(addr_list);
addr_list = dns_rr_sort(addr_list, SMTP_COMPARE_ADDR(misc_flags));
- if (var_smtp_balance_inet_proto)
+ if (var_smtp_mxaddr_limit > 0 && var_smtp_balance_inet_proto)
addr_list = smtp_balance_inet_proto(addr_list, misc_flags,
var_smtp_mxaddr_limit);
}
@@ -683,7 +683,7 @@
/* The following changes the order of equal-preference hosts. */
if (inet_proto_info()->ai_family_list[1] != 0)
addr_list = dns_rr_sort(addr_list, SMTP_COMPARE_ADDR(misc_flags));
- if (var_smtp_balance_inet_proto)
+ if (var_smtp_mxaddr_limit > 0 && var_smtp_balance_inet_proto)
addr_list = smtp_balance_inet_proto(addr_list, misc_flags,
var_smtp_mxaddr_limit);
}
diff -ur --new-file /var/tmp/postfix-3.3.4/src/smtpd/smtpd.c ./src/smtpd/smtpd.c
--- /var/tmp/postfix-3.3.4/src/smtpd/smtpd.c 2018-11-17 17:33:15.000000000 -0500
+++ ./src/smtpd/smtpd.c 2019-06-29 09:33:57.000000000 -0400
@@ -478,6 +478,11 @@
/* .IP "\fBtls_eecdh_auto_curves (see 'postconf -d' output)\fR"
/* The prioritized list of elliptic curves supported by the Postfix
/* SMTP client and server.
+/* .PP
+/* Introduced with Postfix 3.4.6, 3.3.5, 3.2.10, and 3.1.13:
+/* .IP "\fBtls_fast_shutdown_enable (yes)\fR"
+/* A workaround for implementations that hang Postfix while shuting
+/* down a TLS session, until Postfix times out.
/* OBSOLETE STARTTLS CONTROLS
/* .ad
/* .fi
@@ -3489,6 +3494,12 @@
if (vstream_ferror(state->cleanup))
state->err = CLEANUP_STAT_WRITE;
}
+
+#define IS_SMTP_REJECT(s) \
+ (((s)[0] == '4' || (s)[0] == '5') \
+ && ISDIGIT((s)[1]) && ISDIGIT((s)[2]) \
+ && ((s)[3] == '\0' || (s)[3] == ' ' || (s)[3] == '-'))
+
if (state->err == CLEANUP_STAT_OK)
if (rec_fputs(state->cleanup, REC_TYPE_END, "") < 0
|| vstream_fflush(state->cleanup))
@@ -3496,7 +3507,10 @@
if (state->err == 0) {
why = vstring_alloc(10);
state->err = mail_stream_finish(state->dest, why);
- printable(STR(why), ' ');
+ if (IS_SMTP_REJECT(STR(why)))
+ printable_except(STR(why), ' ', "\r\n");
+ else
+ printable(STR(why), ' ');
} else
mail_stream_cleanup(state->dest);
state->dest = 0;
@@ -3531,11 +3545,6 @@
*
* See also: qmqpd.c
*/
-#define IS_SMTP_REJECT(s) \
- (((s)[0] == '4' || (s)[0] == '5') \
- && ISDIGIT((s)[1]) && ISDIGIT((s)[2]) \
- && ((s)[3] == '\0' || (s)[3] == ' ' || (s)[3] == '-'))
-
if (state->err == CLEANUP_STAT_OK) {
state->error_count = 0;
state->error_mask = 0;
@@ -4997,15 +5006,6 @@
case 0:
/*
- * Reset the per-command counters.
- */
- for (cmdp = smtpd_cmd_table; /* see below */ ; cmdp++) {
- cmdp->success_count = cmdp->total_count = 0;
- if (cmdp->name == 0)
- break;
- }
-
- /*
* In TLS wrapper mode, turn on TLS using code that is shared with
* the STARTTLS command. This code does not return when the handshake
* fails.
@@ -5396,6 +5396,15 @@
}
/*
+ * Reset the per-command counters.
+ */
+ for (cmdp = smtpd_cmd_table; /* see below */ ; cmdp++) {
+ cmdp->success_count = cmdp->total_count = 0;
+ if (cmdp->name == 0)
+ break;
+ }
+
+ /*
* Log total numbers, so that logfile analyzers will see something even
* if the above loop produced no output. When no commands were received
* log "0/0" to simplify the identification of abnormal sessions: any
diff -ur --new-file /var/tmp/postfix-3.3.4/src/tls/Makefile.in ./src/tls/Makefile.in
--- /var/tmp/postfix-3.3.4/src/tls/Makefile.in 2017-02-05 18:36:29.000000000 -0500
+++ ./src/tls/Makefile.in 2019-06-25 08:34:24.000000000 -0400
@@ -431,6 +431,7 @@
tls_session.o: ../../include/argv.h
tls_session.o: ../../include/check_arg.h
tls_session.o: ../../include/dns.h
+tls_session.o: ../../include/mail_params.h
tls_session.o: ../../include/msg.h
tls_session.o: ../../include/myaddrinfo.h
tls_session.o: ../../include/mymalloc.h
diff -ur --new-file /var/tmp/postfix-3.3.4/src/tls/tls_misc.c ./src/tls/tls_misc.c
--- /var/tmp/postfix-3.3.4/src/tls/tls_misc.c 2018-11-17 17:33:15.000000000 -0500
+++ ./src/tls/tls_misc.c 2019-06-25 08:45:27.000000000 -0400
@@ -45,6 +45,7 @@
/* char *var_tls_mgr_service;
/* char *var_tls_tkt_cipher;
/* char *var_openssl_path;
+/* bool var_tls_fast_shutdown;
/*
/* TLS_APPL_STATE *tls_alloc_app_context(ssl_ctx, log_mask)
/* SSL_CTX *ssl_ctx;
@@ -285,6 +286,7 @@
char *var_tls_mgr_service;
char *var_tls_tkt_cipher;
char *var_openssl_path;
+bool var_tls_fast_shutdown;
#ifdef VAR_TLS_PREEMPT_CLIST
bool var_tls_preempt_clist;
@@ -739,6 +741,7 @@
VAR_TLS_DANE_TAA_DGST, DEF_TLS_DANE_TAA_DGST, &var_tls_dane_taa_dgst,
VAR_TLS_PREEMPT_CLIST, DEF_TLS_PREEMPT_CLIST, &var_tls_preempt_clist,
VAR_TLS_MULTI_WILDCARD, DEF_TLS_MULTI_WILDCARD, &var_tls_multi_wildcard,
+ VAR_TLS_FAST_SHUTDOWN, DEF_TLS_FAST_SHUTDOWN, &var_tls_fast_shutdown,
0,
};
static int init_done;
diff -ur --new-file /var/tmp/postfix-3.3.4/src/tls/tls_session.c ./src/tls/tls_session.c
--- /var/tmp/postfix-3.3.4/src/tls/tls_session.c 2008-01-07 20:21:49.000000000 -0500
+++ ./src/tls/tls_session.c 2019-06-25 08:34:24.000000000 -0400
@@ -66,6 +66,10 @@
#include