Blame SOURCES/mod_nss-session_cache.patch

154a6e
From 5709d481a3cd327c157a1f39a2e9018e0feefd75 Mon Sep 17 00:00:00 2001
154a6e
From: Rob Crittenden <rcritten@redhat.com>
154a6e
Date: Tue, 7 Feb 2017 10:46:56 -0500
154a6e
Subject: [PATCH] Fix the TLS Session ID cache
154a6e
154a6e
At some point that I never noticed the way I was trying to
154a6e
determine whether the worker or prefork model was being used
154a6e
broke such that the reverse of what I intended was happening
154a6e
causing no session ID caching at all.
154a6e
154a6e
My first crack at this fixed the query to be used which fixed
154a6e
the prefork model but the worker model was only caching about
154a6e
20% of requests. This is because it is a hybrid of
154a6e
forked/threading so still needs the MP cache.
154a6e
154a6e
By configuring MP for all I now get the expected level of
154a6e
caching. I used the NSS tool strsclnt to confirm levels of
154a6e
caching.
154a6e
---
154a6e
 nss_engine_init.c | 19 +++++--------------
154a6e
 1 file changed, 5 insertions(+), 14 deletions(-)
154a6e
154a6e
diff --git a/nss_engine_init.c b/nss_engine_init.c
154a6e
index aec845a..2ffff53 100644
154a6e
--- a/nss_engine_init.c
154a6e
+++ b/nss_engine_init.c
154a6e
@@ -430,7 +430,6 @@ int nss_init_Module(apr_pool_t *p, apr_pool_t *plog,
154a6e
     server_rec *s;
154a6e
     int sslenabled = FALSE;
154a6e
     int fipsenabled = FALSE;
154a6e
-    int threaded = 0;
154a6e
     struct semid_ds status;
154a6e
     char *split_vhost_id = NULL;
154a6e
     char *last1;
154a6e
@@ -637,11 +636,7 @@ int nss_init_Module(apr_pool_t *p, apr_pool_t *plog,
154a6e
 
154a6e
     ap_log_error(APLOG_MARK, APLOG_INFO, 0, base_server,
154a6e
         "Initializing SSL Session Cache of size %d. SSL3/TLS timeout = %d.", mc->session_cache_size, mc->ssl3_session_cache_timeout);
154a6e
-    ap_mpm_query(AP_MPMQ_MAX_THREADS, &threaded);
154a6e
-    if (!threaded)
154a6e
-        SSL_ConfigMPServerSIDCache(mc->session_cache_size, (PRUint32) mc->session_cache_timeout, (PRUint32) mc->ssl3_session_cache_timeout, NULL);
154a6e
-    else
154a6e
-        SSL_ConfigServerSessionIDCache(mc->session_cache_size, (PRUint32) mc->session_cache_timeout, (PRUint32) mc->ssl3_session_cache_timeout, NULL);
154a6e
+    SSL_ConfigMPServerSIDCache(mc->session_cache_size, (PRUint32) mc->session_cache_timeout, (PRUint32) mc->ssl3_session_cache_timeout, NULL);
154a6e
 
154a6e
     /* Load our layer */
154a6e
     nss_io_layer_init();
154a6e
@@ -1525,7 +1520,6 @@ void nss_init_Child(apr_pool_t *p, server_rec *base_server)
154a6e
     SSLModConfigRec *mc = myModConfig(base_server);
154a6e
     SSLSrvConfigRec *sc;
154a6e
     server_rec *s;
154a6e
-    int threaded = 0;
154a6e
     int sslenabled = FALSE;
154a6e
 
154a6e
     mc->pid = getpid(); /* only call getpid() once per-process */
154a6e
@@ -1555,13 +1549,10 @@ void nss_init_Child(apr_pool_t *p, server_rec *base_server)
154a6e
         return;
154a6e
     }
154a6e
 
154a6e
-    ap_mpm_query(AP_MPMQ_MAX_THREADS, &threaded);
154a6e
-    if (!threaded) {
154a6e
-        if (SSL_InheritMPServerSIDCache(NULL) != SECSuccess) {
154a6e
-            ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
154a6e
-                         "SSL_InheritMPServerSIDCache failed");
154a6e
-            nss_log_nss_error(APLOG_MARK, APLOG_ERR, NULL);
154a6e
-        }
154a6e
+    if (SSL_InheritMPServerSIDCache(NULL) != SECSuccess) {
154a6e
+        ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
154a6e
+                     "SSL_InheritMPServerSIDCache failed");
154a6e
+        nss_log_nss_error(APLOG_MARK, APLOG_ERR, NULL);
154a6e
     }
154a6e
 
154a6e
     nss_init_SSLLibrary(base_server, mc->pPool);
154a6e
-- 
154a6e
2.9.4
154a6e