Blame SOURCES/freeradius-add-disable-openssl-version-check.patch

75e927
From 10636fbfd51320c8ca8b40651bf3e959211ca921 Mon Sep 17 00:00:00 2001
75e927
From: Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com>
75e927
Date: Tue, 21 Oct 2014 18:30:05 +0300
75e927
Subject: [PATCH 1/1] Add --disable-openssl-version-check option
75e927
75e927
Add "--disable-openssl-version-check" configure option, which removes
75e927
checking for vulnerable OpenSSL versions. It is supposed to be used by
75e927
downstream packagers and distributions who have other means to ensure
75e927
vulnerabilities are fixed, such as versioned package dependencies and
75e927
vulnerability handling processes.
75e927
75e927
This avoids the necessity of editing radiusd.conf on package upgrade to
75e927
make sure it keeps working. At the same time, it provides safe default
75e927
to those installing FreeRADIUS from source.
75e927
---
75e927
 configure                 | 30 ++++++++++++++++++++++++++++++
75e927
 configure.ac              | 26 ++++++++++++++++++++++++++
75e927
 raddb/radiusd.conf.in     | 10 +---------
75e927
 src/include/autoconf.h.in |  3 +++
75e927
 src/include/radiusd.h     |  2 ++
75e927
 src/include/tls-h         |  2 ++
75e927
 src/main/mainconfig.c     |  2 ++
75e927
 src/main/radiusd.c        |  2 ++
75e927
 src/main/tls.c            |  4 ++++
75e927
 9 files changed, 72 insertions(+), 9 deletions(-)
75e927
75e927
diff --git a/configure b/configure
75e927
index 1b54efd..addfeba 100755
75e927
--- a/configure
75e927
+++ b/configure
75e927
@@ -652,6 +652,7 @@ RUSERS
75e927
 SNMPWALK
75e927
 SNMPGET
75e927
 PERL
75e927
+openssl_version_check_config
75e927
 modconfdir
75e927
 dictdir
75e927
 raddbdir
75e927
@@ -754,6 +755,7 @@ with_rlm_FOO_include_dir
75e927
 with_openssl
75e927
 with_openssl_lib_dir
75e927
 with_openssl_include_dir
75e927
+enable_openssl_version_check
75e927
 with_talloc_lib_dir
75e927
 with_talloc_include_dir
75e927
 with_pcap_lib_dir
75e927
@@ -1396,6 +1398,9 @@ Optional Features:
75e927
   --disable-largefile     omit support for large files
75e927
   --enable-strict-dependencies  fail configure on lack of module dependancy.
75e927
   --enable-werror         causes the build to fail if any warnings are generated.
75e927
+  --disable-openssl-version-check
75e927
+                          disable vulnerable OpenSSL version check
75e927
+
75e927
 
75e927
 Optional Packages:
75e927
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
75e927
@@ -5430,6 +5435,31 @@ if test "${with_openssl_include_dir+set}" = set; then :
75e927
 fi
75e927
 
75e927
 
75e927
+# Check whether --enable-openssl-version-check was given.
75e927
+if test "${enable_openssl_version_check+set}" = set; then :
75e927
+  enableval=$enable_openssl_version_check;
75e927
+fi
75e927
+
75e927
+if test "x$enable_openssl_version_check" != "xno"; then
75e927
+
75e927
+$as_echo "#define ENABLE_OPENSSL_VERSION_CHECK 1" >>confdefs.h
75e927
+
75e927
+  openssl_version_check_config="\
75e927
+	#
75e927
+	#  allow_vulnerable_openssl: Allow the server to start with
75e927
+	#  versions of OpenSSL known to have critical vulnerabilities.
75e927
+	#
75e927
+	#  This check is based on the version number reported by libssl
75e927
+	#  and may not reflect patches applied to libssl by
75e927
+	#  distribution maintainers.
75e927
+	#
75e927
+	allow_vulnerable_openssl = no"
75e927
+else
75e927
+  openssl_version_check_config=
75e927
+fi
75e927
+
75e927
+
75e927
+
75e927
 
75e927
 CHECKRAD=checkrad
75e927
 # Extract the first word of "perl", so it can be a program name with args.
