与 CentOS、curl 和 ECDHE 的 SSL 握手

Bas*_*974 1 ssl centos nss logjam

由于 Logjam 漏洞,我将密码限制为 ECDHE,因此我无法再从 Centos 机器上执行 curl 操作。(来自 Ubuntu 的作品)

$ curl -v https://mysite.mydomain.com
 * 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).
Run Code Online (Sandbox Code Playgroud)

用 openssl 打开作品:

$ openssl s_client -connect mysite.mydomain.com:443 
   SSL-Session:
     Protocol  : TLSv1.2
     Cipher    : ECDHE-RSA-AES256-GCM-SHA384
Run Code Online (Sandbox Code Playgroud)

我尝试使用显式密码 --insecure 和 --tlsv1.2,但没有运气

$ curl --ciphers TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 -v https://mysite.mydomain.com
curl: (59) Unknown cipher in list: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
Run Code Online (Sandbox Code Playgroud)

编辑:尝试使用正确的 NSS 密码名称,并且小于 384 位:

curl --ciphers ecdhe_rsa_aes_128_sha_256 https://mysite.mydomain.com
* Connected to xxx (xxx) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* Unknown cipher in list: ecdhe_rsa_aes_128_sha_256
* Closing connection 0
curl: (59) Unknown cipher in list: ecdhe_rsa_aes_128_sha_256
Run Code Online (Sandbox Code Playgroud)

发现这个错误https://bugzilla.redhat.com/show_bug.cgi?id=1185708但并没有帮助我通过它。

SSLLabs 将这些密码报告为受支持:

TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (0xc030)   ECDH 256 bits (eq. 3072 bits RSA)   FS 256
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (0xc02f)   ECDH 256 bits (eq. 3072 bits RSA)   FS 128
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 (0xc028)   ECDH 256 bits (eq. 3072 bits RSA)   FS 256
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 (0xc027)   ECDH 256 bits (eq. 3072 bits RSA)   FS 128
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (0xc014)   ECDH 256 bits (eq. 3072 bits RSA)   FS    256
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (0xc013)   ECDH 256 bits (eq. 3072 bits RSA)   FS    128
Run Code Online (Sandbox Code Playgroud)

Ste*_*ich 5

RHEL/CentOS 在 NSS 中默认不启用 ECC。您必须明确指定您想要的密码,例如

curl --ciphers ecdhe_rsa_aes_128_gcm_sha_256  ....
Run Code Online (Sandbox Code Playgroud)

或者您的服务器支持并且您的 curl/NSS 版本也支持任何密码。

有关更多详细信息,请参阅/sf/answers/2177604201/

我尝试使用显式密码 --insecure 和 --tlsv1.2,但没有运气

此问题与证书验证无关,因此--insecure无济于事。

curl --ciphers TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384

NSS 和 OpenSSL 的密码名称不同,并且由于您使用的是带有 NSS 后端的 curl,因此您必须使用 NSS 语法。有关如何指定密码的信息,请参阅https://git.fedorahosted.org/cgit/mod_nss.git/plain/docs/mod_nss.html#Directives

此外,仅从 curl 7.36 开始支持使用 NSS 的 ECC。