cURL Ignore SSL Certificate Warnings

By | 2012/02/14

To ignore any ssl certificate warnings with curl, use the tack k option.


Here is an example:

$ curl -k https://examplewithbadsslcert.com

$ curl -I -k https://examplewithbadsslcert.com
HTTP/1.1 200 OK
Date: Tue, 14 Feb 2012 20:00:03 GMT
Server: Apache
Strict-Transport-Security: max-age=43200; includeSubDomains
X-Frame-Options: SAMEORIGIN
Set-Cookie: bb2_screener_=1329249603+66.202.152.198; path=/
Set-Cookie: PHPSESSID=lq5dpvfagbdstib7nlg2b8a0m7; path=/
X-Hello: Hello There
Vary: Accept-Encoding
Content-Type: text/html; charset=UTF-8


Without tack k, you’ll get various SSL certificate problem errors such as:

$ curl -I https://examplewithbadsslcert.com
curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

Cool!