653d32
From 4dd1bad726e993bcd43f16312acaf95596d35680 Mon Sep 17 00:00:00 2001
653d32
From: "Alan T. DeKok" <aland@freeradius.org>
653d32
Date: Mon, 8 May 2017 16:38:56 -0400
653d32
Subject: [PATCH] disable internal OpenSSL cache
653d32
653d32
(cherry picked from commit af030bd4e19c9149e2ffd898ad0c4dfde78c29be)
653d32
---
653d32
 raddb/mods-available/eap        | 18 ++++++++----------
653d32
 raddb/sites-available/abfab-tls |  3 ++-
653d32
 raddb/sites-available/tls       | 17 ++++++++---------
653d32
 src/main/tls.c                  |  4 ++--
653d32
 4 files changed, 20 insertions(+), 22 deletions(-)
653d32
653d32
diff --git a/raddb/mods-available/eap b/raddb/mods-available/eap
653d32
index 9659db1cd..bfbfe710e 100644
653d32
--- a/raddb/mods-available/eap
653d32
+++ b/raddb/mods-available/eap
653d32
@@ -382,6 +382,13 @@ eap {
653d32
 			#  Enable it.  The default is "no". Deleting the entire "cache"
653d32
 			#  subsection also disables caching.
653d32
 			#
653d32
+			#  As of version 3.0.13-4 (upstream 3.0.14), the
653d32
+			#  session cache requires the use of the "name" and
653d32
+			#  "persist_dir" configuration items, below.
653d32
+			#
653d32
+			#  The internal OpenSSL session cache has been permanently
653d32
+			#  disabled.
653d32
+			#
653d32
 			#  You can disallow resumption for a particular user by adding the
653d32
 			#  following attribute to the control item list:
653d32
 			#
653d32
@@ -390,7 +397,7 @@ eap {
653d32
 			#  If "enable = no" below, you CANNOT enable resumption for just one
653d32
 			#  user by setting the above attribute to "yes".
653d32
 			#
653d32
-			enable = yes
653d32
+			enable = no
653d32
 
653d32
 			#
653d32
 			#  Lifetime of the cached entries, in hours. The sessions will be
653d32
@@ -399,15 +406,6 @@ eap {
653d32
 			lifetime = 24 # hours
653d32
 
653d32
 			#
653d32
-			#  The maximum number of entries in the
653d32
-			#  cache.  Set to "0" for "infinite".
653d32
-			#
653d32
-			#  This could be set to the number of users
653d32
-			#  who are logged in... which can be a LOT.
653d32
-			#
653d32
-			max_entries = 255
653d32
-
653d32
-			#
653d32
 			#  Internal "name" of the session cache. Used to
653d32
 			#  distinguish which TLS context sessions belong to.
653d32
 			#
653d32
diff --git a/raddb/sites-available/abfab-tls b/raddb/sites-available/abfab-tls
653d32
index 79d74e6fc..5dbe143da 100644
653d32
--- a/raddb/sites-available/abfab-tls
653d32
+++ b/raddb/sites-available/abfab-tls
653d32
@@ -24,7 +24,8 @@ listen {
653d32
 		cache {
653d32
 			enable = no
653d32
 			lifetime = 24 # hours
653d32
-			max_entries = 255
653d32
+			name = "abfab-tls"
653d32
+#			persist_dir = ${logdir}/abfab-tls
653d32
 		}
653d32
 
653d32
 		require_client_cert = yes
653d32
diff --git a/raddb/sites-available/tls b/raddb/sites-available/tls
653d32
index c9555e1c7..eb39c659e 100644
653d32
--- a/raddb/sites-available/tls
653d32
+++ b/raddb/sites-available/tls
653d32
@@ -239,6 +239,14 @@ listen {
653d32
 		      #  Deleting the entire "cache" subsection
653d32
 		      #  Also disables caching.
653d32
 		      #
653d32
+		      #
653d32
+		      #  As of version 3.0.13-4 (upstream 3.0.14), the session
653d32
+		      #  cache requires the use of the "name" and
653d32
+		      #  "persist_dir" configuration items, below.
653d32
+		      #
653d32
+		      #  The internal OpenSSL session cache has been permanently
653d32
+		      #  disabled.
653d32
+		      #
653d32
 		      #  You can disallow resumption for a
653d32
 		      #  particular user by adding the following
653d32
 		      #  attribute to the control item list:
653d32
@@ -259,15 +267,6 @@ listen {
653d32
 		      lifetime = 24 # hours
653d32
 
653d32
 		      #
653d32
-		      #  The maximum number of entries in the
653d32
-		      #  cache.  Set to "0" for "infinite".
653d32
-		      #
653d32
-		      #  This could be set to the number of users
653d32
-		      #  who are logged in... which can be a LOT.
653d32
-		      #
653d32
-		      max_entries = 255
653d32
-
653d32
-		      #
653d32
 		      #  Internal "name" of the session cache.
653d32
 		      #  Used to distinguish which TLS context
653d32
 		      #  sessions belong to.
653d32
diff --git a/src/main/tls.c b/src/main/tls.c
653d32
index a72be2b63..e992062dc 100644
653d32
--- a/src/main/tls.c
653d32
+++ b/src/main/tls.c
653d32
@@ -2937,9 +2937,9 @@ post_ca:
653d32
 		}
653d32
 
653d32
 		/*
653d32
-		 *	Cache it, and DON'T auto-clear it.
653d32
+		 *	Cache it, DON'T auto-clear it, and disable the internal OpenSSL session cache.
653d32
 		 */
653d32
-		SSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
653d32
+		SSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR | SSL_SESS_CACHE_NO_INTERNAL);
653d32
 
653d32
 		SSL_CTX_set_session_id_context(ctx,
653d32
 					       (unsigned char *) conf->session_context_id,
653d32
-- 
653d32
2.11.0
653d32