在 cURL 中禁用 SSLv3?

在 cURL 中禁用 SSLv3?

我在使用 cURL 连接到由 CloudFlare 托管的网站时遇到问题。当我尝试使用 HTTPS(使用 )连接到网站时curl -v https://www.xxxxxx.com,它显示:

* About to connect() to www.xxxxxx.com port 443 (#0)
*   Trying 2400:cb00:2048:1::681c:116e...
* Connected to www.xxxxxx.com (2400:cb00:2048:1::681c:116e) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* NSS error -12286 (SSL_ERROR_NO_CYPHER_OVERLAP)
* Cannot communicate securely with peer: no common encryption algorithm(s).
* Error in TLS handshake, trying SSLv3...
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: www.xxxxxx.com
> Accept: */*
>
* Connection died, retrying a fresh connect
* Closing connection 0
* Issue another request to this URL: 'https://www.xxxxxx.com'
* About to connect() to www.xxxxxx.com port 443 (#1)
*   Trying 2400:cb00:2048:1::681c:116e...
* Connected to www.xxxxxx.com (2400:cb00:2048:1::681c:116e) port 443 (#1)
* TLS disabled due to previous handshake failure
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* NSS error -12286 (SSL_ERROR_NO_CYPHER_OVERLAP)
* Cannot communicate securely with peer: no common encryption algorithm(s).
* Closing connection 1
curl: (35) Cannot communicate securely with peer: no common encryption algorithm(s).

我就这个问题联系了 CloudFlare,他们说这是因为 cURL 正在尝试使用 SSLv3 进行连接,但由于 POODLE 漏洞,他们禁用了它。我可以在 FreeBSD 10 上使用 cURL v7.38.0 连接,没有任何问题,但在 CentOS 6.5 上使用 cURL v7.29.0 则不行。

如果是因为它尝试连接到 SSLv3,那么如何在 cURL 上禁用 SSLv3?或者是别的什么?

答案1

看起来这个问题是由 cURL 版本不支持 ECC 256 位 SSL 证书和 ECDSA 签名算法(CloudFlare 使用的)引起的。您可以通过运行以下命令来测试您的 cURL 版本是否支持此加密:

curl -1IsS --ciphers ecdhe_ecdsa_aes_128_sha https://sslspdy.com

如果您收到以下信息,则表明您的 cURL 已过期:

curl: (59) Unknown cipher in list: ecdhe_ecdsa_aes_128_sha

否则,如果它连接并且不显示错误,则它是最新的。

由于 CentOS 似乎在将更新应用于其软件包之前对其进行了彻底的筛选,因此很难说这个问题何时会得到解决。这仅有的解决这个问题的方法是更新 cURL,传递-k--insecure不起作用。

相关内容