Blame SOURCES/IO-Socket-SSL-1.94-Respect-OpenSSL-default-ciphers-and-protocol-versions.patch

a8323a
From ffa8a34d793707a8a05652908b69fea7faeede7c Mon Sep 17 00:00:00 2001
a8323a
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
a8323a
Date: Thu, 7 Aug 2014 10:36:40 +0200
a8323a
Subject: [PATCH] Respect OpenSSL default ciphers and protocol versions
a8323a
MIME-Version: 1.0
a8323a
Content-Type: text/plain; charset=UTF-8
a8323a
Content-Transfer-Encoding: 8bit
a8323a
a8323a
If application did not specified cipher or protocol version,
a8323a
IO::Socket::SSL set them to 'ALL:!LOW' and 'SSLv23:!SSLv2'. This
a8323a
undermined global cryptogphic setting.
a8323a
a8323a
This patch disables these defaults hard-coded into IO::Socket::SSL and
a8323a
leves the decision on OpenSSL.
a8323a
a8323a
http://rt.cpan.org/Public/Bug/Display.html?id=97816
a8323a
https://bugzilla.redhat.com/show_bug.cgi?id=1127322
a8323a
Signed-off-by: Petr Písař <ppisar@redhat.com>
a8323a
---
a8323a
 lib/IO/Socket/SSL.pm | 13 +++++++------
a8323a
 t/dhe.t              |  1 +
a8323a
 2 files changed, 8 insertions(+), 6 deletions(-)
a8323a
a8323a
diff --git a/lib/IO/Socket/SSL.pm b/lib/IO/Socket/SSL.pm
a8323a
index 3e02e8f..eb4bd05 100644
a8323a
--- a/lib/IO/Socket/SSL.pm
a8323a
+++ b/lib/IO/Socket/SSL.pm
a8323a
@@ -34,13 +34,13 @@ use constant SSL_RECEIVED_SHUTDOWN => 2;
a8323a
 # global defaults
a8323a
 my %DEFAULT_SSL_ARGS = (
a8323a
     SSL_check_crl => 0,
a8323a
-    SSL_version => 'SSLv23:!SSLv2',
a8323a
+    SSL_version => '',
a8323a
     SSL_verify_callback => undef,
a8323a
     SSL_verifycn_scheme => undef,  # don't verify cn
a8323a
     SSL_verifycn_name => undef,    # use from PeerAddr/PeerHost
a8323a
     SSL_npn_protocols => undef,    # meaning depends whether on server or client side
a8323a
     SSL_honor_cipher_order => 0,   # client order gets preference
a8323a
-    SSL_cipher_list => 'ALL:!LOW',
a8323a
+    SSL_cipher_list => undef,
a8323a
 
a8323a
     # default for SSL_verify_mode should be SSL_VERIFY_PEER for client
a8323a
     # for now we keep the default of SSL_VERIFY_NONE but complain, if 
a8323a
@@ -1579,7 +1579,7 @@ sub new {
a8323a
 	return $ctx_object if ($ctx_object = ${*$ctx_object}{'_SSL_ctx'});
a8323a
     }
a8323a
 
a8323a
-    my $ver;
a8323a
+    my $ver='';
a8323a
     my $disable_ver = 0;
a8323a
     for (split(/\s*:\s*/,$arg_hash->{SSL_version})) {
a8323a
 	m{^(!?)(?:(SSL(?:v2|v3|v23|v2/3))|(TLSv1[12]?))$}i 
a8323a
@@ -2049,7 +2049,8 @@ to the specified version. All values are case-insensitive.
a8323a
 
a8323a
 You can limit to set of supported protocols by adding !version separated by ':'.
a8323a
 
a8323a
-The default SSL_version is 'SSLv23:!SSLv2' which means, that SSLv2, SSLv3 and TLSv1 
a8323a
+The default SSL_version is defined by underlying cryptographic library.
a8323a
+E.g. 'SSLv23:!SSLv2' means, that SSLv2, SSLv3 and TLSv1
a8323a
 are supported for initial protocol handshakes, but SSLv2 will not be accepted, leaving 
a8323a
 only SSLv3 and TLSv1. You can also use !TLSv11 and !TLSv12 to disable TLS versions
a8323a
 1.1 and 1.2 while allowing TLS version 1.0.
a8323a
@@ -2066,8 +2067,8 @@ given value, e.g. something like 'ALL:!LOW:!EXP:!ADH'. Look into the OpenSSL
a8323a
 documentation (L<http://www.openssl.org/docs/apps/ciphers.html#CIPHER_STRINGS>)
a8323a
 for more details.
a8323a
 
a8323a
-If this option is not set 'ALL:!LOW' will be used.
a8323a
-To use OpenSSL builtin default (whatever this is) set it to ''.
a8323a
+If this option is not set or is set to '', OpenSSL builtin default (whatever
a8323a
+this is) will be used.
a8323a
 
a8323a
 =item SSL_honor_cipher_order
a8323a
 
a8323a
diff --git a/t/dhe.t b/t/dhe.t
a8323a
index a2bf565..4010a26 100644
a8323a
--- a/t/dhe.t
a8323a
+++ b/t/dhe.t
a8323a
@@ -55,6 +55,7 @@ if ( !defined $pid ) {
a8323a
     close($server);
a8323a
     my $to_server = IO::Socket::SSL->new( 
a8323a
 	PeerAddr => $addr, 
a8323a
+	SSL_cipher_list => 'ALL:RSA:!aRSA',
a8323a
 	SSL_verify_mode => 0 ) || do {
a8323a
     	notok( "connect failed: $SSL_ERROR" );
a8323a
 	exit
a8323a
-- 
a8323a
1.9.3
a8323a