75e927
diff --git a/configure.ac b/configure.ac
75e927
index 30b226b..b223505 100644
75e927
--- a/configure.ac
75e927
+++ b/configure.ac
75e927
@@ -576,6 +576,32 @@ AC_ARG_WITH(openssl-include-dir,
75e927
   esac ]
75e927
 )
75e927
 
75e927
+dnl #
75e927
+dnl #  extra argument: --disable-openssl-version-check
75e927
+dnl #
75e927
+AC_ARG_ENABLE(openssl-version-check,
75e927
+[AS_HELP_STRING([--disable-openssl-version-check],
75e927
+                [disable vulnerable OpenSSL version check])]
75e927
+)
75e927
+if test "x$enable_openssl_version_check" != "xno"; then
75e927
+  AC_DEFINE(ENABLE_OPENSSL_VERSION_CHECK, [1],
75e927
+            [Define to 1 to have OpenSSL version check enabled])
75e927
+  openssl_version_check_config="\
75e927
+	#
75e927
+	#  allow_vulnerable_openssl: Allow the server to start with
75e927
+	#  versions of OpenSSL known to have critical vulnerabilities.
75e927
+	#
75e927
+	#  This check is based on the version number reported by libssl
75e927
+	#  and may not reflect patches applied to libssl by
75e927
+	#  distribution maintainers.
75e927
+	#
75e927
+	allow_vulnerable_openssl = no"
75e927
+else
75e927
+  openssl_version_check_config=
75e927
+fi
75e927
+AC_SUBST([openssl_version_check_config])
75e927
+
75e927
+
75e927
 dnl #############################################################
75e927
 dnl #
75e927
 dnl #  1. Checks for programs
75e927
diff --git a/raddb/radiusd.conf.in b/raddb/radiusd.conf.in
75e927
index 307ae10..0e1ff46 100644
75e927
--- a/raddb/radiusd.conf.in
75e927
+++ b/raddb/radiusd.conf.in
75e927
@@ -475,15 +475,7 @@ security {
75e927
 	#
75e927
 	status_server = yes
75e927
 
75e927
-	#
75e927
-	#  allow_vulnerable_openssl: Allow the server to start with
75e927
-	#  versions of OpenSSL known to have critical vulnerabilities.
75e927
-	#
75e927
-	#  This check is based on the version number reported by libssl
75e927
-	#  and may not reflect patches applied to libssl by
75e927
-	#  distribution maintainers.
75e927
-	#
75e927
-	allow_vulnerable_openssl = no
75e927
+@openssl_version_check_config@
75e927
 }
75e927
 
75e927
 # PROXY CONFIGURATION
75e927
diff --git a/src/include/autoconf.h.in b/src/include/autoconf.h.in
75e927
index c313bca..f500049 100644
75e927
--- a/src/include/autoconf.h.in
75e927
+++ b/src/include/autoconf.h.in
75e927
@@ -9,6 +9,9 @@
75e927
 /* style of ctime_r function */
75e927
 #undef CTIMERSTYLE
75e927
 
75e927
+/* Define to 1 to have OpenSSL version check enabled */
75e927
+#undef ENABLE_OPENSSL_VERSION_CHECK
75e927
+
75e927
 /* style of gethostbyaddr_r functions */
75e927
 #undef GETHOSTBYADDRRSTYLE
75e927
 
