From eb73f242bb5ecd3ddf70142835e349c10a71c078 Mon Sep 17 00:00:00 2001
From: Wietse Venema Note that Postfix ≥ 3.4 server logging may also include a
+"to sni-name" element to record the use of an alternate
+server certificate chain for the connection in question. This happens
+when the client uses the TLS SNI extension, and the server selects
+a non-default certificate chain based on the client's SNI value:
+
+
+
+postfix/smtpd[process-id]:
+ Untrusted TLS connection established from client.example[192.0.2.1]
+ to server.example: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
+ key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
+ client-signature ECDSA (P-256) client-digest SHA256
+
+ What do "Anonymous", "Untrusted", etc. in
Postfix logging mean?
diff --git a/postfix/html/master.8.html b/postfix/html/master.8.html
index 66087d344..d00472d72 100644
--- a/postfix/html/master.8.html
+++ b/postfix/html/master.8.html
@@ -48,13 +48,17 @@ MASTER(8) MASTER(8)
cesses terminate at their convenience.
-i Enable init mode: do not become a session or process group
- leader; similar to -s, do not redirect stdout to /dev/null, so
- that "maillog_file = /dev/stdout" works. This mode is allowed
- only if the process ID equals 1.
+ leader; and similar to -s, do not redirect stdout to /dev/null,
+ so that "maillog_file = /dev/stdout" works. This mode is
+ allowed only if the process ID equals 1.
+
+ This feature is available in Postfix 3.3 and later.
-s Do not redirect stdout to /dev/null, so that "maillog_file =
/dev/stdout" works.
+ This feature is available in Postfix 3.4 and later.
+
-t Test mode. Return a zero exit status when the master.pid lock
file does not exist or when that file is not locked. This is
evidence that the master(8) daemon is not running.
diff --git a/postfix/html/postconf.5.html b/postfix/html/postconf.5.html
index 39550614f..7cb118e33 100644
--- a/postfix/html/postconf.5.html
+++ b/postfix/html/postconf.5.html
@@ -12867,7 +12867,8 @@ disabled except by also disabling "TLSv1" (typically leaving just
versions of Postfix ≥ 2.10 can explicitly disable support for
"TLSv1.1" or "TLSv1.2".
OpenSSL 1.1.1 introduces support for "TLSv1.3". With Postfix ≥ 3.4, +
OpenSSL 1.1.1 introduces support for "TLSv1.3". With Postfix +≥ 3.4 (or patch releases ≥ 3.0.14, 3.1.10, 3.2.7 and 3.3.2) this can be disabled, if need be, via "!TLSv1.3".
At the dane and @@ -13212,7 +13213,8 @@ and "TLSv1.2". The latest patch levels of Postfix ≥ 2.6, and all versions of Postfix ≥ 2.10 can explicitly disable support for "TLSv1.1" or "TLSv1.2"
-OpenSSL 1.1.1 introduces support for "TLSv1.3". With Postfix ≥ 3.4, +
OpenSSL 1.1.1 introduces support for "TLSv1.3". With Postfix +≥ 3.4 (or patch releases ≥ 3.0.14, 3.1.10, 3.2.7 and 3.3.2) this can be disabled, if need be, via "!TLSv1.3".
To include a protocol list its name, to exclude it, prefix the name @@ -17580,7 +17582,8 @@ disabled. The latest patch levels of Postfix ≥ 2.6, and all versions of Postfix ≥ 2.10 can disable support for "TLSv1.1" or "TLSv1.2".
-OpenSSL 1.1.1 introduces support for "TLSv1.3". With Postfix ≥ 3.4, +
OpenSSL 1.1.1 introduces support for "TLSv1.3". With Postfix +≥ 3.4 (or patch releases ≥ 3.0.14, 3.1.10, 3.2.7 and 3.3.2) this can be disabled, if need be, via "!TLSv1.3".
Example:
@@ -17614,7 +17617,8 @@ and "TLSv1.2". The latest patch levels of Postfix ≥ 2.6, and all versions of Postfix ≥ 2.10 can disable support for "TLSv1.1" or "TLSv1.2". -OpenSSL 1.1.1 introduces support for "TLSv1.3". With Postfix ≥ 3.4, +
OpenSSL 1.1.1 introduces support for "TLSv1.3". With Postfix +≥ 3.4 (or patch releases ≥ 3.0.14, 3.1.10, 3.2.7 and 3.3.2) this can be disabled, if need be, via "!TLSv1.3".
To include a protocol list its name, to exclude it, prefix the name @@ -18725,6 +18729,22 @@ ancestor domain prefixed with a leading dot. For internationalized domains, the lookup key must be in IDNA 2008 A-label form (as required in the TLS SNI extension).
+When this parameter is non-empty, the Postfix SMTP server enables +SNI extension processing, and logs SNI values that are invalid or +don't match an entry in the the specified tables. When an entry +does match, the SNI name is logged as part of the connection summary +at log levels 1 and higher.
+ +Note that the SNI lookup tables should also have entries for +the domains that correspond to the Postfix SMTP server's default +certificate(s). This ensures that the remote SMTP client's TLS SNI +extension gets a positive response when it specifies one of the +Postfix SMTP server's default domains, and ensures that the Postfix +SMTP server will not log an SNI name mismatch for such a domain. +The Postfix SMTP server's default certificates are then only used +when the client sends no SNI or when it sends SNI with a domain +that the server knows no certificate(s) for.
+The mapping from an SNI domain name to a certificate chain is typically indirect. In the input source files for "cdb", "hash", "btree" or other tables that are converted to on-disk indexed files diff --git a/postfix/man/man5/postconf.5 b/postfix/man/man5/postconf.5 index dd8ab8e44..d4a153d0b 100644 --- a/postfix/man/man5/postconf.5 +++ b/postfix/man/man5/postconf.5 @@ -8364,7 +8364,8 @@ disabled except by also disabling "TLSv1" (typically leaving just versions of Postfix >= 2.10 can explicitly disable support for "TLSv1.1" or "TLSv1.2". .PP -OpenSSL 1.1.1 introduces support for "TLSv1.3". With Postfix >= 3.4, +OpenSSL 1.1.1 introduces support for "TLSv1.3". With Postfix +>= 3.4 (or patch releases >= 3.0.14, 3.1.10, 3.2.7 and 3.3.2) this can be disabled, if need be, via "!TLSv1.3". .PP At the dane and @@ -8694,7 +8695,8 @@ and "TLSv1.2". The latest patch levels of Postfix >= 2.6, and all versions of Postfix >= 2.10 can explicitly disable support for "TLSv1.1" or "TLSv1.2" .PP -OpenSSL 1.1.1 introduces support for "TLSv1.3". With Postfix >= 3.4, +OpenSSL 1.1.1 introduces support for "TLSv1.3". With Postfix +>= 3.4 (or patch releases >= 3.0.14, 3.1.10, 3.2.7 and 3.3.2) this can be disabled, if need be, via "!TLSv1.3". .PP To include a protocol list its name, to exclude it, prefix the name @@ -12226,7 +12228,8 @@ disabled. The latest patch levels of Postfix >= 2.6, and all versions of Postfix >= 2.10 can disable support for "TLSv1.1" or "TLSv1.2". .PP -OpenSSL 1.1.1 introduces support for "TLSv1.3". With Postfix >= 3.4, +OpenSSL 1.1.1 introduces support for "TLSv1.3". With Postfix +>= 3.4 (or patch releases >= 3.0.14, 3.1.10, 3.2.7 and 3.3.2) this can be disabled, if need be, via "!TLSv1.3". .PP Example: @@ -12258,7 +12261,8 @@ and "TLSv1.2". The latest patch levels of Postfix >= 2.6, and all versions of Postfix >= 2.10 can disable support for "TLSv1.1" or "TLSv1.2". .PP -OpenSSL 1.1.1 introduces support for "TLSv1.3". With Postfix >= 3.4, +OpenSSL 1.1.1 introduces support for "TLSv1.3". With Postfix +>= 3.4 (or patch releases >= 3.0.14, 3.1.10, 3.2.7 and 3.3.2) this can be disabled, if need be, via "!TLSv1.3". .PP To include a protocol list its name, to exclude it, prefix the name @@ -13057,6 +13061,22 @@ ancestor domain prefixed with a leading dot. For internationalized domains, the lookup key must be in IDNA 2008 A\-label form (as required in the TLS SNI extension). .PP +When this parameter is non\-empty, the Postfix SMTP server enables +SNI extension processing, and logs SNI values that are invalid or +don't match an entry in the the specified tables. When an entry +does match, the SNI name is logged as part of the connection summary +at log levels 1 and higher. +.PP +Note that the SNI lookup tables should also have entries for +the domains that correspond to the Postfix SMTP server's default +certificate(s). This ensures that the remote SMTP client's TLS SNI +extension gets a positive response when it specifies one of the +Postfix SMTP server's default domains, and ensures that the Postfix +SMTP server will not log an SNI name mismatch for such a domain. +The Postfix SMTP server's default certificates are then only used +when the client sends no SNI or when it sends SNI with a domain +that the server knows no certificate(s) for. +.PP The mapping from an SNI domain name to a certificate chain is typically indirect. In the input source files for "cdb", "hash", "btree" or other tables that are converted to on\-disk indexed files diff --git a/postfix/man/man8/master.8 b/postfix/man/man8/master.8 index c6790ea4a..f8d0f12fe 100644 --- a/postfix/man/man8/master.8 +++ b/postfix/man/man8/master.8 @@ -45,12 +45,16 @@ Terminate the master process after \fIexit_time\fR seconds. Child processes terminate at their convenience. .IP \fB\-i\fR Enable \fBinit\fR mode: do not become a session or process -group leader; similar to \fB\-s\fR, do not redirect stdout +group leader; and similar to \fB\-s\fR, do not redirect stdout to /dev/null, so that "maillog_file = /dev/stdout" works. This mode is allowed only if the process ID equals 1. +.sp +This feature is available in Postfix 3.3 and later. .IP \fB\-s\fR Do not redirect stdout to /dev/null, so that "maillog_file = /dev/stdout" works. +.sp +This feature is available in Postfix 3.4 and later. .IP \fB\-t\fR Test mode. Return a zero exit status when the \fBmaster.pid\fR lock file does not exist or when that file is not locked. This is evidence diff --git a/postfix/proto/FORWARD_SECRECY_README.html b/postfix/proto/FORWARD_SECRECY_README.html index f549e4a1c..30fb5329d 100644 --- a/postfix/proto/FORWARD_SECRECY_README.html +++ b/postfix/proto/FORWARD_SECRECY_README.html @@ -576,6 +576,23 @@ postfix/smtpd[process-id]: +
Note that Postfix ≥ 3.4 server logging may also include a +"to sni-name" element to record the use of an alternate +server certificate chain for the connection in question. This happens +when the client uses the TLS SNI extension, and the server selects +a non-default certificate chain based on the client's SNI value: +
+ ++++postfix/smtpd[process-id]: + Untrusted TLS connection established from client.example[192.0.2.1] + to server.example: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) + key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 + client-signature ECDSA (P-256) client-digest SHA256 ++
OpenSSL 1.1.1 introduces support for "TLSv1.3". With Postfix ≥ 3.4, +
OpenSSL 1.1.1 introduces support for "TLSv1.3". With Postfix +≥ 3.4 (or patch releases ≥ 3.0.14, 3.1.10, 3.2.7 and 3.3.2) this can be disabled, if need be, via "!TLSv1.3".
At the dane and @@ -11471,7 +11472,8 @@ disabled. The latest patch levels of Postfix ≥ 2.6, and all versions of Postfix ≥ 2.10 can disable support for "TLSv1.1" or "TLSv1.2".
-OpenSSL 1.1.1 introduces support for "TLSv1.3". With Postfix ≥ 3.4, +
OpenSSL 1.1.1 introduces support for "TLSv1.3". With Postfix +≥ 3.4 (or patch releases ≥ 3.0.14, 3.1.10, 3.2.7 and 3.3.2) this can be disabled, if need be, via "!TLSv1.3".
Example:
@@ -12632,7 +12634,8 @@ and "TLSv1.2". The latest patch levels of Postfix ≥ 2.6, and all versions of Postfix ≥ 2.10 can explicitly disable support for "TLSv1.1" or "TLSv1.2" -OpenSSL 1.1.1 introduces support for "TLSv1.3". With Postfix ≥ 3.4, +
OpenSSL 1.1.1 introduces support for "TLSv1.3". With Postfix +≥ 3.4 (or patch releases ≥ 3.0.14, 3.1.10, 3.2.7 and 3.3.2) this can be disabled, if need be, via "!TLSv1.3".
To include a protocol list its name, to exclude it, prefix the name @@ -12667,7 +12670,8 @@ and "TLSv1.2". The latest patch levels of Postfix ≥ 2.6, and all versions of Postfix ≥ 2.10 can disable support for "TLSv1.1" or "TLSv1.2".
-OpenSSL 1.1.1 introduces support for "TLSv1.3". With Postfix ≥ 3.4, +
OpenSSL 1.1.1 introduces support for "TLSv1.3". With Postfix +≥ 3.4 (or patch releases ≥ 3.0.14, 3.1.10, 3.2.7 and 3.3.2) this can be disabled, if need be, via "!TLSv1.3".
To include a protocol list its name, to exclude it, prefix the name @@ -17435,6 +17439,22 @@ ancestor domain prefixed with a leading dot. For internationalized domains, the lookup key must be in IDNA 2008 A-label form (as required in the TLS SNI extension).
+When this parameter is non-empty, the Postfix SMTP server enables +SNI extension processing, and logs SNI values that are invalid or +don't match an entry in the the specified tables. When an entry +does match, the SNI name is logged as part of the connection summary +at log levels 1 and higher.
+ +Note that the SNI lookup tables should also have entries for +the domains that correspond to the Postfix SMTP server's default +certificate(s). This ensures that the remote SMTP client's TLS SNI +extension gets a positive response when it specifies one of the +Postfix SMTP server's default domains, and ensures that the Postfix +SMTP server will not log an SNI name mismatch for such a domain. +The Postfix SMTP server's default certificates are then only used +when the client sends no SNI or when it sends SNI with a domain +that the server knows no certificate(s) for.
+ The mapping from an SNI domain name to a certificate chain is
typically indirect. In the input source files for "cdb", "hash",
"btree" or other tables that are converted to on-disk indexed files
diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h
index 5bbc46706..ade3ae960 100644
--- a/postfix/src/global/mail_version.h
+++ b/postfix/src/global/mail_version.h
@@ -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 "20190201"
+#define MAIL_RELEASE_DATE "20190202"
#define MAIL_VERSION_NUMBER "3.4"
#ifdef SNAPSHOT
diff --git a/postfix/src/master/master.c b/postfix/src/master/master.c
index dbe880964..1a4173b8c 100644
--- a/postfix/src/master/master.c
+++ b/postfix/src/master/master.c
@@ -39,12 +39,16 @@
/* processes terminate at their convenience.
/* .IP \fB-i\fR
/* Enable \fBinit\fR mode: do not become a session or process
-/* group leader; similar to \fB-s\fR, do not redirect stdout
+/* group leader; and similar to \fB-s\fR, do not redirect stdout
/* to /dev/null, so that "maillog_file = /dev/stdout" works.
/* This mode is allowed only if the process ID equals 1.
+/* .sp
+/* This feature is available in Postfix 3.3 and later.
/* .IP \fB-s\fR
/* Do not redirect stdout to /dev/null, so that "maillog_file
/* = /dev/stdout" works.
+/* .sp
+/* This feature is available in Postfix 3.4 and later.
/* .IP \fB-t\fR
/* Test mode. Return a zero exit status when the \fBmaster.pid\fR lock
/* file does not exist or when that file is not locked. This is evidence
diff --git a/postfix/src/postlogd/postlogd.c b/postfix/src/postlogd/postlogd.c
index 5461e1a97..047307f7c 100644
--- a/postfix/src/postlogd/postlogd.c
+++ b/postfix/src/postlogd/postlogd.c
@@ -241,6 +241,14 @@ int main(int argc, char **argv)
*/
MAIL_VERSION_STAMP_ALLOCATE;
+ /*
+ * This is a datagram service, not a stream service, so that postlogd can
+ * restart immediately after "postfix reload" without requiring clients
+ * to resend messages. Those messages remain queued in the kernel until a
+ * new postlogd process retrieves them. It would be unreasonable to
+ * require that clients retransmit logs, especially in the case of a
+ * fatal or panic error.
+ */
dgram_server_main(argc, argv, postlogd_service,
CA_MAIL_SERVER_TIME_TABLE(time_table),
CA_MAIL_SERVER_PRE_INIT(pre_jail_init),
diff --git a/postfix/src/tls/tls.h b/postfix/src/tls/tls.h
index 24e3a043b..6c10d4ad7 100644
--- a/postfix/src/tls/tls.h
+++ b/postfix/src/tls/tls.h
@@ -247,6 +247,7 @@ typedef struct {
/* Public, read-only. */
char *peer_CN; /* Peer Common Name */
char *issuer_CN; /* Issuer Common Name */
+ char *peer_sni; /* SNI sent to or by the peer */
char *peer_cert_fprint; /* ASCII certificate fingerprint */
char *peer_pkey_fprint; /* ASCII public key fingerprint */
int peer_status; /* Certificate and match status */
diff --git a/postfix/src/tls/tls_client.c b/postfix/src/tls/tls_client.c
index bb9412539..cfc0aca47 100644
--- a/postfix/src/tls/tls_client.c
+++ b/postfix/src/tls/tls_client.c
@@ -1042,6 +1042,13 @@ TLS_SESS_STATE *tls_client_start(const TLS_CLIENT_START_PROPS *props)
tls_free_context(TLScontext);
return (0);
}
+ /*
+ * The saved value is not presently used client-side, but could later
+ * be logged if acked by the server (requires new client-side callback
+ * to detect the ack). For now this just maintains symmetry with the
+ * server code, where do record the received SNI for logging.
+ */
+ TLScontext->peer_sni = mystrdup(sni);
if (log_mask & TLS_LOG_DEBUG)
msg_info("%s: SNI hostname: %s", props->namaddr, sni);
}
diff --git a/postfix/src/tls/tls_misc.c b/postfix/src/tls/tls_misc.c
index 5489d3236..51cbd3530 100644
--- a/postfix/src/tls/tls_misc.c
+++ b/postfix/src/tls/tls_misc.c
@@ -793,19 +793,27 @@ void tls_pre_jail_init(TLS_ROLE role)
static int server_sni_callback(SSL *ssl, int *alert, void *arg)
{
SSL_CTX *sni_ctx = (SSL_CTX *) arg;
+ TLS_SESS_STATE *TLScontext = SSL_get_ex_data(ssl, TLScontext_index);
const char *sni = SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name);
+ const char *cp = sni;
const char *pem;
- if (!sni_ctx || !tls_server_sni_maps
- || !sni || !*sni || !valid_hostname(sni, DONT_GRIPE))
+ /* SNI is silently ignored when we don't care or is NULL or empty */
+ if (!sni_ctx || !tls_server_sni_maps || !sni || !*sni)
return SSL_TLSEXT_ERR_NOACK;
+ if (!valid_hostname(sni, DONT_GRIPE)) {
+ msg_warn("TLS SNI from %s is invalid: %s",
+ TLScontext->namaddr, sni);
+ return SSL_TLSEXT_ERR_NOACK;
+ }
+
do {
/* Don't silently skip maps opened with the wrong flags. */
- pem = maps_file_find(tls_server_sni_maps, sni, 0);
+ pem = maps_file_find(tls_server_sni_maps, cp, 0);
} while (!pem
&& !tls_server_sni_maps->error
- && (sni = strchr(sni + 1, '.')) != 0);
+ && (cp = strchr(cp + 1, '.')) != 0);
if (!pem) {
if (tls_server_sni_maps->error) {
@@ -814,6 +822,14 @@ static int server_sni_callback(SSL *ssl, int *alert, void *arg)
*alert = SSL_AD_INTERNAL_ERROR;
return SSL_TLSEXT_ERR_ALERT_FATAL;
}
+ msg_info("TLS SNI %s from %s not matched, using default chain",
+ sni, TLScontext->namaddr);
+ /*
+ * XXX: We could lie and pretend to accept the name, but since we've
+ * previously not impemented the callback (with OpenSSL then declining
+ * the extension), and nothing bad happened, declining it explicitly
+ * should be safe.
+ */
return SSL_TLSEXT_ERR_NOACK;
}
SSL_set_SSL_CTX(ssl, sni_ctx);
@@ -822,6 +838,7 @@ static int server_sni_callback(SSL *ssl, int *alert, void *arg)
*alert = SSL_AD_INTERNAL_ERROR;
return SSL_TLSEXT_ERR_ALERT_FATAL;
}
+ TLScontext->peer_sni = mystrdup(sni);
return SSL_TLSEXT_ERR_OK;
}
@@ -1101,15 +1118,23 @@ void tls_log_summary(TLS_ROLE role, TLS_USAGE usage, TLS_SESS_STATE *ctx)
{
VSTRING *msg = vstring_alloc(100);
const char *direction = (role == TLS_ROLE_CLIENT) ? "to" : "from";
+ const char *sni = (role == TLS_ROLE_CLIENT) ? 0 : ctx->peer_sni;
- vstring_sprintf(msg, "%s TLS connection %s %s %s: %s"
+ /*
+ * When SNI was sent and accepted, the server-side log message now includes
+ * a "to