Backport configurable SSL version feature from upstream and update man page accordingly

This commit is contained in:
Vitezslav Crhonek 2015-08-10 15:47:22 +02:00
parent 62656f53af
commit acd5242dab
2 changed files with 66 additions and 1 deletions

View File

@ -0,0 +1,59 @@
diff -up sblim-wbemcli-1.6.1/CimCurl.cpp.orig sblim-wbemcli-1.6.1/CimCurl.cpp
--- sblim-wbemcli-1.6.1/CimCurl.cpp.orig 2009-03-04 20:10:54.000000000 +0100
+++ sblim-wbemcli-1.6.1/CimCurl.cpp 2015-08-10 13:59:47.312019828 +0200
@@ -165,8 +165,36 @@ void CimomCurl::genRequest(URL &url, con
rv = curl_easy_setopt(mHandle, CURLOPT_SSL_VERIFYHOST, 0);
// rv = curl_easy_setopt(mHandle, CURLOPT_SSL_VERIFYPEER, 0);
- /* Force using SSL V3 */
- rv = curl_easy_setopt(mHandle, CURLOPT_SSLVERSION, 3);
+ /* Force use of a specific SSL/TLS version */
+ char * curlSslVer = getenv("WBEMCLI_CURL_SSLVERSION");
+ if (curlSslVer) {
+ if (!strcasecmp(curlSslVer,"SSLv2"))
+ rv = curl_easy_setopt(mHandle, CURLOPT_SSLVERSION, CURL_SSLVERSION_SSLv2);
+ else if (!strcasecmp(curlSslVer,"SSLv3"))
+ rv = curl_easy_setopt(mHandle, CURLOPT_SSLVERSION, CURL_SSLVERSION_SSLv3);
+ else if (!strcasecmp(curlSslVer,"TLSv1"))
+ rv = curl_easy_setopt(mHandle, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
+ else if (!strcasecmp(curlSslVer,"TLSv1.0") || !strcasecmp(curlSslVer,"TLSv1_0"))
+#if LIBCURL_VERSION_NUM >= 0x072200
+ rv = curl_easy_setopt(mHandle, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_0);
+#else
+ throw URLException("WBEMCLI_CURL_SSLVERSION=TLSv1.0 requires libcurl 7.34 or greater");
+#endif
+ else if (!strcasecmp(curlSslVer,"TLSv1.1") || !strcasecmp(curlSslVer,"TLSv1_1"))
+#if LIBCURL_VERSION_NUM >= 0x072200
+ rv = curl_easy_setopt(mHandle, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_1);
+#else
+ throw URLException("WBEMCLI_CURL_SSLVERSION=TLSv1.1 requires libcurl 7.34 or greater");
+#endif
+ else if (!strcasecmp(curlSslVer,"TLSv1.2") || !strcasecmp(curlSslVer,"TLSv1_2"))
+#if LIBCURL_VERSION_NUM >= 0x072200
+ rv = curl_easy_setopt(mHandle, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
+#else
+ throw URLException("WBEMCLI_CURL_SSLVERSION=TLSv1.2 requires libcurl 7.34 or greater");
+#endif
+ else
+ throw URLException("unknown WBEMCLI_CURL_SSLVERSION");
+ }
/* Set username and password */
if (url.user.length() > 0 && url.password.length() > 0) {
diff -up sblim-wbemcli-1.6.1/man/wbemcli.1.pre.in.orig sblim-wbemcli-1.6.1/man/wbemcli.1.pre.in
--- sblim-wbemcli-1.6.1/man/wbemcli.1.pre.in.orig 2015-08-10 14:00:11.217163540 +0200
+++ sblim-wbemcli-1.6.1/man/wbemcli.1.pre.in 2015-08-10 14:00:31.215283763 +0200
@@ -554,6 +554,13 @@ The example in the previous section can
wbemcli gi 'myCimom/root/cimv2:rpm_package.name="glibc"'
.PP
+.SH ENVIRONMENT
+.TP
+.B WBEMCLI_CURL_SSLVERSION
+Specifies the SSL protocol that will be used.
+Valid values are SSLv2, SSLv3, TLSv1, TLSv1.0, TLSv1.1 or TLSv1.2.
+If this variable is not set, wbemcli will attempt to figure out the
+remote SSL protocol version.
.SH FILES
.TP
.I @CACERT@

View File

@ -1,6 +1,6 @@
Name: sblim-wbemcli
Version: 1.6.3
Release: 3%{?dist}
Release: 4%{?dist}
Summary: SBLIM WBEM Command Line Interface
Group: Applications/System
@ -9,6 +9,7 @@ URL: http://sblim.wiki.sourceforge.net/
Source0: http://downloads.sourceforge.net/sblim/%{name}-%{version}.tar.bz2
Patch0: sblim-wbemcli-1.5.1-gcc43.patch
Patch1: sblim-wbemcli-1.6.2-https-segfaults.patch
Patch2: sblim-wbemcli-1.6.1-ssl-proto-option.patch
BuildRequires: curl-devel >= 7.9.3
BuildRequires: binutils-devel >= 2.17.50.0.3-4
@ -25,6 +26,7 @@ scripts.
autoreconf --install --force
%patch0 -p1 -b .gcc43
%patch1 -p1 -b .https-segfaults
%patch2 -p1 -b .ssl-proto-option
%build
%configure CACERT=/etc/Pegasus/client.pem
@ -40,6 +42,10 @@ mkdir -p $RPM_BUILD_ROOT/%{_datadir}/%{name}
%{_datadir}/%{name}
%changelog
* Mon Aug 10 2015 Vitezslav Crhonek <vcrhonek@redhat.com> - 1.6.3-4
- Backport configurable SSL version feature from upstream and update man
page accordingly
* Fri Jun 19 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild