Skip to content

SSL handshake error with OSX client #712

Closed

Description

@clayton256

The OSX client used to connect but I don't know when it stopped working. It now fails to connect to an owncloud install on my web hosting site (bluehost.com). I get error "SSL handshake failed".
The client log shows:
06-19 11:08:54:414 ownCloudInfo Network Error: 6
06-19 11:08:54:414 status.php returns: "" 6 Reply: QNetworkReplyImpl(0x1015b3be0)
06-19 11:08:54:414 No proper answer on "https://box282.bluehost.com/~m/owncloud/status.php/status.php"

If I run curl on that url, it get, what looks like a valid OC response:
$curl -3 https://box282.bluehost.com/~m/owncloud/status.php
{"installed":"true","version":"5.0.12","versionstring":"5.0.7","edition":""}$

The linux (Ubuntu 13.04) client works fine.

I don't see anything interesting in the server logs.

owncloud 5.0.7
OSX clients 1.3.0beta3 and 1.2.5
PHP 5.4.15
Apache 2.2.24
openssh 5.3p1

Activity

  1. MarcelWaldvogel commented on Jun 26, 2013

    @MarcelWaldvogel

    The spurious "SSL handshake failed" error messages I have been seeing were due to putting the Mac to sleep. When waking up, the network connection would be gone. Could this be your problem as well? If so, it might be "good enough" for the client to just retry.

  2. clayton256 commented on Jun 27, 2013

    @clayton256
    Author

    Thanks for the input. However, I get this error from the setup wizard. I did some digging in the code but with little insight. The best I can tell is that the error is coming from the QT network manager. I goggled and found someone else complaining about QT network manager giving the same error when curl worked fine. A suggestion that poster to use wireshark to see what is different btw the QT app and curl sounds like a good next step me.

  3. clayton256 commented on Jun 29, 2013

    @clayton256
    Author

    An update to this issue. I installed the owncloud iPhone app and it was fine. Between this app and the linux client working fine, I'm assuming it's not a server setup issue but an OSX client issue.

    I used wireshark to capture the packets. The curl connection produces more traffic and the connection succeeds. The OS X client's traffic seems to be truncated. I don't understand all of the negotiations in the packets. I can provide my wireshark packet traces if someone working on this bug wants them. I don't want to post them publicly so PM me to get them.

    Thanks,
    Mark

  4. clayton256 commented on Jul 11, 2013

    @clayton256
    Author

    A couple of updates to this issue.

    1. I updated the iOS app this morning and it still works.

    2. I installed OC on a testbed server. This server that does not have https capability. The OC client connects to it fine. With the previous client version I could not connect to this server.

    I hope all this info helps someone with this bug. I'd love to help with a patch but it's way over my head. Maybe if someone can point me in the right direction I could take a stab at it.

    Thanks,
    Mark

  5. tracerrx commented on Sep 13, 2013

    @tracerrx

    Having the same issue on OSX. (Windows/iPhone client works fine). Running owncloud via SSL on a non standard port, everything works fine across ALL clients if I utilize IP address:Port, however if I utilize domain name:port, works on all clients EXCEPT OSX where it throws an SSL handshake error. Very strange. All clients except OSX client prompt to accept the self signed cert, maybe this is the issue?

  6. tomscat commented on Sep 17, 2013

    @tomscat

    same here,
    did work fine until ~21 days ago
    Mac OS X Lion
    owncloud client 1.4.0

  7. danimo commented on Sep 29, 2013

    @danimo
    Contributor

    Ok guys, let's investigate this. First off a few of my observations:

    1. "But it works on XY" is not a sufficient indication that it works elsewhere. To ensure your SSL setup is correct, use http://ssllabs.com to check your host (usually the problem is a missing intermediate certificate (which makes it fail on all platforms, but works on browsers because they will fetch the intermediate), or sending the root certificate, which should be in your browser (it's best practice not to do that, it's a hard requirement for the ownCloud client on Mac OS).
    2. Qt on Mac has a few gotchas that we cannot workaround easily
    3. So far, I've gotten OS X to connect eventually (with modifications to the setup if required), I am interested why it fails for you.

    I need your feedback on the following issues:

    1. SNI: Are you using SNI (Server Name Indication, aka SSL vhost)?
    2. Is this one certificate with several hosts ("Subject Alternative Name", or SAN), or one host per certificate?
    3. Are you using a reverse proxy?
    4. Which Server are you using (Apache, nginx, etc), for Reverse-Proxy users: which reverse proxy software are you using?
  8. boschma1 commented on Sep 29, 2013

    @boschma1

    I have done some checks with SSLLabs and mitigated a certificate chain issue, that in the end didn't solve the issue. The results of my check are included here in this screenshot:
    image

    Pertaining to your questions:

    1. AFAIK, I am not using SNI
    2. The certificate is only issued for one CN: owncloud.loomion.com, no alternate subject name defined
    3. Nope
    4. Apache on my QNAP 259+

    Thank you for your precious time. I offer you to connect to my system in order to obtain a live view. Just let me know whether this is of interest for you.

    Cheers
    Markus

  9. danimo commented on Sep 29, 2013

    @danimo
    Contributor

    @boschma1 I already tried to check the setup on your system, and it seems the server is sending three certificates:

    1. Server cert.
    2. Intermediate cert.
    3. Root cert.

    Please remove the root cert from your certificate bundle. There is no point in doing so (after all the client can only trust the root if its in its own root-cert-store) and it's causing issues with the client.

  10. boschma1 commented on Sep 29, 2013

    @boschma1

    @danimo : if I remove the Root CA, then the Windows client shows the same symptoms as the Mac client. Currently the server certificate seems to have 2 intermediate certificates involved (see screen shot):
    image

  11. danimo commented on Sep 29, 2013

    @danimo
    Contributor

    @boschma1 Oh, well, then I was wrong and what I thought was the root cert was in fact another intermediate. Oh my... Will continue investigation later then, if it's ok for you.

  12. danimo commented on Sep 29, 2013

    @danimo
    Contributor

    @boschma1 Can you try to disable SSLv2 (and possibly v3)? v2 seems to provide no cipher suites. It's possible that the rather old openssl on mac os cockes on this.

  13. 34 remaining items

  14. danimo commented on May 14, 2014

    @danimo
    Contributor

    One more thing that I just saw in the wild. If

    openssl s_client -tlsextdebug -state -connect yourhost.com:443 -CApath -servername yourhost.com 2>&1< /dev/null|grep read:warning

    yields

    SSL3 alert read:warning:unrecognized name

    then please fix your SNI setup.

    If the client requests a host name, the server responds with a TLS Alert (Level Warning, Description: Unrecognized Name). Some implementations choose to ignore this (e.g. most browsers), others decide to make the handshake fail as a precaution or because they don't handle the error as a warning (Java 7, Qt).

    Sometimes ensuring that SSLStrictSNIVHostCheck off is set might help, but you really should take a look at the SNI reference setup at https://sni.velox.ch/ to fix your setup.

    If you are using a NAS, it is important to look at the effective settings (those generated by the web interface)

  15. joubin commented on May 28, 2014

    @joubin

    @danimo

    You had mentioned that people are putting in server info with redacted information. I am having the issue noted above and if youd like, I can provide you with a login into my server as well as the detailed info from ssl labs.

    Please email me if interested!
    [email protected]

  16. ataraxus commented on May 28, 2014

    @ataraxus

    +1

  17. danimo commented on May 28, 2014

    @danimo
    Contributor

    @joubin @ataraxus : have you verified that SSL3 alert read:warning:unrecognized name does not happen to you?

  18. joubin commented on May 28, 2014

    @joubin

    @danimo Sort of. I am getting an A- on SSL labs. The command you provided returns an error for me. says unknow option where you have yourhost.com the second time .

    EDIT:OpenSSL on Mac 10.9 and Ubuntu 12.04, 14.04

  19. ataraxus commented on May 28, 2014

    @ataraxus

    @danimo same problem as @joubin using ubuntu openssl to test.

  20. zestysoft commented on Jun 3, 2014

    @zestysoft

    @danimo Add me to the list too. Qualys SSL's test gives me an A+, no errors.
    Your openssl s_client command only gives one warning, but that's just related to closing the session:
    SSL3 alert write:warning:close notify

    Clients for Windows and IOS devices work flawlessly.

    Certificate is purchased, not self-signed.

    Apache doesn't log the mac client connection attempt (ssl_connect_log, ssl_request_log, ssl_error_log all remain silent), but I do see some tcp back and forth with tcpdump (from the server).

    Server: Apache/2.4.9 (Fedora) OpenSSL/1.0.1e-fips PHP/5.5.12 mod_perl/2.0.9-dev Perl/v5.18.2

    Edit:

    I cranked up the server logging to debug, here's what Apache is reporting:

    [Tue Jun 03 17:04:06.929538 2014] [ssl:info] [pid 933] [client x.x.x.x:50582] AH01964: Connection to child 7 established (server xxxx.xxxx.xxx:443)
    [Tue Jun 03 17:04:06.930115 2014] [ssl:debug] [pid 933] ssl_engine_kernel.c(1929): [client x,x,x,x:50582] AH02044: No matching SSL virtual host for servername xxxx.xxxx.xxx found (using default/first virtual host)
    [Tue Jun 03 17:04:07.449573 2014] [ssl:debug] [pid 933] ssl_engine_io.c(1212): (70014)End of file found: [client x.x.x.x:50582] AH02007: SSL handshake interrupted by system [Hint: Stop button pressed in browser?!]
    [Tue Jun 03 17:04:07.449700 2014] [ssl:info] [pid 933] [client x.x.x.x:50582] AH01998: Connection closed to child 7 with abortive shutdown (server xxxx.xxxx.xxx:443)
    
  21. zestysoft commented on Jun 4, 2014

    @zestysoft

    @danimo

    Here is wireshark's capture of the communication:

      7   4.028764 client -> server TCP 78 50855 > https [SYN] Seq=0 Win=65535 Len=0 MSS=1460 WS=16 TSval=1413293448 TSecr=0 SACK_PERM=1
      8   4.028945 server -> client TCP 74 https > 50855 [SYN, ACK] Seq=0 Ack=1 Win=28960 Len=0 MSS=1460 SACK_PERM=1 TSval=273364807 TSecr=1413293448 WS=128
      9   4.060303 client -> server TCP 66 50855 > https [ACK] Seq=1 Ack=1 Win=131760 Len=0 TSval=1413293473 TSecr=273364807
     10   4.068103 client -> server SSL 192 Client Hello
     11   4.068196 server -> client TCP 66 https > 50855 [ACK] Seq=1 Ack=127 Win=29056 Len=0 TSval=273364846 TSecr=1413293480
     16   4.576222 server -> client TLSv1 2962 Alert (Level: Warning, Description: Unrecognized Name), Server Hello
     17   4.576554 server -> client TLSv1 1266 Certificate
     18   4.576852 server -> client TLSv1 629 Server Key Exchange
     19   4.606028 client -> server TCP 66 50855 > https [ACK] Seq=127 Ack=2897 Win=128864 Len=0 TSval=1413293876 TSecr=273365354
     20   4.608678 client -> server TCP 66 50855 > https [ACK] Seq=127 Ack=4097 Win=127664 Len=0 TSval=1413293876 TSecr=273365355
     21   4.608888 client -> server TCP 66 [TCP Window Update] 50855 > https [ACK] Seq=127 Ack=4097 Win=131072 Len=0 TSval=1413293876 TSecr=273365355
     22   4.609460 client -> server TCP 66 50855 > https [FIN, ACK] Seq=127 Ack=4097 Win=131072 Len=0 TSval=1413293876 TSecr=273365355
     23   4.609704 server -> client TCP 66 https > 50855 [FIN, ACK] Seq=4660 Ack=128 Win=29056 Len=0 TSval=273365388 TSecr=1413293876
     24   4.610526 client -> server TCP 60 50855 > https [RST] Seq=127 Win=0 Len=0
     25   4.610609 server -> client ICMP 82 Destination unreachable (Host administratively prohibited)
     42   4.920583 server -> client TCP 629 [TCP Retransmission] https > 50855 [FIN, PSH, ACK] Seq=4097 Ack=128 Win=29056 Len=563 TSval=273365699 TSecr=1413293876[Reassembly error, protocol TCP: New fragment overlaps old data (retransmission?)]
     43   4.947994 client -> server TCP 77 50855 > https [RST] Seq=128 Win=0 Len=23
    

    I can only assume that that "Unrecognized Name" error is because the server is set up to host multiple domains. (The SSL cert is a UCC type that has other alternate names)

    Otherwise, the only other thing I can think of that is causing the client to drop the connection is the piggybacking of the intermediate cert that gets sent along with the server public cert?

  22. zestysoft commented on Jun 4, 2014

    @zestysoft

    Here's more detail:

    Client HELLO asks for these Cipher Suites:

                    Cipher Suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA (0x0039)
                    Cipher Suite: TLS_DHE_DSS_WITH_AES_256_CBC_SHA (0x0038)
                    Cipher Suite: TLS_RSA_WITH_AES_256_CBC_SHA (0x0035)
                    Cipher Suite: TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA (0x0016)
                    Cipher Suite: TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA (0x0013)
                    Cipher Suite: TLS_RSA_WITH_3DES_EDE_CBC_SHA (0x000a)
                    Cipher Suite: TLS_DHE_RSA_WITH_AES_128_CBC_SHA (0x0033)
                    Cipher Suite: TLS_DHE_DSS_WITH_AES_128_CBC_SHA (0x0032)
                    Cipher Suite: TLS_RSA_WITH_AES_128_CBC_SHA (0x002f)
                    Cipher Suite: TLS_DHE_RSA_WITH_SEED_CBC_SHA (0x009a)
                    Cipher Suite: TLS_DHE_DSS_WITH_SEED_CBC_SHA (0x0099)
                    Cipher Suite: TLS_RSA_WITH_SEED_CBC_SHA (0x0096)
                    Cipher Suite: TLS_RSA_WITH_RC4_128_SHA (0x0005)
                    Cipher Suite: TLS_RSA_WITH_RC4_128_MD5 (0x0004)
                    Cipher Suite: TLS_DHE_RSA_WITH_DES_CBC_SHA (0x0015)
                    Cipher Suite: TLS_DHE_DSS_WITH_DES_CBC_SHA (0x0012)
                    Cipher Suite: TLS_RSA_WITH_DES_CBC_SHA (0x0009)
                    Cipher Suite: TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA (0x0014)
                    Cipher Suite: TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA (0x0011)
                    Cipher Suite: TLS_RSA_EXPORT_WITH_DES40_CBC_SHA (0x0008)
                    Cipher Suite: TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5 (0x0006)
                    Cipher Suite: TLS_RSA_EXPORT_WITH_RC4_40_MD5 (0x0003)
                    Cipher Suite: TLS_EMPTY_RENEGOTIATION_INFO_SCSV (0x00ff)
    

    and correctly specifies the FQDN of the server in the HTTP request.

    Server HELLO replies with an Alert warning: Unrecognized Name, and then specifies this supported Cipher Suite, which is the first one the client asks for:

    Cipher Suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA (0x0039)
    

    The server then sends the certificate contents which include both the server's public key, and the intermediate certificate owned by the signing cert company (Starfieldtech). This second cert is needed to complete the chain back to the trusted certs that the client would have on file on the local workstation. Note that the common name in the server's cert matches the FQDN the client asked the server for.

    The client then responds with a TCP FIN thus starting the breakdown of the communication.

  23. zestysoft commented on Jun 4, 2014

    @zestysoft

    @danimo

    I got the client to work when I specified the server name in the Apache ssl configuration file:

    ServerName xxxx.xxxx.xxx:443

    This breaks the server's ability to serve other domains securely with the UCC cert, so I had to disable it, but I think this is your smoking gun: The mac client software is incorrectly honoring that "Unrecognized Name" warning as being an error instead.

  24. protist commented on Jul 1, 2014

    @protist

    @zestysoft 's advice is right on the money. Setting the ServerName in /etc/apache2/sites-available/000-default.conf fixed it for me. (I should learn to read threads backwards.)

  25. robertwenner commented on Aug 13, 2014

    @robertwenner

    Same here: I had ServerName myServer in /etc/apache2/apache2.conf already, but Mac OS added the .local suffix to host names, so adding ServerName myServer.local and running service apache2 reload did the trick.

  26. timtelcik commented on Jan 9, 2017

    @timtelcik

    Hello All,

    just in case it's helpful to another reader of this thread, I bumped into a similar issue, an SSL SNI handshake error.

    My SSL handshake error manifested as follows:

    {code}
    $ git clone https://GIT-HOST/GIT-PROJECT.git
    Cloning into 'GIT-PROJECT'...
    fatal: unable to access 'https://GIT-HOST/GIT-PROJECT.git/': SSL peer handshake failed, the server most likely requires a client certificate to connect
    {code}

    My local Mac development environment:

    • Mac OS : Mac OS Sierra (10.12.2)
    • Git client : 2.10.1 (downloaded from Git sourforge, not the default Apple Mac OS release)
    • Open SSL : OpenSSL 1.0.2j 26 Sep 2016
    • Package manager : Mac Port (not Brew)

    I resolved the SSL SNI handshake error as follows:

    1/ Upgraded openssl resources for Mac Port

    {code}
    sudo pip install ndg-httpsclient pyasn1
    sudo pip install ndg-httpsclient pyasn1 --upgrade
    {code}

    2/ Upgraded Apple XCode developers tools

    e.g.

    {code}
    xcode-select --install
    {code}

    3/ Update Git client configuration

    Edit file $HOME/.gitconfig and change "sslvertify" from "false" to "true"

    From ...

    {code}
    ...

    [http]
    postBuffer = 209715200
    sslverify = false

    ....
    {code}

    To ...

    {code}
    ...

    [http]
    postBuffer = 209715200
    sslverify = true

    ....
    {code}

    Some helpful references:

    Regards,

    Tim

    email: [email protected]

  27. chscorpio commented on Nov 10, 2017

    @chscorpio

    Instead of wireshark, here is a simpler way to reveal this issue if you have openssl...

    $ openssl s_client -servername domain.com -connect domain.com:443 -state
    CONNECTED(00000003)
    SSL_connect:before/connect initialization
    SSL_connect:SSLv2/v3 write client hello A
    SSL3 alert read:warning:unrecognized name
    SSL_connect:SSLv3 read server hello A
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions