You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2020/05/05 12:40:39 UTC

svn commit: r1877397 - in /httpd/httpd/trunk: CHANGES modules/ssl/ssl_engine_init.c modules/ssl/ssl_engine_io.c modules/ssl/ssl_engine_kernel.c modules/ssl/ssl_private.h modules/ssl/ssl_util_ssl.c

Author: jorton
Date: Tue May  5 12:40:38 2020
New Revision: 1877397

URL: http://svn.apache.org/viewvc?rev=1877397&view=rev
Log:
mod_ssl: Switch to using SSL_OP_NO_RENEGOTATION (where available) to
block client-initiated renegotiation with TLSv1.2 and earlier.

* modules/ssl/ssl_private.h: Define modssl_reneg_state enum,
  modssl_set_reneg_state function.

* modules/ssl/ssl_engine_io.c (bio_filter_out_write,
  bio_filter_in_read): #ifdef-out reneg protection if
  SSL_OP_NO_RENEGOTATION is defined.

* modules/ssl/ssl_engine_init.c (ssl_init_ctx_protocol):
  Enable SSL_OP_NO_RENEGOTATION.
  (ssl_init_ctx_callbacks): Only enable the "info" callback if
  debug-level logging *or* OpenSSL doesn't support SSL_OP_NO_RENEGOTATION.
  
* modules/ssl/ssl_engine_kernel.c (ssl_hook_Access_classic): Use
  modssl_set_reneg_state to set the reneg protection mode.
  (ssl_hook_Access_modern): Drop manipulation of the reneg mode which
  does nothing for TLSv1.3 already.
  (ssl_callback_Info): Only enable reneg protection if
  SSL_OP_NO_RENEGOTATION is *not* defined.

* modules/ssl/ssl_util_ssl.c (modssl_set_reneg_state): New function.

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/modules/ssl/ssl_engine_init.c
    httpd/httpd/trunk/modules/ssl/ssl_engine_io.c
    httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c
    httpd/httpd/trunk/modules/ssl/ssl_private.h
    httpd/httpd/trunk/modules/ssl/ssl_util_ssl.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1877397&r1=1877396&r2=1877397&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Tue May  5 12:40:38 2020
@@ -1,6 +1,11 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.1
 
+  *) mod_ssl: With OpenSSL 1.1.1 and later, client-initiated
+     renegotiation in TLSv1.2 and earlier is blocked at SSL library
+     level (with a TLS warning alert sent), rather than by aborting
+     the connection inside mod_ssl.  [Joe Orton]
+ 
   *) core: Add optional "options=" argument to Listen.  Supported
      keywords are "freebind" and "reuseport".  PR 61865.
      [Jan Kaluza, Lubos Uhliarik <luhliari redhat.com>, Joe Orton]

Modified: httpd/httpd/trunk/modules/ssl/ssl_engine_init.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_engine_init.c?rev=1877397&r1=1877396&r2=1877397&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_engine_init.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_engine_init.c Tue May  5 12:40:38 2020
@@ -858,6 +858,13 @@ static apr_status_t ssl_init_ctx_protoco
         SSL_CTX_set_keylog_callback(ctx, modssl_callback_keylog);
     }
 #endif
+
+#ifdef SSL_OP_NO_RENEGOTIATION
+    /* For server-side SSL_CTX, disable renegotiation by default.. */
+    if (!mctx->pkp) {
+        SSL_CTX_set_options(ctx, SSL_OP_NO_RENEGOTIATION);
+    }
+#endif
     
     return APR_SUCCESS;
 }
@@ -879,6 +886,14 @@ static void ssl_init_ctx_session_cache(s
     }
 }
 
