From: Wietse Venema This document describes the Postfix connection cache implementation,
which is available with Postfix version 2.2 and later. See Client-side TLS
+connection reuse for how this connection cache is used to
+implement multiple deliveries per TLS-encrypted connection. Topics covered in this document:
diff --git a/postfix/html/TLS_README.html b/postfix/html/TLS_README.html
index c732b4f34..fecd87884 100644
--- a/postfix/html/TLS_README.html
+++ b/postfix/html/TLS_README.html
@@ -992,6 +992,8 @@ solution.
Historically, the Postfix SMTP client has supported multiple +deliveries per connection only for plaintext connections. Postfix +3.4 introduces the ability to make multiple deliveries per TLS-encrypted +connection. This is primarily to improve mail delivery performance +for destinations that throttle clients when they don't combine +deliveries.
+ +To enable multiple deliveries per TLS connection, specify:
+ +++ ++/etc/postfix/main.cf: + smtp_tls_connection_reuse = yes ++
Alternatively, specify the attribute "connection_reuse=yes" in +an smtp_tls_policy_maps entry.
+ +The implementation of TLS connection reuse relies on the same +scache(8) service as used for delivering plaintext SMTP mail, the +same tlsproxy(8) daemon as used by the postscreen(8) service, and +relies on the same hints from the qmgr(8) daemon. + +See "Postfix Connection +Cache" for a description of the underlying connection reuse +infrastructure.
+ +Initial SMTP handshake:
+smtp(8) -> remote SMTP server+ +
Reused SMTP/TLS connection, or new SMTP/TLS connection:
+smtp(8) -> tlsproxy(8) -> remote SMTP server+ +
Cached SMTP/TLS connection:
+scache(8) -> tlsproxy(8) -> remote SMTP server+ +
As of Postfix 3.4, TLS connection reuse is disabled by default. +This may change once the impact on over-all performance is undestood. +
+The remote SMTP server and the Postfix SMTP client negotiate a diff --git a/postfix/html/lmtp.8.html b/postfix/html/lmtp.8.html index e5e0259c7..d1fc23ea6 100644 --- a/postfix/html/lmtp.8.html +++ b/postfix/html/lmtp.8.html @@ -573,6 +573,11 @@ SMTP(8) SMTP(8) nexthop destination security level is dane, but the MX record was found via an "insecure" MX lookup. + Available in Postfix version 3.4 and later: + + smtp_tls_connection_reuse (no) + Try to make multiple deliveries per TLS connection. + OBSOLETE STARTTLS CONTROLS The following configuration parameters exist for compatibility with Postfix versions before 2.3. Support for these will be removed in a @@ -704,6 +709,11 @@ SMTP(8) SMTP(8) that an SMTP session may be reused before it is closed, or zero (no limit). + Available in Postfix version 3.4 and later: + + smtp_tls_connection_reuse (no) + Try to make multiple deliveries per TLS connection. + Implemented in the qmgr(8) daemon: transport_destination_concurrency_limit ($default_destination_concur- diff --git a/postfix/html/postconf.5.html b/postfix/html/postconf.5.html index a631ad157..70408037b 100644 --- a/postfix/html/postconf.5.html +++ b/postfix/html/postconf.5.html @@ -5184,6 +5184,17 @@ parameter. See there for details.
This feature is available in Postfix 2.6 and later.
+ + +The LMTP-specific version of the smtp_tls_connection_reuse configuration +parameter. See there for details.
+ +This feature is available in Postfix 3.4 and later.
+ +Try to make multiple deliveries per TLS connection. This uses +the tlsproxy(8) service to make an outbound SMTP-over-TLS connection, +uses the scache(8) service to save that connection, and relies on +hints from the qmgr(8) daemon.
+ +See "Client-side +TLS connection reuse" for background details.
+ +This feature is available in Postfix 3.4 and later.
+ +The LMTP-specific version of the smtp_use_tlsproxy configuration -parameter. See there for details.
- -This feature is available in Postfix 3.4 and later.
- -This document describes the Postfix connection cache implementation, which is available with Postfix version 2.2 and later.
+See Client-side TLS +connection reuse for how this connection cache is used to +implement multiple deliveries per TLS-encrypted connection.
+Topics covered in this document:
Historically, the Postfix SMTP client has supported multiple +deliveries per connection only for plaintext connections. Postfix +3.4 introduces the ability to make multiple deliveries per TLS-encrypted +connection. This is primarily to improve mail delivery performance +for destinations that throttle clients when they don't combine +deliveries.
+ +To enable multiple deliveries per TLS connection, specify:
+ +++ ++/etc/postfix/main.cf: + smtp_tls_connection_reuse = yes ++
Alternatively, specify the attribute "connection_reuse=yes" in +an smtp_tls_policy_maps entry.
+ +The implementation of TLS connection reuse relies on the same +scache(8) service as used for delivering plaintext SMTP mail, the +same tlsproxy(8) daemon as used by the postscreen(8) service, and +relies on the same hints from the qmgr(8) daemon. + +See "Postfix Connection +Cache" for a description of the underlying connection reuse +infrastructure.
+ +Initial SMTP handshake:
+smtp(8) -> remote SMTP server+ +
Reused SMTP/TLS connection, or new SMTP/TLS connection:
+smtp(8) -> tlsproxy(8) -> remote SMTP server+ +
Cached SMTP/TLS connection:
+scache(8) -> tlsproxy(8) -> remote SMTP server+ +
As of Postfix 3.4, TLS connection reuse is disabled by default. +This may change once the impact on over-all performance is undestood. +
+The remote SMTP server and the Postfix SMTP client negotiate a diff --git a/postfix/proto/postconf.proto b/postfix/proto/postconf.proto index 76670568e..1c5adadb6 100644 --- a/postfix/proto/postconf.proto +++ b/postfix/proto/postconf.proto @@ -11050,11 +11050,13 @@ security are:
This feature is available in Postfix 3.0 and later.
-%PARAM smtp_use_tlsproxy no +%PARAM smtp_tls_connection_reuse no -Try to use a TLS session multiple times, without reconnecting. -This uses the tlsproxy(8) service to make an outbound SMTP-over-TLS -connection, and uses the sache(8) service to save that connection. -
+Try to make multiple deliveries per TLS connection. This uses +the tlsproxy(8) service to make an outbound SMTP-over-TLS connection, +uses the scache(8) service to save that connection, and relies on +hints from the qmgr(8) daemon.
+ +See "Client-side +TLS connection reuse" for background details.
This feature is available in Postfix 3.4 and later.
-%PARAM smtp_use_tlsproxy no +%PARAM lmtp_tls_connection_reuse no -The LMTP-specific version of the smtp_use_tlsproxy configuration +
The LMTP-specific version of the smtp_tls_connection_reuse configuration parameter. See there for details.
This feature is available in Postfix 3.4 and later.
diff --git a/postfix/src/global/mail_params.h b/postfix/src/global/mail_params.h index 31843dfca..211d7cf74 100644 --- a/postfix/src/global/mail_params.h +++ b/postfix/src/global/mail_params.h @@ -4011,11 +4011,11 @@ extern char *var_smtpd_dns_re_filter; /* * Share TLS sessions through tlproxy(8). */ -#define VAR_SMTP_USE_TLSPROXY "smtp_use_tlsproxy" -#define DEF_SMTP_USE_TLSPROXY 0 -#define VAR_LMTP_USE_TLSPROXY "lmtp_use_tlsproxy" -#define DEF_LMTP_USE_TLSPROXY 0 -extern bool var_smtp_use_tlsproxy; +#define VAR_SMTP_TLS_CONN_REUSE "smtp_tls_connection_reuse" +#define DEF_SMTP_TLS_CONN_REUSE 0 +#define VAR_LMTP_TLS_CONN_REUSE "lmtp_tls_connection_reuse" +#define DEF_LMTP_TLS_CONN_REUSE 0 +extern bool var_smtp_tls_conn_reuse; /* * Location of shared-library files. diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index ae82be407..ba4b10588 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 "20180603" +#define MAIL_RELEASE_DATE "20180605" #define MAIL_VERSION_NUMBER "3.4" #ifdef SNAPSHOT diff --git a/postfix/src/smtp/lmtp_params.c b/postfix/src/smtp/lmtp_params.c index d057195d4..c4e16966b 100644 --- a/postfix/src/smtp/lmtp_params.c +++ b/postfix/src/smtp/lmtp_params.c @@ -109,7 +109,7 @@ VAR_LMTP_CACHE_DEMAND, DEF_LMTP_CACHE_DEMAND, &var_smtp_cache_demand, VAR_LMTP_USE_TLS, DEF_LMTP_USE_TLS, &var_smtp_use_tls, VAR_LMTP_ENFORCE_TLS, DEF_LMTP_ENFORCE_TLS, &var_smtp_enforce_tls, - VAR_LMTP_USE_TLSPROXY, DEF_LMTP_USE_TLSPROXY, &var_smtp_use_tlsproxy, + VAR_LMTP_TLS_CONN_REUSE, DEF_LMTP_TLS_CONN_REUSE, &var_smtp_tls_conn_reuse, #ifdef USE_TLS VAR_LMTP_TLS_ENFORCE_PN, DEF_LMTP_TLS_ENFORCE_PN, &var_smtp_tls_enforce_peername, VAR_LMTP_TLS_NOTEOFFER, DEF_LMTP_TLS_NOTEOFFER, &var_smtp_tls_note_starttls_offer, diff --git a/postfix/src/smtp/smtp.c b/postfix/src/smtp/smtp.c index bbd039972..8432f42eb 100644 --- a/postfix/src/smtp/smtp.c +++ b/postfix/src/smtp/smtp.c @@ -478,6 +478,10 @@ /* 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 +/* Available in Postfix version 3.4 and later: +/* .IP "\fBsmtp_tls_connection_reuse (no)\fR" +/* Try to make multiple deliveries per TLS connection. /* OBSOLETE STARTTLS CONTROLS /* .ad /* .fi @@ -584,6 +588,10 @@ /* that an SMTP session may be reused before it is closed, or zero (no /* limit). /* .PP +/* Available in Postfix version 3.4 and later: +/* .IP "\fBsmtp_tls_connection_reuse (no)\fR" +/* Try to make multiple deliveries per TLS connection. +/* .PP /* Implemented in the qmgr(8) daemon: /* .IP "\fBtransport_destination_concurrency_limit ($default_destination_concurrency_limit)\fR" /* A transport-specific override for the @@ -896,7 +904,7 @@ bool var_smtp_enforce_tls; char *var_smtp_tls_per_site; char *var_smtp_tls_policy; bool var_smtp_tls_wrappermode; -bool var_smtp_use_tlsproxy; +bool var_smtp_tls_conn_reuse; char *var_tlsproxy_service; #ifdef USE_TLS diff --git a/postfix/src/smtp/smtp.h b/postfix/src/smtp/smtp.h index 27e7a8612..041745f5d 100644 --- a/postfix/src/smtp/smtp.h +++ b/postfix/src/smtp/smtp.h @@ -103,6 +103,7 @@ typedef struct SMTP_TLS_POLICY { ARGV *matchargv; /* Cert match patterns */ DSN_BUF *why; /* Lookup error status */ TLS_DANE *dane; /* DANE TLSA digests */ + int conn_reuse; /* enable connection reuse */ } SMTP_TLS_POLICY; /* @@ -136,6 +137,7 @@ extern void smtp_tls_policy_cache_flush(void); _tls_policy_init_tmp->matchargv = 0; \ _tls_policy_init_tmp->why = (w); \ _tls_policy_init_tmp->dane = 0; \ + _tls_policy_init_tmp->conn_reuse = 0; \ } while (0) #endif diff --git a/postfix/src/smtp/smtp_connect.c b/postfix/src/smtp/smtp_connect.c index 7fb8e168a..abccb57c9 100644 --- a/postfix/src/smtp/smtp_connect.c +++ b/postfix/src/smtp/smtp_connect.c @@ -672,14 +672,11 @@ static int smtp_reuse_session(SMTP_STATE *state, DNS_RR **addr_list, * for connection-cache lookup by request nexthop only. */ #ifdef USE_TLS - if (var_smtp_use_tlsproxy) { - if (!smtp_tls_policy_cache_query(why, state->tls, iter)) { - msg_warn("TLS policy lookup error for %s/%s: %s", - STR(iter->dest), STR(iter->host), STR(why->reason)); - return (0); /* XXX */ - } - } else - smtp_tls_policy_dummy(state->tls); + if (!smtp_tls_policy_cache_query(why, state->tls, iter)) { + msg_warn("TLS policy lookup error for %s/%s: %s", + STR(iter->dest), STR(iter->host), STR(why->reason)); + return (0); /* XXX */ + } #endif SMTP_ITER_SAVE_DEST(state->iterator); if (*addr_list && SMTP_RCPT_LEFT(state) > 0 diff --git a/postfix/src/smtp/smtp_params.c b/postfix/src/smtp/smtp_params.c index 7fef9e707..198119e10 100644 --- a/postfix/src/smtp/smtp_params.c +++ b/postfix/src/smtp/smtp_params.c @@ -113,7 +113,7 @@ VAR_SMTP_CACHE_DEMAND, DEF_SMTP_CACHE_DEMAND, &var_smtp_cache_demand, VAR_SMTP_USE_TLS, DEF_SMTP_USE_TLS, &var_smtp_use_tls, VAR_SMTP_ENFORCE_TLS, DEF_SMTP_ENFORCE_TLS, &var_smtp_enforce_tls, - VAR_SMTP_USE_TLSPROXY, DEF_SMTP_USE_TLSPROXY, &var_smtp_use_tlsproxy, + VAR_SMTP_TLS_CONN_REUSE, DEF_SMTP_TLS_CONN_REUSE, &var_smtp_tls_conn_reuse, #ifdef USE_TLS VAR_SMTP_TLS_ENFORCE_PN, DEF_SMTP_TLS_ENFORCE_PN, &var_smtp_tls_enforce_peername, VAR_SMTP_TLS_NOTEOFFER, DEF_SMTP_TLS_NOTEOFFER, &var_smtp_tls_note_starttls_offer, diff --git a/postfix/src/smtp/smtp_proto.c b/postfix/src/smtp/smtp_proto.c index 44c9a4d2e..ea55b5b28 100644 --- a/postfix/src/smtp/smtp_proto.c +++ b/postfix/src/smtp/smtp_proto.c @@ -864,7 +864,7 @@ static int smtp_start_tls(SMTP_STATE *state) * SMTP connection either, because the conversation is in an unknown * state. */ - if (var_smtp_use_tlsproxy == 0) + if (state->tls->conn_reuse == 0) DONT_CACHE_THIS_SESSION; /* @@ -898,7 +898,7 @@ static int smtp_start_tls(SMTP_STATE *state) | SMTP_KEY_FLAG_HOSTNAME | SMTP_KEY_FLAG_ADDR); - if (var_smtp_use_tlsproxy) { + if (state->tls->conn_reuse) { /* * Send all our wishes in one big request. @@ -978,7 +978,7 @@ static int smtp_start_tls(SMTP_STATE *state) */ session->tls_context = tls_proxy_context_receive(session->stream); } - } else { /* var_smtp_tls_proxy */ + } else { /* state->tls->conn_reuse */ /* * As of Postfix 2.5, tls_client_start() tries hard to always @@ -1012,7 +1012,7 @@ static int smtp_start_tls(SMTP_STATE *state) matchargv = state->tls->matchargv, mdalg = var_smtp_tls_fpt_dgst, dane = state->tls->dane); - } /* var_smtp_use_tlsproxy */ + } /* state->tls->conn_reuse */ vstring_free(serverid); diff --git a/postfix/src/smtp/smtp_session.c b/postfix/src/smtp/smtp_session.c index 594567f78..9fa8cd285 100644 --- a/postfix/src/smtp/smtp_session.c +++ b/postfix/src/smtp/smtp_session.c @@ -183,7 +183,7 @@ void smtp_session_free(SMTP_SESSION *session) vstream_fflush(session->stream); } if (session->tls_context) { - if (var_smtp_use_tlsproxy) + if (session->state->tls->conn_reuse) tls_proxy_context_free(session->tls_context); else tls_client_stop(smtp_tls_ctx, session->stream, diff --git a/postfix/src/smtp/smtp_tls_policy.c b/postfix/src/smtp/smtp_tls_policy.c index 9dfc41896..3a80f2fc3 100644 --- a/postfix/src/smtp/smtp_tls_policy.c +++ b/postfix/src/smtp/smtp_tls_policy.c @@ -356,6 +356,18 @@ static void tls_policy_lookup_one(SMTP_TLS_POLICY *tls, int *site_level, } continue; } + /* Last one wins. */ + if (!strcasecmp(name, "connection_reuse")) { + if (strcasecmp(val, "yes") == 0) { + tls->conn_reuse = 1; + } else if (strcasecmp(val, "no") == 0) { + tls->conn_reuse = 0; + } else { + msg_warn("%s: attribute \"%s\" has bad value: \"%s\"", + WHERE, name, val); + INVALID_RETURN(tls->why, site_level); + } + } msg_warn("%s: invalid attribute name: \"%s\"", WHERE, name); INVALID_RETURN(tls->why, site_level); } @@ -483,6 +495,7 @@ static void *policy_create(const char *unused_key, void *context) SMTP_TLS_POLICY *tls = (SMTP_TLS_POLICY *) mymalloc(sizeof(*tls)); smtp_tls_policy_init(tls, dsb_create()); + tls->conn_reuse = var_smtp_tls_conn_reuse; /* * Compute the per-site TLS enforcement level. For compatibility with the diff --git a/postfix/src/tlsproxy/tlsproxy.c b/postfix/src/tlsproxy/tlsproxy.c index ecfb149df..dc9e6ec91 100644 --- a/postfix/src/tlsproxy/tlsproxy.c +++ b/postfix/src/tlsproxy/tlsproxy.c @@ -6,11 +6,12 @@ /* SYNOPSIS /* \fBtlsproxy\fR [generic Postfix daemon options] /* DESCRIPTION -/* The \fBtlsproxy\fR(8) server implements a server-side TLS -/* proxy. It is used by \fBpostscreen\fR(8) to talk SMTP-over-TLS +/* The \fBtlsproxy\fR(8) server implements a two-way TLS proxy. It +/* is used by the \fBpostscreen\fR(8) server to talk SMTP-over-TLS /* with remote SMTP clients that are not whitelisted (including -/* clients whose whitelist status has expired), -/* but it should also work for non-SMTP protocols. +/* clients whose whitelist status has expired), and by the +/* \fBsmtp\fR(8) client to support TLS connection reuse, but it +/* should also work for non-SMTP protocols. /* /* Although one \fBtlsproxy\fR(8) process can serve multiple /* sessions at the same time, it is a good idea to allow the @@ -364,7 +365,7 @@ static HTABLE *tlsp_client_app_cache; * become part of the TLS library. * * Later in the life cycle, tlsproxy(8) has also become an enabler for TLS - * session reuse across different SMTP client processes. + * connection reuse across different SMTP client processes. */ static void tlsp_ciphertext_event(int, void *); @@ -484,8 +485,8 @@ static int tlsp_post_handshake(TLSP_STATE *state) { /* - * Currently, tls_server_post_accept() and tls_client_post_connect() - * always succeed. + * Do not assume that tls_server_post_accept() and + * tls_client_post_connect() will always succeed. */ if (state->is_server_role) state->tls_context = tls_server_post_accept(state->tls_context); @@ -560,6 +561,7 @@ static void tlsp_strategy(TLSP_STATE *state) } state->flags &= ~TLSP_FLAG_DO_HANDSHAKE; if (tlsp_post_handshake(state) != TLSP_STAT_OK) { + /* At this point, state is a dangling pointer. */ return; } } @@ -650,6 +652,7 @@ static void tlsp_strategy(TLSP_STATE *state) */ if (tlsp_eval_tls_error(state, ssl_write_err != SSL_ERROR_NONE ? ssl_write_err : ssl_read_err) < 0) + /* At this point, state is a dangling pointer. */ return; /* @@ -705,6 +708,7 @@ static void tlsp_plaintext_event(int event, void *context) * want to read or write more plaintext. */ tlsp_strategy(state); + /* At this point, state could be a dangling pointer. */ } /* tlsp_ciphertext_event - ciphertext is ready to read/write */ @@ -720,6 +724,7 @@ static void tlsp_ciphertext_event(int event, void *context) */ if (event == EVENT_READ || event == EVENT_WRITE) { tlsp_strategy(state); + /* At this point, state could be a dangling pointer. */ } else { if (event == EVENT_TIME && state->ssl_last_err == SSL_ERROR_NONE) msg_warn("deadlock on plaintext stream for %s", @@ -837,7 +842,7 @@ static void tlsp_accept_event(int event, EVENT_NOTIFY_FN handler, event_cancel_timer(handler, context); else errno = ETIMEDOUT; - /* tlsp_state_free() disables pre-handshake I/O events. */ + /* tlsp_state_free() disables pre-handshake plaintext I/O events. */ } /* tlsp_get_fd_event - receive final connection hand-off information */ @@ -850,8 +855,10 @@ static void tlsp_get_fd_event(int event, void *context) int status; /* - * Disable I/O events on the plaintext stream until the TLS handshake is - * completed. + * At this point we still manually manage plaintext read/write/timeout + * events. Disable I/O events on the plaintext stream until the TLS + * handshake is completed. Every code path must either destroy state, or + * request the next event, otherwise we have a file and memory leak. */ tlsp_accept_event(event, tlsp_get_fd_event, (void *) state); event_disable_readwrite(plaintext_fd); @@ -879,12 +886,14 @@ static void tlsp_get_fd_event(int event, void *context) else status = tlsp_client_start_pre_handshake(state); if (status != TLSP_STAT_OK) + /* At this point, state is a dangling pointer. */ return; /* * Trigger the initial proxy server I/Os. */ tlsp_strategy(state); + /* At this point, state could be a dangling pointer. */ } /* @@ -909,9 +918,22 @@ static int tlsp_client_init_no_tlsp_state_free(TLSP_STATE *state) if ((state->appl_state = (TLS_APPL_STATE *) htable_find(tlsp_client_app_cache, key)) == 0 && (state->appl_state = - tls_client_init(state->client_init_props)) != 0) + tls_client_init(state->client_init_props)) != 0) { (void) htable_enter(tlsp_client_app_cache, key, (void *) state->appl_state); + + /* + * To maintain sanity, allow partial SSL_write() operations, and + * allow SSL_write() buffer pointers to change after a WANT_READ or + * WANT_WRITE result. This is based on OpenSSL developers talking on + * a mailing list, but is not supported by documentation. If this + * code stops working then no-one can be held responsible. + */ + if (state->appl_state) + SSL_CTX_set_mode(state->appl_state->ssl_ctx, + SSL_MODE_ENABLE_PARTIAL_WRITE + | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER); + } vstring_free(buf); return (state->appl_state != 0); } @@ -942,7 +964,9 @@ static void tlsp_get_request_event(int event, void *context) /* * At this point we still manually manage plaintext read/write/timeout - * events. + * events. Every code path must either destroy state or request the next + * event, otherwise this pseudo-thread is idle until the client goes + * away. */ tlsp_accept_event(event, tlsp_get_request_event, (void *) state); @@ -955,9 +979,8 @@ static void tlsp_get_request_event(int event, void *context) } /* - * We must send some data, after receiving the request attributes and - * before receiving the remote file descriptor. We can't assume - * UNIX-domain socket semantics here. + * Receive the initial request attributes. Receive the remainder after we + * figure out what role we are expected to play. */ if (event != EVENT_READ || attr_scan(plaintext_stream, ATTR_FLAG_STRICT, @@ -975,7 +998,8 @@ static void tlsp_get_request_event(int event, void *context) * XXX We use the same fixed timeout throughout the entire session for * both plaintext and ciphertext communication. This timeout is just a * safety feature; the real timeout will be enforced by our plaintext - * peer. + * peer (except during TLS the handshake, when we intentionally disable + * plaintext I/O). */ state->remote_endpt = mystrdup(STR(remote_endpt)); state->server_id = mystrdup(STR(server_id)); @@ -989,8 +1013,7 @@ static void tlsp_get_request_event(int event, void *context) /* * Receive the TLS preferences now, to reduce the number of protocol - * roundtrips. To call the pre-handshake tls_*_start() before receiving - * the ciphertext FD, pass in the FD through some other interface. + * roundtrips. */ switch (req_flags & (TLS_PROXY_FLAG_ROLE_CLIENT | TLS_PROXY_FLAG_ROLE_SERVER)) { case TLS_PROXY_FLAG_ROLE_CLIENT: @@ -1018,6 +1041,9 @@ static void tlsp_get_request_event(int event, void *context) } /* + * For portability we must send some data, after receiving the request + * attributes and before receiving the remote file descriptor. + * * If the requested TLS engine is unavailable, hang up after making sure * that the plaintext peer has received our "sorry" indication. */ @@ -1280,7 +1306,7 @@ int main(int argc, char **argv) MAIL_VERSION_STAMP_ALLOCATE; /* - * Pass control to the single-threaded service skeleton. + * Pass control to the event-driven service skeleton. */ event_server_main(argc, argv, tlsp_service, CA_MAIL_SERVER_INT_TABLE(int_table), diff --git a/postfix/src/tlsproxy/tlsproxy_state.c b/postfix/src/tlsproxy/tlsproxy_state.c index 91dcfca7c..d6b88f598 100644 --- a/postfix/src/tlsproxy/tlsproxy_state.c +++ b/postfix/src/tlsproxy/tlsproxy_state.c @@ -19,8 +19,7 @@ /* tlsp_state_create() initializes session context. /* /* tlsp_state_free() destroys session context. If the handshake -/* was in progress, it sends a 'handshake failed' message to the -/* plaintext peer. +/* was in progress, it logs a 'handshake failed' message. /* /* Arguments: /* .IP service