【问题标题】:how to solve curl: (35) error如何解决卷曲:(35)错误
【发布时间】:2017-05-21 21:48:36
【问题描述】:

如果我在我的 CentOS 5 机器上运行这个命令:

curl -LsS https://symfony.com/installer -o /usr/local/bin/symfony

我收到此错误:

curl: (35) error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure

但是,如果我运行:

curl -v https://symfony.com/

我明白了:

* About to connect() to symfony.com port 443 (#0)
*   Trying 176.34.106.156...
* Connected to symfony.com (176.34.106.156) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using AES128-SHA
* Server certificate:
*        subject: OU=Domain Control Validated; OU=Gandi Standard SSL; CN=symfony.com
*        start date: 2014-11-21 00:00:00 GMT
*        expire date: 2017-11-21 23:59:59 GMT
*        subjectAltName: symfony.com matched
*        issuer: C=FR; ST=Paris; L=Paris; O=Gandi; CN=Gandi Standard SSL CA 2
*        SSL certificate verify ok.
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: symfony.com
> Accept: */*
> 
< HTTP/1.1 200 OK
< Accept-Ranges: bytes
< Age: 138
< Cache-Control: public, s-maxage=600
< Content-Type: text/html; charset=UTF-8
< Date: Sat, 07 Jan 2017 03:05:08 GMT
< Server: nginx/1.4.6 (Ubuntu)
< Via: 1.1 varnish-v4
< X-Varnish: 168003559 167316902
< Content-Length: 34582
< Connection: keep-alive
< 

使用 -v 选项,显然可以使用 SSLv3。如何使用第一条命令才能成功建立连接?

编辑:

我已经将 curl 信息与 curl 工作的 Redhat 服务器进行了比较,结果如下:

我的 CentOS 5 “curl -V”信息:

[root@orahost tls]# curl -V
curl 7.29.0 (i686-redhat-linux-gnu) libcurl/7.29.0 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5 libssh2/1.4.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp 
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz 

RedHat 6“curl -V”信息:

[root@vps-1128921-x /etc/pki/tls] # curl -V
curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.21 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz

我注意到我的 CentOS 使用 OpenSSL 而 Redhat 没有。会不会是这个问题?

【问题讨论】:

标签: curl openssl centos5


【解决方案1】:

您使用的是 Mac OS 吗?如果是这样,请尝试重新安装 cURL:

brew install curl
brew link curl --force

请参阅此链接以获取说明: https://unix.stackexchange.com/questions/192944/how-to-fix-curl-sslv3-alert-handshake-failure

也试试:

curl -LsS3 https://symfony.com/installer -o /usr/local/bin/symfony

为 --sslv3 添加 -3 选项。 如果您需要,以下是 cURL 的所有选项: https://curl.haxx.se/docs/manpage.html

【讨论】:

  • 我使用了 -3 选项,但出现了同样的问题。仅当我使用“symfony”二进制文件添加新项目时才会出现此问题。
  • 也许可以试试 wget。
  • 正如我所说,使用“symfony”二进制文件时也会出现这个问题,所以我认为我需要解决问题而不是尝试修补它。要使用 curl 应用程序,我使用了 http 而不是 https 并且它有效,但这是冰山一角,所以可能在 openSSL 库或类似的东西中存在一些错误配置
  • 我已经编辑了这个问题,比较了 curl 不工作的服务器和它工作的服务器。
  • 我认为我尝试连接的 https 服务器不支持 SSLv2 或 SSLv3。我通过执行以下命令意识到了这一点:openssl s_client -connect symfony.com:443 -ssl3。当我使用 tls1 而不是 ssl3 时,它连接良好。那么,我怎样才能告诉我的系统不使用 SSLv3 协议呢?您知道还是有必要提出其他问题?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2022-11-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-06-25
  • 2014-11-27
  • 2017-07-06
相关资源
最近更新 更多