Bug 1044401 - Net::SSLeay does not support setting elliptic curve parameters
Net::SSLeay does not support setting elliptic curve parameters
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: perl-Net-SSLeay (Show other bugs)
6.5
x86_64 Linux
high Severity medium
: rc
: ---
Assigned To: Petr Pisar
Stanislav Zidek
Lenka Spackova
http://cpansearch.perl.org/src/MIKEM/...
: FutureFeature, Patch
Depends On:
Blocks: 1002711 1070830 1075802 1159820 1172231 1078084 1254457 1269913
  Show dependency treegraph
 
Reported: 2013-12-18 04:20 EST by Antti Siira
Modified: 2016-05-11 03:07 EDT (History)
15 users (show)

See Also:
Fixed In Version: perl-Net-SSLeay-1.35-10.el6
Doc Type: Release Note
Doc Text:
Perl *Net:SSLeay* now supports elliptic curve parameters Support for elliptic-curve parameters has been added to the Perl *Net:SSLeay* module, which contains bindings to the OpenSSL library. Namely, the `EC_KEY_new_by_curve_name()`, `EC_KEY_free*()`, `SSL_CTX_set_tmp_ecdh()`, and `OBJ_txt2nid()` subroutines have been ported from upstream. This is required for the support of the Elliptic Curve Diffie–Hellman Exchange (ECDHE) key exchange in the *IO::Socket::SSL* Perl module.
Story Points: ---
Clone Of:
: 1078084 1090952 1090966 1316379 (view as bug list)
Environment:
Last Closed: 2016-05-10 16:06:03 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Template for the reproducer (10.00 KB, application/octet-stream)
2014-02-27 09:15 EST, Petr Pisar
no flags Details
Upstream ECDHE support ported to 1.35 (1.30 KB, patch)
2014-03-19 07:09 EDT, Petr Pisar
no flags Details | Diff
OBJ_txt2nid export ported to 1.35 (883 bytes, patch)
2014-03-19 09:58 EDT, Petr Pisar
no flags Details | Diff

  None (edit)
Description Antti Siira 2013-12-18 04:20:09 EST
Description of problem:
LDAPS connection fails with error: "IO::Socket::SSL: SSL connect attempt failed with unknown errorerror:100AE081:elliptic curve routines:EC_GROUP_new_by_curve_name:unknown group"

Version-Release number of selected component (if applicable):
openssl-1.0.1e-15.el6.x86_64
openssl-1.0.1e-16.el6_5.x86_64

How reproducible:
#!/usr/bin/perl                                                                 

sub ldap_query {
        use Net::LDAPS;

        my $conn = Net::LDAPS->new('ldap.example.com',
                                 version => 3,
                                 port => 636,
                                 capath => '/etc/openldap/cacerts/',
                                 raw => qr/^$/
                               ) || die "$@\n";

        $conn->disconnect();
        return 0;
}

my $test = ldap_query();

Steps to Reproduce:
1. Run above script against suitable ldap-server
2.
3.

Actual results:
IO::Socket::SSL: SSL connect attempt failed with unknown errorerror:100AE081:elliptic curve routines:EC_GROUP_new_by_curve_name:unknown group

Expected results:
Empty output

Additional info:
Downgrade to openssl-1.0.0-27.el6_4.2.x86_64 solves the issue.
Comment 1 Tomas Mraz 2013-12-18 05:29:07 EST
Are you sure this happens with openssl-1.0.1e-16.el6_5.x86_64?
Comment 2 Antti Siira 2013-12-30 03:01:30 EST
[antti@XXXXX ~]$ ./test.pm
IO::Socket::SSL: SSL connect attempt failed with unknown errorerror:100AE081:elliptic curve routines:EC_GROUP_new_by_curve_name:unknown group
[antti@XXXXX ~]$ yum info openssl
Loaded plugins: product-id, rhnplugin, security, subscription-manager
*Note* Red Hat Network repositories are not listed below. You must run this command as root to access RHN repositories.
Installed Packages
Name        : openssl
Arch        : x86_64
Version     : 1.0.1e
Release     : 16.el6_5.1
Size        : 4.0 M
Repo        : installed
From repo   : rhel-x86_64-server-6
Summary     : A general purpose cryptography library with TLS implementation
URL         : http://www.openssl.org/
License     : OpenSSL
Description : The OpenSSL toolkit provides support for secure communications
            : between machines. OpenSSL includes a certificate management tool
            : and shared libraries which provide various cryptographic
            : algorithms and protocols.
Comment 3 Tomas Mraz 2013-12-30 03:56:35 EST
Can you attach the LDAPS server certificates? Both CA and server.
Comment 4 Antti Siira 2013-12-30 05:10:27 EST
Here is the list of SSL ciphers supported by the remote server. Does this answer your question or do you need the actual certificates?

  Low Strength Ciphers (< 56-bit key)
    SSLv3
      EXP-RC2-CBC-MD5              Kx=RSA(512)    Au=RSA      Enc=RC2(40)              Mac=MD5    export     
      EXP-RC4-MD5                  Kx=RSA(512)    Au=RSA      Enc=RC4(40)              Mac=MD5    export     

    TLSv1
      EXP-RC2-CBC-MD5              Kx=RSA(512)    Au=RSA      Enc=RC2-CBC(40)          Mac=MD5    export     
      EXP-RC4-MD5                  Kx=RSA(512)    Au=RSA      Enc=RC4(40)              Mac=MD5    export     

  Medium Strength Ciphers (>= 56-bit and < 112-bit key)
    SSLv3
      DES-CBC-SHA                  Kx=RSA         Au=RSA      Enc=DES-CBC(56)          Mac=SHA1   

    TLSv1
      EXP1024-DES-CBC-SHA          Kx=RSA(1024)   Au=RSA      Enc=DES-CBC(56)          Mac=SHA1   export     
      EXP1024-RC4-SHA              Kx=RSA(1024)   Au=RSA      Enc=RC4(56)              Mac=SHA1   export     
      DES-CBC-SHA                  Kx=RSA         Au=RSA      Enc=DES-CBC(56)          Mac=SHA1   

  High Strength Ciphers (>= 112-bit key)
    SSLv3
      DES-CBC3-SHA                 Kx=RSA         Au=RSA      Enc=3DES(168)            Mac=SHA1   
      RC4-MD5                      Kx=RSA         Au=RSA      Enc=RC4(128)             Mac=MD5    
      RC4-SHA                      Kx=RSA         Au=RSA      Enc=RC4(128)             Mac=SHA1   

    TLSv1
      ECDHE-RSA-DES-CBC3-SHA       Kx=ECDH        Au=RSA      Enc=3DES-CBC(168)        Mac=SHA1   
      ECDHE-RSA-AES128-SHA         Kx=ECDH        Au=RSA      Enc=AES-CBC(128)         Mac=SHA1   
      ECDHE-RSA-AES256-SHA         Kx=ECDH        Au=RSA      Enc=AES-CBC(256)         Mac=SHA1   
      ECDHE-RSA-RC4-SHA            Kx=ECDH        Au=RSA      Enc=RC4(128)             Mac=SHA1   
      DES-CBC3-SHA                 Kx=RSA         Au=RSA      Enc=3DES-CBC(168)        Mac=SHA1   
      AES128-SHA                   Kx=RSA         Au=RSA      Enc=AES-CBC(128)         Mac=SHA1   
      AES256-SHA                   Kx=RSA         Au=RSA      Enc=AES-CBC(256)         Mac=SHA1   
      CAMELLIA128-SHA              Kx=RSA         Au=RSA      Enc=Camellia-CBC(128)    Mac=SHA1   
      CAMELLIA256-SHA              Kx=RSA         Au=RSA      Enc=Camellia-CBC(256)    Mac=SHA1   
      RC4-MD5                      Kx=RSA         Au=RSA      Enc=RC4(128)             Mac=MD5    
      RC4-SHA                      Kx=RSA         Au=RSA      Enc=RC4(128)             Mac=SHA1   
      SEED-SHA                     Kx=RSA         Au=RSA      Enc=SEED-CBC(128)        Mac=SHA1
Comment 5 Tomas Mraz 2013-12-30 16:42:00 EST
I need to know if the server uses ECDSA in the certificate. But according to the list above it does not seem so because the authentication is RSA based. Does any connection attempt happen at all, or does it break later after the TLS Client hello is sent? Can you investigate it with wireshark?
Comment 6 Antti Siira 2013-12-31 02:04:04 EST
I compared the attempts with current openssl and with downgraded openssl.

The downgraded (functioning) openssl:
C: Client Hello
S: Server Hello, Certificate, Certificate Request, Server Hello Done
C: Certificate, Client Key Exchange, Change Cipher Spec, Encrypted Handshake Message
S: Change Cipher Spec, Encrypted Handshake Message

The current (malfunctioning) openssl:
C: Ignored Unknown Record
S: Server Hello, Certificate, Server Key Exchange, Certificate Request, Server Hello Done
Comment 8 John Wagner 2014-01-03 16:12:08 EST
Anything further on this?  Having same results.

IO::Socket::SSL: SSL connect attempt failed with unknown errorerror:100AE081:elliptic curve routines:EC_GROUP_new_by_curve_name:unknown group at ./m3.pl line 67, <DATA> line 522.

Downgraded to the 6.4 rpm and it works.
Comment 9 Tomas Mraz 2014-01-06 09:13:39 EST
Unfortunately I am still unable to reproduce the problem. There must be something peculiar with the server.
Comment 10 John Wagner 2014-01-06 14:08:53 EST
I'm using ODSEE 11.1.1.7.0 (which for this case is running on same sandbox)
Sun-Directory-Server/11.1.1.7.0 B2013.0109.2015 (64-bit) 

The connection error:

[06/Jan/2014:08:08:34 -0700] conn=56 op=-1 msgId=-1 - fd=33 slot=33 LDAPS connection from 10.0.0.211:58117 to 10.0.0.211
[06/Jan/2014:08:08:34 -0700] conn=56 op=0 msgId=-1 - closing from 10.0.0.211:58117 - B4 - Server failed to flush BER data back to client -
[06/Jan/2014:08:08:34 -0700] conn=56 op=-1 msgId=-1 - closed.
[06/Jan/2014:08:08:43 -0700] conn=57 op=-1 msgId=-1 - fd=33 slot=33 LDAPS connection from 10.0.0.211:40940 to 10.0.0.211
[06/Jan/2014:08:08:43 -0700] conn=57 op=0 msgId=-1 - closing from 10.0.0.211:40940 - B4 - Server failed to flush BER data back to client -
[06/Jan/2014:08:08:43 -0700] conn=57 op=-1 msgId=-1 - closed.

I've tried with both self-signed certs and our company certs/ca chain and get same error.

I did just attempt a quick test to OpenDJ (OpenDJ 2.7.0-20140102 (build 20140102010058Z, R10055) with just self-signed certs and it appeared to work.

Which DS server did you try to reproduce to?

It will take some time/work to test against other Directory Servers (older ODSEE on Solaris) as for now this is in a self-contained sandbox.
Comment 11 John Wagner 2014-01-10 08:23:30 EST
Reproduced the error connecting to Solaris running ODSEE 11.1.1.5.1 and 11.1.1.7.0.

The error doesn't appear going to a Solaris system running Sun One 5.2.

Looking at other possibily related causes, it appears to stem from 319901 where they have enabled ECDHE, but did so only partially or that perl-ldap needs to be recompiled to use that support.  Seems to be some very heated debates...
Comment 12 Gabe Fahl 2014-01-15 16:09:15 EST
Reproduced this error on Scientific Linux 6.4.

IO::Socket::SSL: SSL connect attempt failed with unknown errorerror:100AE081:elliptic curve routines:EC_GROUP_new_by_curve_name:unknown group	...propagated
 
Installed Packages
Name        : openssl
Arch        : x86_64
Version     : 1.0.1e
Release     : 16.el6_5
Size        : 4.0 M
Repo        : installed
From repo   : updates
Summary     : A general purpose cryptography library with TLS implementation
URL         : http://www.openssl.org/
License     : OpenSSL
Description : The OpenSSL toolkit provides support for secure communications between
            : machines. OpenSSL includes a certificate management tool and shared
            : libraries which provide various cryptographic algorithms and
            : protocols.
Comment 13 Tomas Mraz 2014-01-16 05:18:03 EST
This issue should be reported through regular support channels (http://www.redhat.com/support) so we can properly investigate and prioritize a fix.
Comment 16 Tomas Mraz 2014-02-07 07:40:35 EST
Also I have to say that this looks like a bug on the server side that it does not respect the list of EC curves that the client supports. It could be found out if a SSL handshake was captured in a tcp dump.
Comment 17 Deepak Das 2014-02-27 03:45:44 EST
The issue is not from openssl end. The issue seems to be on perl side. 

During ssl handshake "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA" cipher was selected. It seems perl shipped with RHEL 6.5 does not have support to handle ECDHE based connection.

When following cpan modules were installed in perl the issue got resolved.

  1) cpan  Net::SSLeay

  2) cpan  IO::Socket::SSL
Comment 18 Tomas Mraz 2014-02-27 04:49:01 EST
This is fairly strange as the TLS client side should not require any code changes for ECDHE support. Perhaps just rebuild of these perl packages would help?
Reassigning.
Comment 19 Petr Pisar 2014-02-27 05:22:43 EST
Rebuild is not enough. One has to add the support to the binding and upper layers.

Support for ECDH has been added by upstream in IO-Socket-SSL-1.955 and Net-SSLeay-1.56.

RHEL-6 delivers perl-IO-Socket-SSL-1.31-2.el6 and perl-Net-SSLeay-1.35-9.el6.
Comment 20 Tomas Mraz 2014-02-27 06:50:44 EST
For support on the TLS server side you need the bindings however the client side should be fully transparent.
Comment 21 Petr Pisar 2014-02-27 07:48:43 EST
I don't know. Isn't it then the same problem as discussed in bug #1019390 comment #2?
Comment 22 Petr Pisar 2014-02-27 07:59:36 EST
(In reply to Petr Pisar from comment #21)
> bug #1019390 comment #2

This is equivalent to RHEL bug #1022468 an bug #1025598 which should have already been fixed in openssl-1.0.1e-16.el6_5.
Comment 23 Tomas Mraz 2014-02-27 08:01:54 EST
It is not equivalent as otherwise with the current openssl packages in RHEL-6 it would work which it apparently doesn't.
Comment 24 Petr Pisar 2014-02-27 08:43:40 EST
It would work. Can you reproduce it? I tried simple IO::Socket:SSL client against openssl s_server and I cannot. I have:

openssl-1.0.1e-16.el6_5.x86_64
perl-IO-Socket-SSL-1.31-2.el6.noarch
perl-Net-SSLeay-1.35-9.el6.x86_64

I get the same results with openssl-1.0.1e-15.el6.x86_64.

Do I need to tweak the TLS server specifically?
Comment 25 Tomas Mraz 2014-02-27 08:59:43 EST
You need to have a TLS server which supports EC curves we do not support. For this concrete Perl LDAPS issue we do not have internal reproducer at all. I've asked GSS to provide it.
Comment 26 Petr Pisar 2014-02-27 09:15:31 EST
Created attachment 868558 [details]
Template for the reproducer

One need add such `-named_curve' argument to openssl s_server command that `openssl ecparam -list_curves' will list it on the server host, but will not not the client host.
Comment 31 Petr Pisar 2014-03-19 02:54:38 EDT
There is definitely the problem that Perl TLS libraries as delivered by Red Hat Enterprise Linux 6 now do not support ECDHE. We will focus on this issue first.

We need to port the support available from latest version as described in comment #19.
Comment 32 Petr Pisar 2014-03-19 07:09:44 EDT
Created attachment 876322 [details]
Upstream ECDHE support ported to 1.35
Comment 33 Tomas Mraz 2014-03-19 08:07:00 EDT
Note that this is a purely server-side change. The TLS client side should work completely fine without these bindings.
Comment 37 Petr Pisar 2014-03-19 09:58:15 EDT
Created attachment 876352 [details]
OBJ_txt2nid export ported to 1.35

This is needed to be able to select curve prime field by name.
Comment 38 John Wagner 2014-04-04 08:48:14 EDT
Any ETA on when this would pushed?  After creating a ticket with Oracle on the issue they came to the same determination.  The the client is saying it supported a cipher/method that it didn't.
Comment 39 Petr Pisar 2014-04-04 09:04:24 EDT
These patches for Perl packages will add support for Perl ECDHE server and for tuning ECDHE parameters of Perl client.

But they alone will not fix the incompatibility with Oracle server. This a matter of OpenSSL library and server implementation by the Oracle.
Comment 40 John Wagner 2014-04-05 10:32:24 EDT
Oracle did a sniff of the packets and determined that it was a client issue as it was announcing support for something it (the client) didn't actually support.

Are you saying that is not correct?
Comment 41 Petr Pisar 2014-04-07 02:32:56 EDT
(In reply to John Wagner from comment #40)
> Oracle did a sniff of the packets and determined that it was a client issue
> as it was announcing support for something it (the client) didn't actually
> support.
> 
> Are you saying that is not correct?

I don't say anything. I've never seen the sniffs. It would be very helpful if somebody showed us them.
Comment 42 Tomas Mraz 2014-04-08 04:53:44 EDT
Exactly. Also I suspect they tested against old OpenSSL build not the latest from RHEL-6. This should not happen with openssl-16.el6_5 and newer packages.
Comment 43 John Wagner 2014-04-08 14:23:46 EDT
I still get the issue with openssl-1.0.1e-16.el6_5.4.x86_64...

Here is a clip of what they sent me...

>11 3.130107 167.138.123.144 10.28.165.215 TLSv1 Server Hello, Certificate, >Server Key Exchange, Certificate Request, Server Hello Done 
>Handshake Protocol: Server Hello 
>Cipher Suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (0xc014) 
>
>But I think the client should not expose this cipher in the first place if it >doesn't support it.
Comment 44 Petr Pisar 2014-04-09 04:00:57 EDT
(In reply to John Wagner from comment #43)
> I still get the issue with openssl-1.0.1e-16.el6_5.4.x86_64...
> 
> Here is a clip of what they sent me...
> 
> >11 3.130107 167.138.123.144 10.28.165.215 TLSv1 Server Hello, Certificate, >Server Key Exchange, Certificate Request, Server Hello Done 
> >Handshake Protocol: Server Hello 
> >Cipher Suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (0xc014) 
> >

This is a server hello. That means an offer from the server. There is nothing about the client.

I'm sorry, this is not a dump of the network traffic. Use tcpdump tool to capture unsuccessful TLS between the client and the server and provide us the pcap dump.

> >But I think the client should not expose this cipher in the first place if it >doesn't support it.

$ rpm -q openssl
openssl-1.0.1e-16.el6_5.4.x86_64
$ openssl ciphers -V |grep -E 'ECDHE.RSA.AES.?256'
          0xC0,0x30 - ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH     Au=RSA  Enc=AESGCM(256) Mac=AEAD
          0xC0,0x28 - ECDHE-RSA-AES256-SHA384 TLSv1.2 Kx=ECDH     Au=RSA  Enc=AES(256)  Mac=SHA384
          0xC0,0x14 - ECDHE-RSA-AES256-SHA    SSLv3 Kx=ECDH     Au=RSA  Enc=AES(256)  Mac=SHA1

As you can see, the 0xc014 cipher-suite is declared by the openssl-1.0.1e-16.el6_5.4 as supported.

If I run the test case here attached, I can see it's possible to use the cipher-suite between openssl server and Perl client:

$ ./server
Using default temp DH parameters
Setting temp ECDH parameters
ACCEPT

$ ./test-iss
DEBUG: .../IO/Socket/SSL.pm:1471: new ctx 33991056
DEBUG: .../IO/Socket/SSL.pm:332: socket not yet connected
DEBUG: .../IO/Socket/SSL.pm:334: socket connected
DEBUG: .../IO/Socket/SSL.pm:347: ssl handshake not started
DEBUG: .../IO/Socket/SSL.pm:390: Net::SSLeay::connect -> 1
DEBUG: .../IO/Socket/SSL.pm:445: ssl handshake done
  write_all VM at entry=vm_unknown
  written so far 5:5 bytes (VM=vm_unknown)
Cipher: ECDHE-RSA-AES256-SHA
DEBUG: .../IO/Socket/SSL.pm:1507: free ctx 33991056 open=33991056
DEBUG: .../IO/Socket/SSL.pm:1515: OK free ctx 33991056

And the server continues with:

-----BEGIN SSL SESSION PARAMETERS-----
MFUCAQECAgMDBALAFAQABDDOAey0DxMV2dx4HAb69QWREZqqDAHd6x/Mg6NOv0gR
0I7cvSoJVEdiYUPX5uwUYsehBgIEU0T2LqIEAgIBLKQGBAQBAAAA
-----END SSL SESSION PARAMETERS-----
Shared ciphers:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-DSS-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA256:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:DHE-RSA-CAMELLIA256-SHA:DHE-DSS-CAMELLIA256-SHA:ECDH-RSA-AES256-GCM-SHA384:ECDH-ECDSA-AES256-GCM-SHA384:ECDH-RSA-AES256-SHA384:ECDH-ECDSA-AES256-SHA384:ECDH-RSA-AES256-SHA:ECDH-ECDSA-AES256-SHA:AES256-GCM-SHA384:AES256-SHA256:AES256-SHA:CAMELLIA256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:EDH-DSS-DES-CBC3-SHA:ECDH-RSA-DES-CBC3-SHA:ECDH-ECDSA-DES-CBC3-SHA:DES-CBC3-SHA:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:DHE-DSS-AES128-GCM-SHA256:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-SHA256:DHE-DSS-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA:DHE-RSA-SEED-SHA:DHE-DSS-SEED-SHA:DHE-RSA-CAMELLIA128-SHA:DHE-DSS-CAMELLIA128-SHA:ECDH-RSA-AES128-GCM-SHA256:ECDH-ECDSA-AES128-GCM-SHA256:ECDH-RSA-AES128-SHA256:ECDH-ECDSA-AES128-SHA256:ECDH-RSA-AES128-SHA:ECDH-ECDSA-AES128-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:SEED-SHA:CAMELLIA128-SHA:IDEA-CBC-SHA:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:ECDH-RSA-RC4-SHA:ECDH-ECDSA-RC4-SHA:RC4-SHA:RC4-MD5:EDH-RSA-DES-CBC-SHA:EDH-DSS-DES-CBC-SHA:DES-CBC-SHA:EXP-EDH-RSA-DES-CBC-SHA:EXP-EDH-DSS-DES-CBC-SHA:EXP-DES-CBC-SHA:EXP-RC2-CBC-MD5:EXP-RC4-MD5
CIPHER is ECDHE-RSA-AES256-SHA
Secure Renegotiation IS supported
ping
DONE
shutting down SSL
CONNECTION CLOSED
ACCEPT
^C

So Perl TLS client is able to use 0xc014 cipher-suite against openssl-1.0.1e-16.el6_5.4.x86_64 server.
Comment 45 Tomas Mraz 2014-04-09 04:43:29 EDT
Apparently the server ignores the list of EC curves supported by the client and chooses the ECDH ciphersuite with an EC curve the client does not support. I think it is clearly a third party server bug.
Comment 46 John Wagner 2014-04-09 09:34:04 EDT
I updated my Oracle ticket with the information... But as I understand it the problem as they are saying the client IS presenting support but when used it fails.

>
>I think paste the following from the client to the thread might help. 
>
>The Client Hello from 10.28.165.215 lists the following on the top of the >cipher suite. 
>Cipher Spec: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (0x00c030) 
>Cipher Spec: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (0x00c02c) 
>Cipher Spec: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 (0x00c028) 
>Cipher Spec: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 (0x00c024) 
>Cipher Spec: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (0x00c014) 
>Cipher Spec: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (0x00c00a)
Comment 47 Tomas Mraz 2014-04-09 10:24:13 EDT
They do not say that correctly. The client advertises support for these crypto algorithms (namely ECDHE and ECDSA) because it really supports them but there is additional thing that the client according to the RFCs sends and that is a supported EC curves TLS extension. Citing RFC-4492: "If a server does not understand the Supported Elliptic Curves Extension, does not understand the Supported Point Formats Extension, or is unable to complete the ECC handshake while restricting itself to the enumerated curves and point formats, it MUST NOT negotiate the use of an ECC cipher suite."
Comment 48 John Wagner 2014-04-10 18:24:16 EDT
Oracle ODSEE11 DOES support that algorithm.  The client just does not work when it tries to use it.

Using the CPAN Net::SSLeay/Net::LDAP/IO::Socket::SSL instead of the ones provided by RedHat in the rpms: perl-Net-SSLeay-1.35-9.el6.x86_64/perl-LDAP-0.40-1.el6.noarch/perl-IO-Socket-SSL-1.31-2.el6.noarch does not present the issue.  And I verified it is using the ECDHE-RSA-AES256-SHA cipher as in a I only enabled that cipher on one of the ODSEE11 instances.
Comment 49 Petr Pisar 2014-04-11 03:23:07 EDT
(In reply to John Wagner from comment #48)
> Oracle ODSEE11 DOES support that algorithm.  The client just does not work
> when it tries to use it.
> 
We need the network dump. Or the Oracle ODSEE11 server we can play with.

> Using the CPAN Net::SSLeay/Net::LDAP/IO::Socket::SSL instead of the ones
> provided by RedHat in the rpms:
> perl-Net-SSLeay-1.35-9.el6.x86_64/perl-LDAP-0.40-1.el6.noarch/perl-IO-Socket-
> SSL-1.31-2.el6.noarch does not present the issue.

No news. See comment #17. If you at least specify which versions. There are tens of versions on the CPAN.

> And I verified it is
> using the ECDHE-RSA-AES256-SHA cipher as in a I only enabled that cipher on
> one of the ODSEE11 instances.

So do the current OpenSSL and Perl SSL bindings if the server is RHEL OpenSSL. See comment #44.

I'm sorry, but without more details, I cannot do much.
Comment 50 Tomas Mraz 2014-04-11 04:27:35 EDT
(In reply to John Wagner from comment #48)
> Oracle ODSEE11 DOES support that algorithm.  The client just does not work
> when it tries to use it.
> 
> Using the CPAN Net::SSLeay/Net::LDAP/IO::Socket::SSL instead of the ones
> provided by RedHat in the rpms:
> perl-Net-SSLeay-1.35-9.el6.x86_64/perl-LDAP-0.40-1.el6.noarch/perl-IO-Socket-
> SSL-1.31-2.el6.noarch does not present the issue.  And I verified it is
> using the ECDHE-RSA-AES256-SHA cipher as in a I only enabled that cipher on
> one of the ODSEE11 instances.

This does not invalidate my comment 47. The oracle server probably supports the ECDHE algorithm but insists on using a curve that our client clearly and in conformance with the RFC does not advertise to support. It is a bug in the Oracle server if it choses to use ECDHE algorithm with a curve unsupported by the client. End of discussion unless you prove that the Oracle server either uses a curve supported by our client or that our client with openssl >= 16.el6_5 advertises support for curve that it really does not support.
Comment 51 John Wagner 2014-04-11 11:38:28 EDT
(In reply to Petr Pisar from comment #49)
> (In reply to John Wagner from comment #48)
> Oracle ODSEE11 DOES support
> that algorithm.  The client just does not work
> when it tries to use it.
> 
> We need the network dump. Or the Oracle ODSEE11 server we can play with.

An evaluation download of Oracle Directory Server Enterprise Edition (11.1.1.7.0) for is at http://www.oracle.com/technetwork/middleware/downloads/oid-11g-161194.html

>
> Using the CPAN Net::SSLeay/Net::LDAP/IO::Socket::SSL instead of the ones
>
> provided by RedHat in the rpms:
>
> perl-Net-SSLeay-1.35-9.el6.x86_64/perl-LDAP-0.40-1.el6.noarch/perl-IO-Socket-
> > SSL-1.31-2.el6.noarch does not present the issue.

No news. See comment
> #17. If you at least specify which versions. There are tens of versions on
> the CPAN.

Just pointing it out that the issue doesn't appear in "newer" versions.  Again I was hoping that the issue that you said was ported in #32 also resolved this issue.

The current version of cpan modules I've tried
Net::SSLeay 1.58
IO::SOCKET::SSL 1.981
NET::LDAP 0.62

> And I verified it is
> using the ECDHE-RSA-AES256-SHA cipher as
> in a I only enabled that cipher on
> one of the ODSEE11 instances.

So do
> the current OpenSSL and Perl SSL bindings if the server is RHEL OpenSSL. See
> comment #44.

But that is the issue.  Both say it is supported.  However when using the provided RH6 rpm's it does not work.  Oracle just updated the ticket I have with them to see if more info can be gathered.
Comment 56 John Wagner 2014-04-23 19:29:03 EDT
Response from the ticket I have with Oracle:

@ when looking at the provided ssltap output it clearly shows that the perl 
@ client (and the underlying openssl libs) does not offer any extension and 
@ that our server does not use any extension in this case: 
@ . 
@ [Fri Apr 18 15:33:55 2014] [ssl2] ClientHelloV2 { 
@ version = {0x03, 0x03} 
@ cipher-specs-length = 297 (0x129) 
@ sid-length = 0 (0x00) 
@ challenge-length = 16 (0x10) 
@ cipher-suites = { 
@ .. 
@ (0x00c014) TLS/ECDHE-RSA/AES256-CBC/SHA 
@ .. 
@ (0x0000ff) TLS_EMPTY_RENEGOTIATION_INFO_SCSV 
@ } 
@ session-id = { } 
@ challenge = { 0x771a 0x2919 0x3fec 0x68a6 0xda7b 0xd3c7 0xdc17 
@ 0xfab6 } 
@ } 
@ ] 
@ .. 
@ SSLRecord { [Fri Apr 18 15:33:55 2014] 
@ type = 22 (handshake) 
@ version = { 3,1 } 
@ length = 4368 (0x1110) 
@ handshake { 
@ type = 2 (server_hello) 
@ length = 77 (0x00004d) 
@ ServerHello { 
@ server_version = {3, 1} 
@ random = {...} 
@ session ID = { 
@ length = 32 
@ contents = {...} 
@ } 
@ cipher_suite = (0xc014) TLS/ECDHE-RSA/AES256-CBC/SHA 
@ compression method = (00) NULL 
@ extensions[5] = { 
@ extension type renegotiation_info, length [1] = { 
@ 0: 00 | . 
@ } 
@ } 
@ } 
@ type = 12 (server_key_exchange) 
@ length = 319 (0x00013f) 
@ type = 14 (server_hello_done) 
@ length = 0 (0x000000) 
@ } 
@ } 
@ ] 
@ . 
@ other than "renegotiation_info" whose length field is set to zero when 
@ receiving a TLS_EMPTY_RENEGOTIATION_INFO_SCSV "cipher-suite" in the SSL 
@ Client Hello packet, which is in accordance to RFC 5746 Section 3.4 
@ . 
@ The server chooses the SSL3/DHE-RSA/DES40-CBC/SHA cipher-suite as offered by 
@ the client w/o choosing any specific "elliptic_curves" extension (as claimed 
@ by RedHat) and replies with that to the client. 
@ . 
@ By the way, the same works when using an openSSL 1.0.1g client as shown in my 
@ example. The "renegotiation_info" related handshake packets are exactly the 
@ same as with the failing perl client - the client sends a 
@ "TLS_EMPTY_RENEGOTIATION_INFO_SCSV" cipher-suite and the server replies with: 
@ . 
@ . 
@ extension type renegotiation_info, length [1] = { 
@ 0: 00 | . 
@ } 
@ . 
@ so this cannot be the reason of the failing handshake. The 1.0.1g client 
@ offers some additional extensions like "ec_point_formats", "elliptic_curves", 
@ etc. which our server then uses accordingly. 
@ . 
@ So to me this clearly looks like a bug in the specific openSSL version that 
@ the customer is using. 
@ . 
@ Feel free to forward both ssltap outputs to RedHat and let them elaborate why 
@ the eventfully still think that our server is misbehaving. 

-----


@ To add on the above: 
@ . 
@ RFC 4492 Section 4 (TLS Extensions for ECC) defines: 
@ . 
@ " 
@ A TLS client that proposes ECC cipher suites in its ClientHello 
@ message SHOULD include these extensions. Servers implementing ECC 
@ cipher suites MUST support these extensions, and when a client uses 
@ these extensions, servers MUST NOT negotiate the use of an ECC cipher 
@ suite unless they can complete the handshake while respecting the 
@ choice of curves and compression techniques specified by the client. 
@ This eliminates the possibility that a negotiated ECC handshake will 
@ be subsequently aborted due to a client's inability to deal with the 
@ server's EC key. 
@ . 
@ The client MUST NOT include these extensions in the ClientHello 
@ message if it does not propose any ECC cipher suites. A client that 
@ proposes ECC cipher suites may choose not to include these 
@ extensions. In this case, the server is free to choose any one of 
@ the elliptic curves or point formats listed in Section 5. That 
@ section also describes the structure and processing of these 
@ extensions in greater detail. 
@ " 
@ . 
@ In our specific case of the failing perl client the client DOES propose ECC 
@ cipher suites (TLS/ECDHE-RSA/AES256-CBC/SHA) but DOES NOT (although it 
@ SHOULD) include the "elliptic_curves" extension to indicate the set of 
@ elliptic curves supported by the client. In this case "the server is free to 
@ choose any one of the elliptic curves or point formats listed in Section 5." 
@ . 
@ So this is what our server does: it chooses a curve that the client is 
@ apparently unable to handle. But this is in accordance with RFC 4492 since 
@ the client did not include the "elliptic_curves" extension in the Client 
@ Hello handshake packet. So imo the client is misbehaving - if it cannot 
@ handle all curves it should include the "elliptic_curves" extension and 
@ specify what curves it is able to handle.
Comment 57 Tomas Mraz 2014-04-24 05:03:10 EDT
Now when I finally got a readable packet dump I have to agree that the message the client is sending is incorrect. I really wonder though why the SSLv2 client hello message format is used as the default is set such that OpenSSL uses the SSLv3 client hello format.

Petr, does the perl layer set some non-default SSL cipher list string? The SSLv2 client hello is used because there are SSL2_.... ciphers in the cipher list although they are not supposed to be there unless explicitly configured so by user.

Nevertheless sending the ECC cipher suites in the SSLv2 client hello can be seen as openssl bug as well because there is no way to indicate the supported curve list in the SSLv2 client hello. So this report should be split to two bugs.
Comment 58 Petr Pisar 2014-04-24 08:40:14 EDT
There many perl layers above OpenSSL, but the one which changes protocol version and cipher list from the OpenSSL default is Net::LDAP itself (package perl-LDAP).

Net::LDAP sets in case of implicit SSL (ldaps scheme):

  'SSL_version' => 'sslv2/3',
  'SSL_cipher_list' => 'ALL',

while in case of explicit SSL (STARTTLS inside LDAP protocol):

  'SSL_version' => 'tlsv1',
  'SSL_cipher_list' => 'ALL',

This test case is about the first case. And it can be reproduced with openssl(1) tool:

$ openssl s_client -connect 127.0.0.1:2000 -cipher ALL

Please note the current upstream perl-ldap still does that. Except the 'sslv2/3' spelling has been updated to 'sslv23'.

I guess there is no OpenSSL cipher list string for the-default-one, because the perl code looks like:

  SSL_cipher_list     => defined $arg->{ciphers} ? $arg->{ciphers} : 'ALL'

which is the reason why the default Net::LDAPS behavior is enabling all ciphers.
Comment 59 Tomas Mraz 2014-04-24 08:55:23 EDT
The SSL_version setting is probably no problem. However the ALL cipher list string really should not be used. Either the cipher list should not be set at all or the 'DEFAULT' string could be used.
Comment 60 Petr Pisar 2014-04-24 09:41:51 EDT
This bug report will be used for enabling perl server to set elliptic curve parameters.

The wrong setting cipher list in perl-LDAP what is the root cause if the initial comment will be solved in bug report #1090966.
Comment 67 Petr Pisar 2015-11-13 06:50:21 EST
How to test:

Use perl-IO-Socket-SSL test described in bug #1078084.

Or just verify following 4 subroutines are defined in Net::SSLeay name space:

  EC_KEY_free()
  EC_KEY_new_by_curve_name()
  OBJ_txt2nid()
  SSL_CTX_set_tmp_ecdh()
Comment 69 Dan Ragle 2016-03-21 10:33:36 EDT
I have some yum-specific confusion about this update (perl-Net-SSLeay-1.35-10.el6).

My RHEL 6.7 system says (according to yum) that this package (along with several others that I cannot account for) is available in rhel-6-server-rpms and has been since last Thursday (3/17/2016). Yet, I do not see any errata listed for it at https://rhn.redhat.com/errata/rhel-server-6-errata.html, and have not seen any errata sent to me. 

Additionally, when I go to https://rhn.redhat.com/rhn/channels/software/Search.do and search for perl-Net-SSLeay I was able to find a page pointing to errata RHEA-2015:21919-1, but when I clicked through to that errata I got the message "We're sorry, but the erratum could not be found". 

I did finally find the changelog for this version at https://rhn.redhat.com/network/software/packages/change_log.pxt?pid=1134280 that pointed to this bug, but it (the change log entry) is dated 3/19, while I've seen this package as being available in the repo since 3/17. 

Is there something I'm missing here? Primarily I'm just wanting to make sure the package is genuinely intended for the main 6.7 repos.
Comment 70 Petr Pisar 2016-03-21 11:17:58 EDT
(In reply to Dan Ragle from comment #69)
> I have some yum-specific confusion about this update
> (perl-Net-SSLeay-1.35-10.el6).
> 
> My RHEL 6.7 system says (according to yum) that this package (along with
> several others that I cannot account for) is available in rhel-6-server-rpms
> and has been since last Thursday (3/17/2016). Yet, I do not see any errata
> listed for it at https://rhn.redhat.com/errata/rhel-server-6-errata.html,
> and have not seen any errata sent to me. 
> 
I'm sorry for this inconvenience. It was a mistake in publishing metadata about updates and the mistake should be fixed now. The perl-Net-SSLeay-1.35-10.el6 package with erratum text will be published on RHEL 6.8 release.

If you have more questions, please contact Red Hat Support.
Comment 72 Dan Ragle 2016-03-21 11:23:50 EDT
Thank you for the quick response. I will take up the rest with Red Hat support.
Comment 76 errata-xmlrpc 2016-05-10 16:06:03 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHEA-2016-0766.html

Note You need to log in before you can comment on or make changes to this bug.