mod_ssl: Add new directive SSLCompression to disable

TLS-level compression.

PR 53219.

Backport of r1345319 and r1348656 from trunk.

Submitted by: Bjoern Jacke <bjoern j3e de>, sf
Reviewed by: rjung, trawick
Backported by: rjung


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1369585 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Rainer Jung
2012-08-05 13:48:40 +00:00
parent 2ac9e2c7da
commit 4c3f6758db
7 changed files with 66 additions and 6 deletions

View File

@ -7,6 +7,9 @@ Changes with Apache 2.4.3
possible XSS for a site where untrusted users can upload files to
a location with MultiViews enabled. [Niels Heinen <heinenn google.com>]
*) mod_ssl: Add new directive SSLCompression to disable TLS-level
compression. PR 53219. [Björn Jacke <bjoern j3e de>, Stefan Fritsch]
*) mod_lua: Add a few missing request_rec fields. Rename remote_ip to
client_ip to match conn_rec. [Stefan Fritsch]

6
STATUS
View File

@ -88,12 +88,6 @@ RELEASE SHOWSTOPPERS:
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
[ start all new proposals below, under PATCHES PROPOSED. ]
* mod_ssl: Add SSLCompression directive.
trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1345319 and
http://svn.apache.org/viewvc?view=revision&revision=1348656
2.4.x patch: http://people.apache.org/~rjung/patches/ssl-compression-directive-2_4.patch
+1: rjung, sf, trawick
note: fix httpd compatibility info in docs when backporting
PATCHES PROPOSED TO BACKPORT FROM TRUNK:
[ New proposals should be added at the end of the list ]

View File

@ -2389,4 +2389,20 @@ be protected with file permissions similar to those used for
</usage>
</directivesynopsis>
<directivesynopsis>
<name>SSLCompression</name>
<description>Disallow compression on the SSL level</description>
<syntax>SSLCompression on|off</syntax>
<default>SSLCompression on</default>
<contextlist><context>server config</context>
<context>virtual host</context></contextlist>
<compatibility>Available in httpd 2.4.3 and later, if using OpenSSL 0.9.8 or later;
virtual host scope available if using OpenSSL 1.0.0 or later</compatibility>
<usage>
<p>This directive allows to disable compression on the SSL level.</p>
</usage>
</directivesynopsis>
</modulesynopsis>

View File

@ -138,6 +138,9 @@ static const command_rec ssl_config_cmds[] = {
"('[+-][" SSL_PROTOCOLS "] ...' - see manual)")
SSL_CMD_SRV(HonorCipherOrder, FLAG,
"Use the server's cipher ordering preference")
SSL_CMD_SRV(Compression, FLAG,
"Enable SSL level compression"
"(`on', `off')")
SSL_CMD_SRV(InsecureRenegotiation, FLAG,
"Enable support for insecure renegotiation")
SSL_CMD_ALL(UserName, TAKE1,

View File

@ -207,6 +207,9 @@ static SSLSrvConfigRec *ssl_config_server_new(apr_pool_t *p)
#ifdef HAVE_FIPS
sc->fips = UNSET;
#endif
#ifndef OPENSSL_NO_COMP
sc->compression = UNSET;
#endif
modssl_ctx_init_proxy(sc, p);
@ -328,6 +331,9 @@ void *ssl_config_server_merge(apr_pool_t *p, void *basev, void *addv)
#ifdef HAVE_FIPS
cfgMergeBool(fips);
#endif
#ifndef OPENSSL_NO_COMP
cfgMergeBool(compression);
#endif
modssl_ctx_cfg_merge_proxy(base->proxy, add->proxy, mrg->proxy);
@ -663,6 +669,23 @@ static const char *ssl_cmd_check_file(cmd_parms *parms,
}
const char *ssl_cmd_SSLCompression(cmd_parms *cmd, void *dcfg, int flag)
{
#if !defined(OPENSSL_NO_COMP)
SSLSrvConfigRec *sc = mySrvConfig(cmd->server);
#ifndef SSL_OP_NO_COMPRESSION
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
if (err)
return "This version of openssl does not support configuring "
"compression within <VirtualHost> sections.";
#endif
sc->compression = flag ? TRUE : FALSE;
return NULL;
#else
return "Setting Compression mode unsupported; not implemented by the SSL library";
#endif
}
const char *ssl_cmd_SSLHonorCipherOrder(cmd_parms *cmd, void *dcfg, int flag)
{
#ifdef SSL_OP_CIPHER_SERVER_PREFERENCE

View File

@ -622,6 +622,18 @@ static void ssl_init_ctx_protocol(server_rec *s,
}
#endif
#ifndef OPENSSL_NO_COMP
if (sc->compression == FALSE) {
#ifdef SSL_OP_NO_COMPRESSION
/* OpenSSL >= 1.0 only */
SSL_CTX_set_options(ctx, SSL_OP_NO_COMPRESSION);
#elif OPENSSL_VERSION_NUMBER >= 0x00908000L
sk_SSL_COMP_zero(SSL_COMP_get_compression_methods());
#endif
}
#endif
#ifdef SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION
if (sc->insecure_reneg == TRUE) {
SSL_CTX_set_options(ctx, SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION);

View File

@ -180,6 +180,11 @@
#define HAVE_TLSV1_X
#endif
#if !defined(OPENSSL_NO_COMP) && !defined(SSL_OP_NO_COMPRESSION) \
&& OPENSSL_VERSION_NUMBER < 0x00908000L
#define OPENSSL_NO_COMP
#endif
/* mod_ssl headers */
#include "ssl_util_ssl.h"
@ -673,6 +678,9 @@ struct SSLSrvConfigRec {
#ifdef HAVE_FIPS
BOOL fips;
#endif
#ifndef OPENSSL_NO_COMP
BOOL compression;
#endif
};
/**
@ -727,6 +735,7 @@ const char *ssl_cmd_SSLCARevocationPath(cmd_parms *, void *, const char *);
const char *ssl_cmd_SSLCARevocationFile(cmd_parms *, void *, const char *);
const char *ssl_cmd_SSLCARevocationCheck(cmd_parms *, void *, const char *);
const char *ssl_cmd_SSLHonorCipherOrder(cmd_parms *cmd, void *dcfg, int flag);
const char *ssl_cmd_SSLCompression(cmd_parms *, void *, int flag);
const char *ssl_cmd_SSLVerifyClient(cmd_parms *, void *, const char *);
const char *ssl_cmd_SSLVerifyDepth(cmd_parms *, void *, const char *);
const char *ssl_cmd_SSLSessionCache(cmd_parms *, void *, const char *);