Curl

在 cURL 中禁用 SSLv3?

  • October 19, 2014

我在使用 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?或者是別的什麼?

看起來這個問題是由不支持 ECC 256 位 SSL 證書和 ECDSA 簽名算法(由 CloudFlare 使用)的 cURL 版本引起的。您可以通過執行以下命令來測試您的 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不起作用。

引用自:https://unix.stackexchange.com/questions/162816