From 0d89e201493f34f7a70f79e90020016d45a40da0 Mon Sep 17 00:00:00 2001
From: Wietse Venema
/etc/postfix/main.cf:
tls_disable_workarounds = 0xFFFFFFFF
- tls_disable_workarounds = CVE-2010-4180, LEGACY_SERVER_CONNECT
+ tls_disable_workarounds = CVE-2010-4180
-Note: Disabling LEGACY_SERVER_CONNECT is not wise at this -time, lots of servers are still unpatched and Postfix is not -significantly vulnerable to the renegotiation issue in the TLS -protocol.
+With Postfix ≥ 2.11, the tls_ssl_options parameter specifies +a list or bit-mask of OpenSSL options to enable. Specify one or +more of the named options below, or a hexadecimal bitmask of options +found in the ssl.h file corresponding to the run-time OpenSSL +library. While it may be reasonable to turn off all bug workarounds +(see above), it is not a good idea to attempt to turn on all features. +
+ +Example:
+ +++ ++/etc/postfix/main.cf: + tls_ssl_options = no_ticket, no_compression ++
You should only enable features via the hexadecimal mask when +the need to control the feature is critical (to deal with a new +vulnerability or a serious interoperability problem). Postfix DOES +NOT promise backwards compatible behavior with respect to the mask +bits. A feature enabled via the mask in one release may be enabled +by other means in a later release, and the mask bit will then be +ignored. Therefore, use of the hexadecimal mask is only a temporary +measure until a new Postfix or OpenSSL release provides a better +solution.
With Postfix 2.8 and later, the tls_disable_workarounds parameter +specifies a list or bit-mask of OpenSSL bug work-arounds to disable. This +may be necessary if one of the work-arounds enabled by default in +OpenSSL proves to pose a security risk, or introduces an unexpected +interoperability issue. Some bug work-arounds known to be problematic +are disabled in the default value of the parameter when linked with +an OpenSSL library that could be vulnerable.
+ +Example:
+ +++ ++/etc/postfix/main.cf: + tls_disable_workarounds = 0xFFFFFFFF + tls_disable_workarounds = CVE-2010-4180, LEGACY_SERVER_CONNECT ++
Note: Disabling LEGACY_SERVER_CONNECT is not wise at this +time, lots of servers are still unpatched and Postfix is not +significantly vulnerable to the renegotiation issue in the TLS +protocol.
+ +With Postfix ≥ 2.11, the tls_ssl_options parameter specifies +a list or bit-mask of OpenSSL options to enable. Specify one or +more of the named options below, or a hexadecimal bitmask of options +found in the ssl.h file corresponding to the run-time OpenSSL +library. While it may be reasonable to turn off all bug workarounds +(see above), it is not a good idea to attempt to turn on all features. +
+ +A future version of OpenSSL may by default no longer allow +connections to servers that don't support secure renegotiation. +Since the exposure for SMTP is minimal, and some SMTP servers may +remain unpatched, you can add LEGACY_SERVER_CONNECT to the +options to restore the more permissive default of current OpenSSL +releases.
+ +Example:
+ +++ ++/etc/postfix/main.cf: + tls_ssl_options = NO_TICKET, NO_COMPRESSION, LEGACY_SERVER_CONNECT ++
You should only enable features via the hexadecimal mask when +the need to control the feature is critical (to deal with a new +vulnerability or a serious interoperability problem). Postfix DOES +NOT promise backwards compatible behavior with respect to the mask +bits. A feature enabled via the mask in one release may be enabled +by other means in a later release, and the mask bit will then be +ignored. Therefore, use of the hexadecimal mask is only a temporary +measure until a new Postfix or OpenSSL release provides a better +solution.
+The security of cryptographic software such as TLS depends diff --git a/postfix/html/postconf.5.html b/postfix/html/postconf.5.html index 9cda67dec..d5363a1d0 100644 --- a/postfix/html/postconf.5.html +++ b/postfix/html/postconf.5.html @@ -16471,6 +16471,65 @@ gives timeout errors.
This feature is available in Postfix 2.2 and later.
+ + +List or bit-mask of OpenSSL options to enable.
+ +The OpenSSL toolkit provides a set of options that applications +can enable to tune the OpenSSL behavior. Some of these work around +bugs in other implementations and are on by default. You can use +the tls_disable_workarounds parameter to selectively disable some +or all of the bug work-arounds, making OpenSSL more strict at the +cost of non-interoperability with SSL clients or servers that exhibit +the bugs.
+ +Other options are off by default, and typically enable or disable +features rather than bug work-arounds. These may be turned on (with +care) via the tls_ssl_options parameter. The value is a white-space +or comma separated list of named options chosen from the list below. +The names are not case-sensitive, you can use lower-case if you +prefer. The upper case values below match the corresponding macro +name in the ssl.h header file with the SSL_OP_ prefix removed. It +is possible that your OpenSSL version includes new options added +after your Postfix source code was last updated, in that case you +can only enable one of these via the hexadecimal syntax below.
+ +You should only enable features via the hexadecimal mask when +the need to control the feature is critical (to deal with a new +vulnerability or a serious interoperability problem). Postfix DOES +NOT promise backwards compatible behavior with respect to the mask +bits. A feature enabled via the mask in one release may be enabled +by other means in a later release, and the mask bit will then be +ignored. Therefore, use of the hexadecimal mask is only a temporary +measure until a new Postfix or OpenSSL release provides a better +solution.
+ +If the value of the parameter is a hexadecimal long integer +starting with "0x", the options corresponding to the bits specified +in its value are enabled (see openssl/ssl.h and SSL_CTX_set_options(3)). +You can only enable options not already controlled by other Postfix +settings. For example, you cannot disable protocols or enable +server cipher preference. Do not attempt to turn all features by +specifying 0xFFFFFFFF, this is unlikely to be a good idea.
+ +This feature is available in Postfix 2.11 and later.
+ +
/etc/postfix/main.cf:
tls_disable_workarounds = 0xFFFFFFFF
- tls_disable_workarounds = CVE-2010-4180, LEGACY_SERVER_CONNECT
+ tls_disable_workarounds = CVE-2010-4180
-Note: Disabling LEGACY_SERVER_CONNECT is not wise at this -time, lots of servers are still unpatched and Postfix is not -significantly vulnerable to the renegotiation issue in the TLS -protocol.
+With Postfix ≥ 2.11, the tls_ssl_options parameter specifies +a list or bit-mask of OpenSSL options to enable. Specify one or +more of the named options below, or a hexadecimal bitmask of options +found in the ssl.h file corresponding to the run-time OpenSSL +library. While it may be reasonable to turn off all bug workarounds +(see above), it is not a good idea to attempt to turn on all features. +
+ +Example:
+ +++ ++/etc/postfix/main.cf: + tls_ssl_options = no_ticket, no_compression ++
You should only enable features via the hexadecimal mask when +the need to control the feature is critical (to deal with a new +vulnerability or a serious interoperability problem). Postfix DOES +NOT promise backwards compatible behavior with respect to the mask +bits. A feature enabled via the mask in one release may be enabled +by other means in a later release, and the mask bit will then be +ignored. Therefore, use of the hexadecimal mask is only a temporary +measure until a new Postfix or OpenSSL release provides a better +solution.
With Postfix 2.8 and later, the tls_disable_workarounds parameter +specifies a list or bit-mask of OpenSSL bug work-arounds to disable. This +may be necessary if one of the work-arounds enabled by default in +OpenSSL proves to pose a security risk, or introduces an unexpected +interoperability issue. Some bug work-arounds known to be problematic +are disabled in the default value of the parameter when linked with +an OpenSSL library that could be vulnerable.
+ +Example:
+ +++ ++/etc/postfix/main.cf: + tls_disable_workarounds = 0xFFFFFFFF + tls_disable_workarounds = CVE-2010-4180, LEGACY_SERVER_CONNECT ++
Note: Disabling LEGACY_SERVER_CONNECT is not wise at this +time, lots of servers are still unpatched and Postfix is not +significantly vulnerable to the renegotiation issue in the TLS +protocol.
+ +With Postfix ≥ 2.11, the tls_ssl_options parameter specifies +a list or bit-mask of OpenSSL options to enable. Specify one or +more of the named options below, or a hexadecimal bitmask of options +found in the ssl.h file corresponding to the run-time OpenSSL +library. While it may be reasonable to turn off all bug workarounds +(see above), it is not a good idea to attempt to turn on all features. +
+ +A future version of OpenSSL may by default no longer allow +connections to servers that don't support secure renegotiation. +Since the exposure for SMTP is minimal, and some SMTP servers may +remain unpatched, you can add LEGACY_SERVER_CONNECT to the +options to restore the more permissive default of current OpenSSL +releases.
+ +Example:
+ +++ ++/etc/postfix/main.cf: + tls_ssl_options = NO_TICKET, NO_COMPRESSION, LEGACY_SERVER_CONNECT ++
You should only enable features via the hexadecimal mask when +the need to control the feature is critical (to deal with a new +vulnerability or a serious interoperability problem). Postfix DOES +NOT promise backwards compatible behavior with respect to the mask +bits. A feature enabled via the mask in one release may be enabled +by other means in a later release, and the mask bit will then be +ignored. Therefore, use of the hexadecimal mask is only a temporary +measure until a new Postfix or OpenSSL release provides a better +solution.
+The security of cryptographic software such as TLS depends diff --git a/postfix/proto/postconf.proto b/postfix/proto/postconf.proto index ff9a7b481..1359d1b7c 100644 --- a/postfix/proto/postconf.proto +++ b/postfix/proto/postconf.proto @@ -15226,3 +15226,59 @@ the server in question is skipped and delivery is deferred if no secure servers are found.
This feature is available in Postfix 2.11 and later.
+ +%PARAM tls_ssl_options + +List or bit-mask of OpenSSL options to enable.
+ +The OpenSSL toolkit provides a set of options that applications +can enable to tune the OpenSSL behavior. Some of these work around +bugs in other implementations and are on by default. You can use +the tls_disable_workarounds parameter to selectively disable some +or all of the bug work-arounds, making OpenSSL more strict at the +cost of non-interoperability with SSL clients or servers that exhibit +the bugs.
+ +Other options are off by default, and typically enable or disable +features rather than bug work-arounds. These may be turned on (with +care) via the tls_ssl_options parameter. The value is a white-space +or comma separated list of named options chosen from the list below. +The names are not case-sensitive, you can use lower-case if you +prefer. The upper case values below match the corresponding macro +name in the ssl.h header file with the SSL_OP_ prefix removed. It +is possible that your OpenSSL version includes new options added +after your Postfix source code was last updated, in that case you +can only enable one of these via the hexadecimal syntax below.
+ +You should only enable features via the hexadecimal mask when +the need to control the feature is critical (to deal with a new +vulnerability or a serious interoperability problem). Postfix DOES +NOT promise backwards compatible behavior with respect to the mask +bits. A feature enabled via the mask in one release may be enabled +by other means in a later release, and the mask bit will then be +ignored. Therefore, use of the hexadecimal mask is only a temporary +measure until a new Postfix or OpenSSL release provides a better +solution.
+ +If the value of the parameter is a hexadecimal long integer +starting with "0x", the options corresponding to the bits specified +in its value are enabled (see openssl/ssl.h and SSL_CTX_set_options(3)). +You can only enable options not already controlled by other Postfix +settings. For example, you cannot disable protocols or enable +server cipher preference. Do not attempt to turn all features by +specifying 0xFFFFFFFF, this is unlikely to be a good idea.
+ +This feature is available in Postfix 2.11 and later.
+ diff --git a/postfix/src/global/mail_params.h b/postfix/src/global/mail_params.h index 7949738b8..c40702f13 100644 --- a/postfix/src/global/mail_params.h +++ b/postfix/src/global/mail_params.h @@ -3065,6 +3065,10 @@ extern bool var_tls_preempt_clist; #define DEF_TLS_BUG_TWEAKS TLS_BUG_TWEAKS extern char *var_tls_bug_tweaks; +#define VAR_TLS_SSL_OPTIONS "tls_ssl_options" +#define DEF_TLS_SSL_OPTIONS "" +extern char *var_tls_ssl_options; + #define VAR_TLS_BC_PKEY_FPRINT "tls_legacy_public_key_fingerprints" #define DEF_TLS_BC_PKEY_FPRINT 0 extern bool var_tls_bc_pkey_fprint; diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index fb5a95323..ed6467d86 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 "20130506" +#define MAIL_RELEASE_DATE "20130518" #define MAIL_VERSION_NUMBER "2.11" #ifdef SNAPSHOT diff --git a/postfix/src/posttls-finger/posttls-finger.c b/postfix/src/posttls-finger/posttls-finger.c index e8e5223f1..fffad281e 100644 --- a/postfix/src/posttls-finger/posttls-finger.c +++ b/postfix/src/posttls-finger/posttls-finger.c @@ -105,6 +105,9 @@ /* The PEM formatted CAfile for remote SMTP server certificate /* verification. By default no CAfile is used and no public CAs /* are trusted. +/* .IP "\fB-g \fIgrade\fR (default: medium)" +/* The minimum TLS cipher grade used by posttls-finger. See +/* smtp_tls_mandatory_ciphers for details. /* .IP "\fB-h \fIhost_lookup\fR (default: \fBdns\fR)" /* The hostname lookup methods used for the connection. See the /* documentation of smtp_host_lookup for syntax and semantics. @@ -179,8 +182,9 @@ /* peercert..cache and more. /* .RE /* .IP -/* The default is \fBroutine,certmatch\fR. After a reconnect, the log -/* level is unconditionally \fBroutine,cache\fR. +/* The default is \fBroutine,certmatch\fR. After a reconnect, +/* \fBpeercert\fR, \fBcertmatch\fR and \fBverbose\fR are automatically +/* disabled while \fBcache\fR and \fBsummary\fR are enabled. /* .IP "\fB-m \fIcount\fR (default: \fB5\fR)" /* When the \fB-r \fIdelay\fR option is specified, the \fB-m\fR option /* determines the maximum number of reconnect attempts to use with @@ -194,6 +198,9 @@ /* parameter \fIname\fR with \fIvalue\fR. Possible use-cases include /* overriding the values of TLS library parameters, or "myhostname" to /* configure the SMTP EHLO name sent to the remote server. +/* .IP "\fB-p \fIprotocols\fR (default: !SSLv2)" +/* List of TLS protocols that posttls-finger will exclude or include. See +/* smtp_tls_mandatory_protocols for details. /* .IP "\fB-P \fICApath/\fR (default: none)" /* The OpenSSL CApath/ directory (indexed via c_rehash(1)) for remote /* SMTP server certificate verification. By default no CApath is used @@ -418,6 +425,8 @@ typedef struct STATE { TLS_SESS_STATE *tls_context; /* Session TLS context */ TLS_DANE *dane; /* DANE TLSA validation structure */ TLS_DANE *ddane; /* DANE TLSA from DNS */ + char *grade; /* Minimum cipher grade */ + char *protocols; /* Protocol inclusion/exclusion */ #endif OPTIONS options; /* JCL */ } STATE; @@ -667,8 +676,8 @@ static int starttls(STATE *state) namaddr = state->namaddrport, serverid = STR(serverid), helo = state->helo ? state->helo : "", - protocols = "!SSLv2", /* XXX */ - cipher_grade = "medium", /* XXX */ + protocols = state->protocols, + cipher_grade = state->grade, cipher_exclusions = vstring_str(cipher_exclusions), matchargv = state->match, @@ -693,7 +702,9 @@ static int starttls(STATE *state) msg_info("Server is anonymous"); else if (state->print_trust) print_trust_info(state); - state->log_mask = TLS_LOG_SUMMARY | TLS_LOG_CACHE; + state->log_mask &= ~(TLS_LOG_CERTMATCH | TLS_LOG_PEERCERT | + TLS_LOG_VERBOSE | TLS_LOG_UNTRUSTED); + state->log_mask |= TLS_LOG_CACHE | TLS_LOG_SUMMARY; tls_update_app_logmask(state->tls_ctx, state->log_mask); } return (0); @@ -1127,7 +1138,7 @@ static DNS_RR *host_addr(STATE *state, const char *host) /* dane_host_level - canidate host "dane" or degraded security level */ -static int dane_host_level(STATE *state, DNS_RR *addr, unsigned port) +static int dane_host_level(STATE *state, DNS_RR *addr) { int level = state->level; @@ -1144,11 +1155,11 @@ static int dane_host_level(STATE *state, DNS_RR *addr, unsigned port) tls_dane_free(state->ddane); /* When TLSA lookups fail, next host */ - state->ddane = tls_dane_resolve(HNAME(addr), "tcp", port); + state->ddane = tls_dane_resolve(HNAME(addr), "tcp", state->port); if (!state->ddane) { dsb_simple(state->why, "4.7.5", "TLSA lookup error for %s:%u", - HNAME(addr), ntohs(port)); + HNAME(addr), ntohs(state->port)); return (TLS_LEV_INVALID); } /* If unusable or not found, same fallback to "secure" */ @@ -1222,12 +1233,11 @@ static void connect_remote(STATE *state, char *dest) DNS_RR *addr; char *buf; char *domain; - unsigned port; /* When reconnecting use IP address of previous session */ if (state->addr == 0) { buf = parse_destination(dest, state->smtp ? "smtp" : "24", - &domain, &port); + &domain, &state->port); if (!state->nexthop) state->nexthop = mystrdup(domain); if (state->smtp == 0 || *dest == '[') @@ -1241,10 +1251,9 @@ static void connect_remote(STATE *state, char *dest) vstring_str(state->why->reason)); return; } - state->port = port; } for (addr = state->addr; addr; addr = addr->next) { - int level = dane_host_level(state, addr, port); + int level = dane_host_level(state, addr); if (level == TLS_LEV_INVALID || (state->stream = connect_addr(state, addr)) == 0) { @@ -1440,6 +1449,8 @@ static void cleanup(STATE *state) tls_dane_flush(); /* Flush and free memory tlsmgr cache */ tlsmgrmem_flush(); + myfree(state->grade); + myfree(state->protocols); #endif myfree(state->options.host_lookup); myfree(state->dest); @@ -1453,7 +1464,7 @@ static void usage(void) { #ifdef USE_TLS fprintf(stderr, "usage: %s %s \\\n\t%s \\\n\t%s destination [match ...]\n", - var_procname, "[-acCStTv] [-d mdalg] [-F CAfile.pem]", + var_procname, "[-acCStTv] [-d mdalg] [-g grade] [-p protocols] [-F CAfile.pem]", "[-h host_lookup] [-l level] [-L logopts] [-m count]", "[-o name=value] [-P CApath/] [-r delay]"); #else @@ -1515,12 +1526,16 @@ static void parse_options(STATE *state, int argc, char *argv[]) state->pass = 1; state->reconnect = -1; state->max_reconnect = 5; +#ifdef USE_TLS + state->protocols = mystrdup("!SSLv2"); + state->grade = mystrdup("medium"); +#endif memset((char *) &state->options, 0, sizeof(state->options)); state->options.host_lookup = mystrdup("dns"); #define OPTS "a:ch:o:St:T:v" #ifdef USE_TLS -#define TLSOPTS "A:Cd:F:l:L:m:P:r:" +#define TLSOPTS "A:Cd:F:g:l:L:m:p:P:r:" state->mdalg = mystrdup("sha1"); state->CApath = mystrdup(""); @@ -1578,6 +1593,10 @@ static void parse_options(STATE *state, int argc, char *argv[]) myfree(state->CAfile); state->CAfile = mystrdup(optarg); break; + case 'g': + myfree(state->grade); + state->grade = mystrdup(optarg); + break; case 'l': if (state->options.level) myfree(state->options.level); @@ -1591,6 +1610,10 @@ static void parse_options(STATE *state, int argc, char *argv[]) case 'm': state->max_reconnect = atoi(optarg); break; + case 'p': + myfree(state->protocols); + state->protocols = mystrdup(optarg); + break; case 'P': myfree(state->CApath); state->CApath = mystrdup(optarg); diff --git a/postfix/src/tls/tls.h b/postfix/src/tls/tls.h index f1544069e..5519dcc54 100644 --- a/postfix/src/tls/tls.h +++ b/postfix/src/tls/tls.h @@ -295,9 +295,22 @@ extern void tls_param_init(void); #undef SSL_OP_NO_TLSv1_2 #define SSL_OP_NO_TLSv1_2 0L /* Noop */ #endif -#define TLS_KNOWN_PROTOCOLS \ +#define TLS_KNOWN_PROTOCOLS \ ( TLS_PROTOCOL_SSLv2 | TLS_PROTOCOL_SSLv3 | TLS_PROTOCOL_TLSv1 \ | TLS_PROTOCOL_TLSv1_1 | TLS_PROTOCOL_TLSv1_2 ) +#define TLS_SSL_OP_PROTOMASK(m) \ + ((((m) & TLS_PROTOCOL_SSLv2) ? SSL_OP_NO_SSLv2 : 0L) \ + | (((m) & TLS_PROTOCOL_SSLv3) ? SSL_OP_NO_SSLv3 : 0L) \ + | (((m) & TLS_PROTOCOL_TLSv1) ? SSL_OP_NO_TLSv1 : 0L) \ + | (((m) & TLS_PROTOCOL_TLSv1_1) ? SSL_OP_NO_TLSv1_1 : 0L) \ + | (((m) & TLS_PROTOCOL_TLSv1_2) ? SSL_OP_NO_TLSv1_2 : 0L)) + +/* + * SSL options that are managed via dedicated Postfix features, rather than + * just exposed via hex codes or named elements of tls_ssl_options. + */ +#define TLS_SSL_OP_MANAGED_BITS \ + (SSL_OP_CIPHER_SERVER_PREFERENCE | TLS_SSL_OP_PROTOMASK(~0)) extern int tls_protocol_mask(const char *); diff --git a/postfix/src/tls/tls_client.c b/postfix/src/tls/tls_client.c index 7f108b984..422614805 100644 --- a/postfix/src/tls/tls_client.c +++ b/postfix/src/tls/tls_client.c @@ -853,12 +853,7 @@ TLS_SESS_STATE *tls_client_start(const TLS_CLIENT_START_PROPS *props) * Apply session protocol restrictions. */ if (protomask != 0) - SSL_set_options(TLScontext->con, - ((protomask & TLS_PROTOCOL_TLSv1) ? SSL_OP_NO_TLSv1 : 0L) - | ((protomask & TLS_PROTOCOL_TLSv1_1) ? SSL_OP_NO_TLSv1_1 : 0L) - | ((protomask & TLS_PROTOCOL_TLSv1_2) ? SSL_OP_NO_TLSv1_2 : 0L) - | ((protomask & TLS_PROTOCOL_SSLv3) ? SSL_OP_NO_SSLv3 : 0L) - | ((protomask & TLS_PROTOCOL_SSLv2) ? SSL_OP_NO_SSLv2 : 0L)); + SSL_set_options(TLScontext->con, TLS_SSL_OP_PROTOMASK(protomask)); /* * XXX To avoid memory leaks we must always call SSL_SESSION_free() after @@ -873,13 +868,12 @@ TLS_SESS_STATE *tls_client_start(const TLS_CLIENT_START_PROPS *props) } } #ifdef TLSEXT_MAXLEN_host_name - if (session == 0 - && props->tls_level == TLS_LEV_DANE + if (props->tls_level == TLS_LEV_DANE && strlen(props->host) <= TLSEXT_MAXLEN_host_name) { /* - * With new DANE sessions, send an SNI hint. We don't care whether - * the server reports finding a matching certificate or not, so no + * With DANE sessions, send an SNI hint. We don't care whether the + * server reports finding a matching certificate or not, so no * callback is required to process the server response. Our use of * SNI is limited to giving servers that are (mis)configured to use * SNI the best opportunity to find the certificate they promised via diff --git a/postfix/src/tls/tls_misc.c b/postfix/src/tls/tls_misc.c index 086aaf76a..93b5fb1d5 100644 --- a/postfix/src/tls/tls_misc.c +++ b/postfix/src/tls/tls_misc.c @@ -221,6 +221,7 @@ char *var_tls_eecdh_ultra; char *var_tls_dane_ta_dgst; bool var_tls_append_def_CA; char *var_tls_bug_tweaks; +char *var_tls_ssl_options; bool var_tls_bc_pkey_fprint; #ifdef VAR_TLS_PREEMPT_CLIST @@ -312,6 +313,28 @@ static const LONG_NAME_MASK ssl_bug_tweaks[] = { 0, 0, }; + /* + * SSL_OP_MUMBLE option name <=> mask conversion for options that are not + * (or may in the future not be) in SSL_OP_ALL. These enable optional + * behavior, rather than bug interoperability work-arounds. + */ +#define NAME_SSL_OP(x) #x, SSL_OP_##x +static const LONG_NAME_MASK ssl_op_tweaks[] = { + +#if defined(SSL_OP_LEGACY_SERVER_CONNECT) + NAME_SSL_OP(LEGACY_SERVER_CONNECT), +#endif + +#if defined(SSL_OP_NO_TICKET) + NAME_SSL_OP(NO_TICKET), +#endif + +#if defined(SSL_OP_NO_COMPRESSION) + NAME_SSL_OP(NO_COMPRESSION), +#endif + 0, 0, +}; + /* * Ciphersuite name <=> code conversion. */ @@ -567,6 +590,7 @@ void tls_param_init(void) VAR_TLS_EECDH_STRONG, DEF_TLS_EECDH_STRONG, &var_tls_eecdh_strong, 1, 0, VAR_TLS_EECDH_ULTRA, DEF_TLS_EECDH_ULTRA, &var_tls_eecdh_ultra, 1, 0, VAR_TLS_BUG_TWEAKS, DEF_TLS_BUG_TWEAKS, &var_tls_bug_tweaks, 0, 0, + VAR_TLS_SSL_OPTIONS, DEF_TLS_SSL_OPTIONS, &var_tls_ssl_options, 0, 0, VAR_TLS_DANE_TA_DGST, DEF_TLS_DANE_TA_DGST, &var_tls_dane_ta_dgst, 0, 0, 0, }; @@ -924,6 +948,19 @@ long tls_bug_bits(void) var_tls_bug_tweaks, NAME_MASK_ANY_CASE | NAME_MASK_NUMBER | NAME_MASK_WARN); } + + /* + * Allow users to set options not in SSL_OP_ALL, and not already + * managed via other Postfix parameters. + */ + if (*var_tls_ssl_options) { + long enable; + enable = long_name_mask_opt(VAR_TLS_SSL_OPTIONS, ssl_op_tweaks, + var_tls_ssl_options, NAME_MASK_ANY_CASE | + NAME_MASK_NUMBER | NAME_MASK_WARN); + enable &= ~(SSL_OP_ALL | TLS_SSL_OP_MANAGED_BITS); + bits |= enable; + } return (bits); } -- 2.47.3