title: curl server certificate verification failed
body: <p>I have a bunch of PHP scripts that use curl to communicate with various services. Currently, one of those services' SSL certificate got updated and my curl started crying about it when I try to get it from my server's CLI: </p>
  
  <pre><code>~$ curl https://example.com
  
  curl: (60) server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
  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.
  </code></pre>
  
  <p>Currently, I hardcoded <code>verify =&gt; false</code> to all of my requests in order to keep my scripts operating but that's not something I would like to have laying around.</p>
  
  <p>I got the latest <a href="https://curl.haxx.se/ca/cacert.pem" rel="nofollow noreferrer">cacert file from mozilla</a>, put it in <code>/etc/ssl/certs/ca-certificates.crt</code> and then ran <code>sudo update-ca-certificates</code> which ran successfully (I suppose..)</p>
  
  <pre><code>~$ sudo update-ca-certificates
  Updating certificates in /etc/ssl/certs...
  0 added, 0 removed; done.
  Running hooks in /etc/ca-certificates/update.d...
  done.
  </code></pre>
  
  <p>But then again curl is not too happy about it, still can't get my resource without passing the <code>-k</code> flag.</p>