1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-05 16:55:50 +03:00

Add new directive SSLCompression to disable SSL-level compression.

PR: 53219
Submitted by: Björn Jacke <bjoern j3e de>, Stefan Fritsch


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1345319 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stefan Fritsch
2012-06-01 19:36:37 +00:00
parent bd4d8fd4a2
commit 510d3f904e
6 changed files with 57 additions and 0 deletions

View File

@@ -1,6 +1,9 @@
-*- coding: utf-8 -*- -*- coding: utf-8 -*-
Changes with Apache 2.5.0 Changes with Apache 2.5.0
*) mod_ssl: Add new directive SSLCompression to disable TLS-level
compression. PR 53219. [Björn Jacke <bjoern j3e de>, Stefan Fritsch]
*) core: Make ap_regcomp() return AP_REG_ESPACE if out of memory. Make *) core: Make ap_regcomp() return AP_REG_ESPACE if out of memory. Make
ap_pregcomp() abort if out of memory. This raises the minimum PCRE ap_pregcomp() abort if out of memory. This raises the minimum PCRE
requirement to version 6.0. PR 53284. [Stefan Fritsch] requirement to version 6.0. PR 53284. [Stefan Fritsch]

View File

@@ -2382,4 +2382,20 @@ be protected with file permissions similar to those used for
</usage> </usage>
</directivesynopsis> </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.5.0 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> </modulesynopsis>

View File

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

View File

@@ -207,6 +207,7 @@ static SSLSrvConfigRec *ssl_config_server_new(apr_pool_t *p)
#ifdef HAVE_FIPS #ifdef HAVE_FIPS
sc->fips = UNSET; sc->fips = UNSET;
#endif #endif
sc->compression = UNSET;
modssl_ctx_init_proxy(sc, p); modssl_ctx_init_proxy(sc, p);
@@ -328,6 +329,7 @@ void *ssl_config_server_merge(apr_pool_t *p, void *basev, void *addv)
#ifdef HAVE_FIPS #ifdef HAVE_FIPS
cfgMergeBool(fips); cfgMergeBool(fips);
#endif #endif
cfgMergeBool(compression);
modssl_ctx_cfg_merge_proxy(base->proxy, add->proxy, mrg->proxy); modssl_ctx_cfg_merge_proxy(base->proxy, add->proxy, mrg->proxy);
@@ -663,6 +665,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(SSL_OP_NO_COMPRESSION) || OPENSSL_VERSION_NUMBER >= 0x00908000L
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) const char *ssl_cmd_SSLHonorCipherOrder(cmd_parms *cmd, void *dcfg, int flag)
{ {
#ifdef SSL_OP_CIPHER_SERVER_PREFERENCE #ifdef SSL_OP_CIPHER_SERVER_PREFERENCE

View File

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

View File

@@ -678,6 +678,7 @@ struct SSLSrvConfigRec {
#ifdef HAVE_FIPS #ifdef HAVE_FIPS
BOOL fips; BOOL fips;
#endif #endif
BOOL compression;
}; };
/** /**
@@ -732,6 +733,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_SSLCARevocationFile(cmd_parms *, void *, const char *);
const char *ssl_cmd_SSLCARevocationCheck(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_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_SSLVerifyClient(cmd_parms *, void *, const char *);
const char *ssl_cmd_SSLVerifyDepth(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 *); const char *ssl_cmd_SSLSessionCache(cmd_parms *, void *, const char *);