- Why is this happening? I have not been able to find an explanation online as to how the ssl ciphers work in curl
It depends on a few things. The client and server libraries, the client and server configurations, etc. You'd need to provide more details.
- Is there any way I can make curl tell me which ciphers
Use the right tool for the job. In this case, its an updated sslscan
.
- What options do I need to pass to curl_setopt so that my php script is able to connect to this server?
CURLOPT_SSL_CIPHER_LIST
.
- If I set the cipher to this, will that break other sites?
Maybe. It depends on that particular site's configuration.
Ideally, you pick 12 or 16 cipher suites you approve of, and then you use them instead of one. The 12 or 16 covers most sites you encounter on the internet.
Here's the list I usually use. Its from Which Cipher Suites to enable for SSL Socket?:
- TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
- TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
- TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
- TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
- TLS_DHE_DSS_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
- TLS_DHE_DSS_WITH_AES_128_GCM_SHA256
- TLS_DHE_DSS_WITH_AES_256_CBC_SHA256
- TLS_DHE_RSA_WITH_AES_128_CBC_SHA
- TLS_DHE_DSS_WITH_AES_128_CBC_SHA
- TLS_RSA_WITH_AES_256_CBC_SHA256
- TLS_RSA_WITH_AES_256_CBC_SHA
- TLS_RSA_WITH_AES_128_CBC_SHA256
- TLS_RSA_WITH_AES_128_CBC_SHA
I would like to ditch the TLS_RSA_*
cipher suites because they are key transport, but I need them for those older IIS servers I encounter.
As you can see from the scan results below, this list intersects with the server's list.
Note that you don't specify, say TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
. Rather, in OpenSSL, you specify the OpenSSL's name ECDHE-ECDSA-AES256-SHA384
for the suite. You can find the OpenSSL names at the documentation for openssl ciphers.
With OpenSSL, you can also use the string "HIGH:!aNULL:!MD5:!RC4:!PSK:!SRP"
. That will get you about 40 or 50 that are reasonably good choices.
You can run the OpenSSL ciphers command to see what the list is:
$ openssl ciphers -v 'HIGH:!aNULL:!MD5:!RC4:!PSK:!SRP'
ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH Au=RSA Enc=AESGCM(256) Mac=AEAD
ECDHE-ECDSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH Au=ECDSA Enc=AESGCM(256) Mac=AEAD
ECDHE-RSA-AES256-SHA384 TLSv1.2 Kx=ECDH Au=RSA Enc=AES(256) Mac=SHA384
ECDHE-ECDSA-AES256-SHA384 TLSv1.2 Kx=ECDH Au=ECDSA Enc=AES(256) Mac=SHA384
ECDHE-RSA-AES256-SHA SSLv3 Kx=ECDH Au=RSA Enc=AES(256) Mac=SHA1
ECDHE-ECDSA-AES256-SHA SSLv3 Kx=ECDH Au=ECDSA Enc=AES(256) Mac=SHA1
...
You can use an updated version of sslscan
to determine what cipher suites are available:
$ sslscan --no-failed sslspdy.com
...
Testing SSL server sslspdy.com on port 443
Supported Server Cipher(s):
Accepted TLSv1 256 bits ECDHE-ECDSA-AES256-SHA
Accepted TLSv1 128 bits ECDHE-ECDSA-AES128-SHA
Accepted TLSv1.1 256 bits ECDHE-ECDSA-AES256-SHA
Accepted TLSv1.1 128 bits ECDHE-ECDSA-AES128-SHA
Accepted TLSv1.2 256 bits ECDHE-ECDSA-AES256-GCM-SHA384
Accepted TLSv1.2 256 bits ECDHE-ECDSA-AES256-SHA384
Accepted TLSv1.2 256 bits ECDHE-ECDSA-AES256-SHA
Accepted TLSv1.2 128 bits ECDHE-ECDSA-AES128-GCM-SHA256
Accepted TLSv1.2 128 bits ECDHE-ECDSA-AES128-SHA256
Accepted TLSv1.2 128 bits ECDHE-ECDSA-AES128-SHA
Prefered Server Cipher(s):
TLSv1 128 bits ECDHE-ECDSA-AES128-SHA
TLSv1.1 128 bits ECDHE-ECDSA-AES128-SHA
TLSv1.2 128 bits ECDHE-ECDSA-AES128-GCM-SHA256