75e927
diff --git a/src/include/radiusd.h b/src/include/radiusd.h
75e927
index ebe3a21..1ec6959 100644
75e927
--- a/src/include/radiusd.h
75e927
+++ b/src/include/radiusd.h
75e927
@@ -437,7 +437,9 @@ typedef struct main_config_t {
75e927
 #endif
75e927
 	uint32_t	reject_delay;
75e927
 	bool		status_server;
75e927
+#ifdef ENABLE_OPENSSL_VERSION_CHECK
75e927
 	char const	*allow_vulnerable_openssl;
75e927
+#endif
75e927
 
75e927
 	uint32_t	max_request_time;
75e927
 	uint32_t	cleanup_delay;
75e927
diff --git a/src/include/tls-h b/src/include/tls-h
75e927
index ade93d5..1418ea2 100644
75e927
--- a/src/include/tls-h
75e927
+++ b/src/include/tls-h
75e927
@@ -295,7 +295,9 @@ int		cbtls_verify(int ok, X509_STORE_CTX *ctx);
75e927
 
75e927
 /* TLS */
75e927
 void		tls_global_init(void);
75e927
+#ifdef ENABLE_OPENSSL_VERSION_CHECK
75e927
 int		tls_global_version_check(char const *acknowledged);
75e927
+#endif
75e927
 void		tls_global_cleanup(void);
75e927
 tls_session_t	*tls_new_session(TALLOC_CTX *ctx, fr_tls_server_conf_t *conf, REQUEST *request, bool client_cert);
75e927
 tls_session_t	*tls_new_client_session(fr_tls_server_conf_t *conf, int fd);
75e927
diff --git a/src/main/mainconfig.c b/src/main/mainconfig.c
75e927
index cf1eea5..76979ad 100644
75e927
--- a/src/main/mainconfig.c
75e927
+++ b/src/main/mainconfig.c
75e927
@@ -99,7 +99,9 @@ static const CONF_PARSER security_config[] = {
75e927
 	{ "max_attributes",  FR_CONF_POINTER(PW_TYPE_INTEGER, &fr_max_attributes), STRINGIFY(0) },
75e927
 	{ "reject_delay",  FR_CONF_POINTER(PW_TYPE_INTEGER, &main_config.reject_delay), STRINGIFY(0) },
75e927
 	{ "status_server", FR_CONF_POINTER(PW_TYPE_BOOLEAN, &main_config.status_server), "no"},
75e927
+#ifdef ENABLE_OPENSSL_VERSION_CHECK
75e927
 	{ "allow_vulnerable_openssl", FR_CONF_POINTER(PW_TYPE_STRING, &main_config.allow_vulnerable_openssl), "no"},
75e927
+#endif
75e927
 	{ NULL, -1, 0, NULL, NULL }
75e927
 };
75e927
 
75e927
diff --git a/src/main/radiusd.c b/src/main/radiusd.c
75e927
index 620d7d4..fe8057d 100644
75e927
--- a/src/main/radiusd.c
75e927
+++ b/src/main/radiusd.c
75e927
@@ -359,10 +359,12 @@ int main(int argc, char *argv[])
75e927
 
75e927
 	/*  Check for vulnerabilities in the version of libssl were linked against */
75e927
 #ifdef HAVE_OPENSSL_CRYPTO_H
75e927
+#ifdef ENABLE_OPENSSL_VERSION_CHECK
75e927
 	if (tls_global_version_check(main_config.allow_vulnerable_openssl) < 0) {
75e927
 		exit(EXIT_FAILURE);
75e927
 	}
75e927
 #endif
75e927
+#endif
75e927
 
75e927
 	/*
75e927
 	 *  Load the modules
75e927
diff --git a/src/main/tls.c b/src/main/tls.c
75e927
index 542ce69..42b538c 100644
75e927
--- a/src/main/tls.c
75e927
+++ b/src/main/tls.c
75e927
@@ -51,6 +51,7 @@ USES_APPLE_DEPRECATED_API	/* OpenSSL API has been deprecated by Apple */
75e927
 #include <openssl/ocsp.h>
75e927
 #endif
75e927
 
75e927
+#ifdef ENABLE_OPENSSL_VERSION_CHECK
75e927
 typedef struct libssl_defect {
75e927
 	uint64_t	high;
75e927
 	uint64_t	low;
75e927
@@ -71,6 +72,7 @@ static libssl_defect_t libssl_defects[] =
75e927
 		.comment	= "For more information see http://heartbleed.com"
75e927
 	}
75e927
 };
75e927
+#endif
75e927
 
75e927
 /* record */
75e927
 static void 		record_init(record_t *buf);
75e927
@@ -2063,6 +2065,7 @@ void tls_global_init(void)
75e927
 	OPENSSL_config(NULL);
75e927
 }
75e927
 
75e927
+#ifdef ENABLE_OPENSSL_VERSION_CHECK
75e927
 /** Check for vulnerable versions of libssl
75e927
  *
75e927
  * @param acknowledged The highest CVE number a user has confirmed is not present in the system's libssl.
75e927
@@ -2101,6 +2104,7 @@ int tls_global_version_check(char const *acknowledged)
75e927
 
75e927
 	return 0;
75e927
 }
75e927
+#endif
75e927
 
75e927
 /** Free any memory alloced by libssl
75e927
  *
75e927
-- 
75e927
2.1.1
75e927