Blame SOURCES/freeradius-disable-internal-OpenSSL-cache.patch

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