+#ifdef SSL_OP_NO_RENEGOTIATION
+/* OpenSSL-level renegotiation protection. */
+#define MODSSL_BLOCKS_RENEG (0)
+#else
+/* mod_ssl-level renegotiation protection. */
+#define MODSSL_BLOCKS_RENEG (1)
+#endif
+
 static void ssl_init_ctx_callbacks(server_rec *s,
                                    apr_pool_t *p,
                                    apr_pool_t *ptemp,
@@ -888,7 +903,13 @@ static void ssl_init_ctx_callbacks(serve
 
     SSL_CTX_set_tmp_dh_callback(ctx,  ssl_callback_TmpDH);
 
-    SSL_CTX_set_info_callback(ctx, ssl_callback_Info);
+    /* The info callback is used for debug-level tracing.  For OpenSSL
+     * versions where SSL_OP_NO_RENEGOTIATION is not available, the
+     * callback is also used to prevent use of client-initiated
+     * renegotiation.  Enable it in either case. */
+    if (APLOGdebug(s) || MODSSL_BLOCKS_RENEG) {
+        SSL_CTX_set_info_callback(ctx, ssl_callback_Info);
+    }
 
 #ifdef HAVE_TLS_ALPN
     SSL_CTX_set_alpn_select_cb(ctx, ssl_callback_alpn_select, NULL);

Modified: httpd/httpd/trunk/modules/ssl/ssl_engine_io.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_engine_io.c?rev=1877397&r1=1877396&r2=1877397&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_engine_io.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_engine_io.c Tue May  5 12:40:38 2020
@@ -211,11 +211,13 @@ static int bio_filter_out_write(BIO *bio
 
     BIO_clear_retry_flags(bio);
 
+#ifndef SSL_OP_NO_RENEGOTIATION
     /* Abort early if the client has initiated a renegotiation. */
     if (outctx->filter_ctx->config->reneg_state == RENEG_ABORT) {
         outctx->rc = APR_ECONNABORTED;
         return -1;
     }
+#endif
 
     ap_log_cerror(APLOG_MARK, APLOG_TRACE6, 0, outctx->c,
                   "bio_filter_out_write: %i bytes", inl);
@@ -514,11 +516,13 @@ static int bio_filter_in_read(BIO *bio,
 
     BIO_clear_retry_flags(bio);
 
+#ifndef SSL_OP_NO_RENEGOTIATION
     /* Abort early if the client has initiated a renegotiation. */
     if (inctx->filter_ctx->config->reneg_state == RENEG_ABORT) {
         inctx->rc = APR_ECONNABORTED;
         return -1;
     }
+#endif
 
     if (!inctx->bb) {
         inctx->rc = APR_EOF;

Modified: httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c?rev=1877397&r1=1877396&r2=1877397&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c Tue May  5 12:40:38 2020
@@ -992,7 +992,7 @@ static int ssl_hook_Access_classic(reque
 
             /* Toggle the renegotiation state to allow the new
              * handshake to proceed. */
-            sslconn->reneg_state = RENEG_ALLOW;
+            modssl_set_reneg_state(sslconn, RENEG_ALLOW);
 
             SSL_renegotiate(ssl);
             SSL_do_handshake(ssl);
@@ -1019,7 +1019,7 @@ static int ssl_hook_Access_classic(reque
              */
             SSL_peek(ssl, peekbuf, 0);
 
-            sslconn->reneg_state = RENEG_REJECT;
+            modssl_set_reneg_state(sslconn, RENEG_REJECT);
 
             if (!SSL_is_init_finished(ssl)) {
                 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(02261)
@@ -1078,7 +1078,7 @@ static int ssl_hook_Access_modern(reques
         (sc->server->auth.verify_mode != SSL_CVERIFY_UNSET)) {
         int vmode_inplace, vmode_needed;
         int change_vmode = FALSE;
-        int old_state, n, rc;
+        int n, rc;
 
         vmode_inplace = SSL_get_verify_mode(ssl);
         vmode_needed = SSL_VERIFY_NONE;
@@ -1182,8 +1182,6 @@ static int ssl_hook_Access_modern(reques
                 return HTTP_FORBIDDEN;
             }
             
-            old_state = sslconn->reneg_state;
-            sslconn->reneg_state = RENEG_ALLOW;
             modssl_set_app_data2(ssl, r);
 
             SSL_do_handshake(ssl);
@@ -1193,7 +1191,6 @@ static int ssl_hook_Access_modern(reques
              */
             SSL_peek(ssl, peekbuf, 0);
 
-            sslconn->reneg_state = old_state;
             modssl_set_app_data2(ssl, NULL);
 
             /*
@@ -2267,8 +2264,8 @@ static void log_tracing_state(const SSL
 /*
  * This callback function is executed while OpenSSL processes the SSL
  * handshake and does SSL record layer stuff.  It's used to trap
- * client-initiated renegotiations, and for dumping everything to the
- * log.
+ * client-initiated renegotiations (where SSL_OP_NO_RENEGOTATION is
+ * not available), and for dumping everything to the log.
  */
 void ssl_callback_Info(const SSL *ssl, int where, int rc)
 {
@@ -2280,14 +2277,12 @@ void ssl_callback_Info(const SSL *ssl, i
         return;
     }
 
-    /* With TLS 1.3 this callback may be called multiple times on the first
-     * negotiation, so the below logic to detect renegotiations can't work.
-     * Fortunately renegotiations are forbidden starting with TLS 1.3, and
-     * this is enforced by OpenSSL so there's nothing to be done here.
-     */
-#if SSL_HAVE_PROTOCOL_TLSV1_3
-    if (SSL_version(ssl) < TLS1_3_VERSION)
-#endif
+#ifndef SSL_OP_NO_RENEGOTATION
+    /* With OpenSSL < 1.1.1 (implying TLS v1.2 or earlier), this
+     * callback is used to block client-initiated renegotiation.  With
+     * TLSv1.3 it is unnecessary since renegotiation is forbidden at
+     * protocol level.  Otherwise (TLSv1.2 with OpenSSL >=1.1.1),
+     * SSL_OP_NO_RENEGOTATION is used to block renegotiation. */
     {
         SSLConnRec *sslconn;
 
@@ -2312,6 +2307,7 @@ void ssl_callback_Info(const SSL *ssl, i
             sslconn->reneg_state = RENEG_REJECT;
         }
     }
+#endif
 
     s = mySrvFromConn(c);
     if (s && APLOGdebug(s)) {

Modified: httpd/httpd/trunk/modules/ssl/ssl_private.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_private.h?rev=1877397&r1=1877396&r2=1877397&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_private.h (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_private.h Tue May  5 12:40:38 2020
@@ -500,6 +500,16 @@ typedef struct {
     apr_time_t     source_mtime;
 } ssl_asn1_t;
 
+typedef enum {
+    RENEG_INIT = 0, /* Before initial handshake */
+    RENEG_REJECT,   /* After initial handshake; any client-initiated
+                     * renegotiation should be rejected */
+    RENEG_ALLOW,    /* A server-initiated renegotiation is taking
+                     * place (as dictated by configuration) */
+    RENEG_ABORT     /* Renegotiation initiated by client, abort the
+                     * connection */
+} modssl_reneg_state;
+
 /**
  * Define the mod_ssl per-module configuration structure
  * (i.e. the global configuration for each httpd process)
@@ -532,18 +542,13 @@ typedef struct {
         NON_SSL_SET_ERROR_MSG  /* Need to set the error message */
     } non_ssl_request;
 
-    /* Track the handshake/renegotiation state for the connection so
-     * that all client-initiated renegotiations can be rejected, as a
-     * partial fix for CVE-2009-3555. */
-    enum {
-        RENEG_INIT = 0, /* Before initial handshake */
-        RENEG_REJECT,   /* After initial handshake; any client-initiated
-                         * renegotiation should be rejected */
-        RENEG_ALLOW,    /* A server-initiated renegotiation is taking
-                         * place (as dictated by configuration) */
-        RENEG_ABORT     /* Renegotiation initiated by client, abort the
-                         * connection */
-    } reneg_state;
+#ifndef SSL_OP_NO_RENEGOTATION
+    /* For OpenSSL < 1.1.1, track the handshake/renegotiation state
+     * for the connection to block client-initiated renegotiations.
+     * For OpenSSL >=1.1.1, the SSL_OP_NO_RENEGOTATION flag is used in
+     * the SSL * options state with equivalent effect. */
+    modssl_reneg_state reneg_state;
+#endif
 
     server_rec *server;
     SSLDirConfigRec *dc;
@@ -1146,6 +1151,9 @@ extern int ssl_running_on_valgrind;
 int ssl_is_challenge(conn_rec *c, const char *servername, 
                      X509 **pcert, EVP_PKEY **pkey);
 
+/* Set the renegotation state for connection. */
+void modssl_set_reneg_state(SSLConnRec *sslconn, modssl_reneg_state state);
+
 #endif /* SSL_PRIVATE_H */
 /** @} */
 

Modified: httpd/httpd/trunk/modules/ssl/ssl_util_ssl.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_util_ssl.c?rev=1877397&r1=1877396&r2=1877397&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_util_ssl.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_util_ssl.c Tue May  5 12:40:38 2020
@@ -511,3 +511,19 @@ char *modssl_SSL_SESSION_id2sz(IDCONST u
 
     return str;
 }
+
+void modssl_set_reneg_state(SSLConnRec *sslconn, modssl_reneg_state state)
+{
+#ifdef SSL_OP_NO_RENEGOTATION
+    switch (state) {
+    case RENEG_ALLOW:
+        SSL_clear_options(sslconn->ssl, SSL_OP_NO_RENEGOTATION);
+        break;
+    default:
+        SSL_set_options(sslconn->ssl, SSL_OP_NO_RENEGOTATION);
+        break;
+    }
+#else
+    sslconn->reneg_state = state;
+#endif
+}



Re: svn commit: r1877397 - in /httpd/httpd/trunk: CHANGES modules/ssl/ssl_engine_init.c modules/ssl/ssl_engine_io.c modules/ssl/ssl_engine_kernel.c modules/ssl/ssl_private.h modules/ssl/ssl_util_ssl.c

Posted by Yann Ylavic <yl...@gmail.com>.
On Tue, May 5, 2020 at 2:40 PM <jo...@apache.org> wrote:
>
> -    /* With TLS 1.3 this callback may be called multiple times on the first
> -     * negotiation, so the below logic to detect renegotiations can't work.
> -     * Fortunately renegotiations are forbidden starting with TLS 1.3, and
> -     * this is enforced by OpenSSL so there's nothing to be done here.
> -     */
> -#if SSL_HAVE_PROTOCOL_TLSV1_3
> -    if (SSL_version(ssl) < TLS1_3_VERSION)
> -#endif
> +#ifndef SSL_OP_NO_RENEGOTATION
> +    /* With OpenSSL < 1.1.1 (implying TLS v1.2 or earlier), this
> +     * callback is used to block client-initiated renegotiation.  With
> +     * TLSv1.3 it is unnecessary since renegotiation is forbidden at
> +     * protocol level.  Otherwise (TLSv1.2 with OpenSSL >=1.1.1),
> +     * SSL_OP_NO_RENEGOTATION is used to block renegotiation. */
>      {

Maybe this needs to stay a runtime check because of (possible) "-TLSv1.3"?

(I didn't look at the other places where we now assume(?) that openssl
>= 1.1.1 will do the right things wrt renegotiations even if the
actual protocol is < TLSv1.3).


Regards;
Yann.

Re: svn commit: r1877397 - in /httpd/httpd/trunk: CHANGES modules/ssl/ssl_engine_init.c modules/ssl/ssl_engine_io.c modules/ssl/ssl_engine_kernel.c modules/ssl/ssl_private.h modules/ssl/ssl_util_ssl.c

Posted by Ruediger Pluem <rp...@apache.org>.

On 5/5/20 6:04 PM, Joe Orton wrote:
> On Tue, May 05, 2020 at 03:23:18PM +0200, Ruediger Pluem wrote:
>> On 5/5/20 2:40 PM, jorton@apache.org wrote:
>>> Author: jorton
>>> Date: Tue May  5 12:40:38 2020
>>> New Revision: 1877397
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1877397&view=rev
>>> Log:
>>> mod_ssl: Switch to using SSL_OP_NO_RENEGOTATION (where available) to
>>> block client-initiated renegotiation with TLSv1.2 and earlier.
> ...
>>> Modified: httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c
>>> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c?rev=1877397&r1=1877396&r2=1877397&view=diff
>>> ==============================================================================
>>> --- httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c (original)
>>> +++ httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c Tue May  5 12:40:38 2020
>>
>>> @@ -1182,8 +1182,6 @@ static int ssl_hook_Access_modern(reques
>>>                  return HTTP_FORBIDDEN;
>>>              }
>>>              
>>> -            old_state = sslconn->reneg_state;
>>> -            sslconn->reneg_state = RENEG_ALLOW;
>>>              modssl_set_app_data2(ssl, r);
>>>  
>>>              SSL_do_handshake(ssl);
>>> @@ -1193,7 +1191,6 @@ static int ssl_hook_Access_modern(reques
>>>               */
>>>              SSL_peek(ssl, peekbuf, 0);
>>>  
>>> -            sslconn->reneg_state = old_state;
>>>              modssl_set_app_data2(ssl, NULL);
>>>  
>>>              /*
>>
>> I don't understand why this can be removed unconditionally.
> 
> It is removed unconditionally in ssl_hook_Access_modern, which is used 
> only for TLSv1.3.  The aim of this code was to protect against 

Thanks for the pointer. I missed the

#if SSL_HAVE_PROTOCOL_TLSV1_3

in front of ssl_hook_Access_modern.

> 
> Does that make sense?

Yes :-)

Regards

Rüdiger


Re: svn commit: r1877397 - in /httpd/httpd/trunk: CHANGES modules/ssl/ssl_engine_init.c modules/ssl/ssl_engine_io.c modules/ssl/ssl_engine_kernel.c modules/ssl/ssl_private.h modules/ssl/ssl_util_ssl.c

Posted by Joe Orton <jo...@redhat.com>.
On Tue, May 05, 2020 at 03:23:18PM +0200, Ruediger Pluem wrote:
> On 5/5/20 2:40 PM, jorton@apache.org wrote:
> > Author: jorton
> > Date: Tue May  5 12:40:38 2020
> > New Revision: 1877397
> > 
> > URL: http://svn.apache.org/viewvc?rev=1877397&view=rev
> > Log:
> > mod_ssl: Switch to using SSL_OP_NO_RENEGOTATION (where available) to
> > block client-initiated renegotiation with TLSv1.2 and earlier.
...
> > Modified: httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c
> > URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c?rev=1877397&r1=1877396&r2=1877397&view=diff
> > ==============================================================================
> > --- httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c (original)
> > +++ httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c Tue May  5 12:40:38 2020
> 
> > @@ -1182,8 +1182,6 @@ static int ssl_hook_Access_modern(reques
> >                  return HTTP_FORBIDDEN;
> >              }
> >              
> > -            old_state = sslconn->reneg_state;
> > -            sslconn->reneg_state = RENEG_ALLOW;
> >              modssl_set_app_data2(ssl, r);
> >  
> >              SSL_do_handshake(ssl);
> > @@ -1193,7 +1191,6 @@ static int ssl_hook_Access_modern(reques
> >               */
> >              SSL_peek(ssl, peekbuf, 0);
> >  
> > -            sslconn->reneg_state = old_state;
> >              modssl_set_app_data2(ssl, NULL);
> >  
> >              /*
> 
> I don't understand why this can be removed unconditionally.

It is removed unconditionally in ssl_hook_Access_modern, which is used 
only for TLSv1.3.  The aim of this code was to protect against 
ClientHello being sent unexpectedly and that is always illegal in 
TLSv1.3.  https://www.rfc-editor.org/rfc/rfc8446.html#page-28 -

   Because TLS 1.3 forbids renegotiation, if a server has negotiated
   TLS 1.3 and receives a ClientHello at any other time, it MUST
   terminate the connection with an "unexpected_message" alert.

So the ->reneg_state setting already had no effect for TLSv1.3, and the 
code in ssl_callback_Info *before* my commit already checked and was a 
noop for the TLSv1.3 case, in line 2289 of the function:

http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c?revision=1877349&view=markup&pathrev=1877397#l2273

Does that make sense?

Regards, Joe


Re: svn commit: r1877397 - in /httpd/httpd/trunk: CHANGES modules/ssl/ssl_engine_init.c modules/ssl/ssl_engine_io.c modules/ssl/ssl_engine_kernel.c modules/ssl/ssl_private.h modules/ssl/ssl_util_ssl.c

Posted by Ruediger Pluem <rp...@apache.org>.

On 5/5/20 2:40 PM, jorton@apache.org wrote:
> Author: jorton
> Date: Tue May  5 12:40:38 2020
> New Revision: 1877397
> 
> URL: http://svn.apache.org/viewvc?rev=1877397&view=rev
> Log:
> mod_ssl: Switch to using SSL_OP_NO_RENEGOTATION (where available) to
> block client-initiated renegotiation with TLSv1.2 and earlier.
> 
> * modules/ssl/ssl_private.h: Define modssl_reneg_state enum,
>   modssl_set_reneg_state function.
> 
> * modules/ssl/ssl_engine_io.c (bio_filter_out_write,
>   bio_filter_in_read): #ifdef-out reneg protection if
>   SSL_OP_NO_RENEGOTATION is defined.
> 
> * modules/ssl/ssl_engine_init.c (ssl_init_ctx_protocol):
>   Enable SSL_OP_NO_RENEGOTATION.
>   (ssl_init_ctx_callbacks): Only enable the "info" callback if
>   debug-level logging *or* OpenSSL doesn't support SSL_OP_NO_RENEGOTATION.
>   
> * modules/ssl/ssl_engine_kernel.c (ssl_hook_Access_classic): Use
>   modssl_set_reneg_state to set the reneg protection mode.
>   (ssl_hook_Access_modern): Drop manipulation of the reneg mode which
>   does nothing for TLSv1.3 already.
>   (ssl_callback_Info): Only enable reneg protection if
>   SSL_OP_NO_RENEGOTATION is *not* defined.
> 
> * modules/ssl/ssl_util_ssl.c (modssl_set_reneg_state): New function.
> 
> Modified:
>     httpd/httpd/trunk/CHANGES
>     httpd/httpd/trunk/modules/ssl/ssl_engine_init.c
>     httpd/httpd/trunk/modules/ssl/ssl_engine_io.c
>     httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c
>     httpd/httpd/trunk/modules/ssl/ssl_private.h
>     httpd/httpd/trunk/modules/ssl/ssl_util_ssl.c
> 

> Modified: httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c?rev=1877397&r1=1877396&r2=1877397&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c (original)
> +++ httpd/httpd/trunk/modules/ssl/ssl_engine_kernel.c Tue May  5 12:40:38 2020

> @@ -1182,8 +1182,6 @@ static int ssl_hook_Access_modern(reques
>                  return HTTP_FORBIDDEN;
>              }
>              
> -            old_state = sslconn->reneg_state;
> -            sslconn->reneg_state = RENEG_ALLOW;
>              modssl_set_app_data2(ssl, r);
>  
>              SSL_do_handshake(ssl);
> @@ -1193,7 +1191,6 @@ static int ssl_hook_Access_modern(reques
>               */
>              SSL_peek(ssl, peekbuf, 0);
>  
> -            sslconn->reneg_state = old_state;
>              modssl_set_app_data2(ssl, NULL);
>  
>              /*

I don't understand why this can be removed unconditionally.

Regards

Rüdiger


Re: svn commit: r1877397 - in /httpd/httpd/trunk: CHANGES modules/ssl/ssl_engine_init.c modules/ssl/ssl_engine_io.c modules/ssl/ssl_engine_kernel.c modules/ssl/ssl_private.h modules/ssl/ssl_util_ssl.c

Posted by Joe Orton <jo...@redhat.com>.
On Fri, May 15, 2020 at 11:20:51PM +0200, Yann Ylavic wrote:
> On Fri, May 15, 2020 at 8:59 PM Ruediger Pluem <rp...@apache.org> wrote:
> >
> > On 5/15/20 6:50 PM, Yann Ylavic wrote:
> > >
> > > Somehow this change (bisected) broke many framework tests for me:
> > > t/ssl/* and t/security/CVE-*, the ones using mod_ssl I suppose.
> > > This is with openssl 1.1.1, and "SSLProtocol all -TLSv1.3" (which is
> > > the default $sslproto in "Apache-Test/lib/Apache/TestSSLCA.pm").
> >
> > Good catch that it fails with these settings, I and I guess Travis as well
> > use more recent versions of Net::SSLeay such that $sslproto is set to "all".
> 
> Actually it was just Joe's keyboard needing a new "I" key :)
> Everything works for me now with r1877795.

Oh my... can I blame autocomplete for this one, somehow?

Thanks a lot, Yann!  I guess we can have a special travis test run which 
should catch that, will investigate.

Regards, Joe


Re: svn commit: r1877397 - in /httpd/httpd/trunk: CHANGES modules/ssl/ssl_engine_init.c modules/ssl/ssl_engine_io.c modules/ssl/ssl_engine_kernel.c modules/ssl/ssl_private.h modules/ssl/ssl_util_ssl.c

Posted by Yann Ylavic <yl...@gmail.com>.
On Fri, May 15, 2020 at 8:59 PM Ruediger Pluem <rp...@apache.org> wrote:
>
> On 5/15/20 6:50 PM, Yann Ylavic wrote:
> >
> > Somehow this change (bisected) broke many framework tests for me:
> > t/ssl/* and t/security/CVE-*, the ones using mod_ssl I suppose.
> > This is with openssl 1.1.1, and "SSLProtocol all -TLSv1.3" (which is
> > the default $sslproto in "Apache-Test/lib/Apache/TestSSLCA.pm").
>
> Good catch that it fails with these settings, I and I guess Travis as well
> use more recent versions of Net::SSLeay such that $sslproto is set to "all".

Actually it was just Joe's keyboard needing a new "I" key :)
Everything works for me now with r1877795.

Regards;
Yann.

Re: svn commit: r1877397 - in /httpd/httpd/trunk: CHANGES modules/ssl/ssl_engine_init.c modules/ssl/ssl_engine_io.c modules/ssl/ssl_engine_kernel.c modules/ssl/ssl_private.h modules/ssl/ssl_util_ssl.c

Posted by Ruediger Pluem <rp...@apache.org>.

On 5/15/20 6:50 PM, Yann Ylavic wrote:
> On Tue, May 5, 2020 at 2:40 PM <jo...@apache.org> wrote:
>>
>> Author: jorton
>> Date: Tue May  5 12:40:38 2020
>> New Revision: 1877397
>>
>> URL: http://svn.apache.org/viewvc?rev=1877397&view=rev
>> Log:
>> mod_ssl: Switch to using SSL_OP_NO_RENEGOTATION (where available) to
>> block client-initiated renegotiation with TLSv1.2 and earlier.
> 
> Somehow this change (bisected) broke many framework tests for me:
> t/ssl/* and t/security/CVE-*, the ones using mod_ssl I suppose.
> This is with openssl 1.1.1, and "SSLProtocol all -TLSv1.3" (which is
> the default $sslproto in "Apache-Test/lib/Apache/TestSSLCA.pm").

Good catch that it fails with these settings, I and I guess Travis as well
use more recent versions of Net::SSLeay such that $sslproto is set to "all".

Regards

Rüdiger

Re: svn commit: r1877397 - in /httpd/httpd/trunk: CHANGES modules/ssl/ssl_engine_init.c modules/ssl/ssl_engine_io.c modules/ssl/ssl_engine_kernel.c modules/ssl/ssl_private.h modules/ssl/ssl_util_ssl.c

Posted by Yann Ylavic <yl...@gmail.com>.
On Tue, May 5, 2020 at 2:40 PM <jo...@apache.org> wrote:
>
> Author: jorton
> Date: Tue May  5 12:40:38 2020
> New Revision: 1877397
>
> URL: http://svn.apache.org/viewvc?rev=1877397&view=rev
> Log:
> mod_ssl: Switch to using SSL_OP_NO_RENEGOTATION (where available) to
> block client-initiated renegotiation with TLSv1.2 and earlier.

Somehow this change (bisected) broke many framework tests for me:
t/ssl/* and t/security/CVE-*, the ones using mod_ssl I suppose.
This is with openssl 1.1.1, and "SSLProtocol all -TLSv1.3" (which is
the default $sslproto in "Apache-Test/lib/Apache/TestSSLCA.pm").

Everything works if TLSv1.3 is left alone (i.e. active), either by
using openssl < 1.1.1, or by removing "-TLSv1.3" from $sslproto in
TestSSLCA.pm.

Any idea?

Regards;
Yann.

PS: By the way the "-TLSv1.3" set by TestSSLCA.pm by default will
prevent httpd from starting with openssl < 1.1.1 since "TLSv1.3" is
not a recognized token then...