SSL certificate validation confirms that the server’s identity and encryption are trustworthy. In testing environments with self-signed or expired certificates, cURL normally refuses the connection.

$ curl https://www.example.com/
curl: (51) Unable to communicate securely with peer: requested domain name does not match the server's certificate.

curl: (60) SSL: no alternative certificate subject name matches target host name 'www.example.com'
More details here: https://curl.haxx.se/docs/sslcerts.html

curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

Temporarily bypassing certificate checks with --insecure allows communication despite certificate issues, assisting in evaluating internal services or experimental setups without valid certificates.

This approach removes security safeguards, so it must be used judiciously to avoid exposing sensitive data or compromising security standards.

Steps to skip SSL certificate verification in cURL:

  1. Open a terminal.
  2. Attempt accessing a site with an invalid certificate.
    $ curl "https://www.example.com/"
    curl: (60) SSL certificate problem: ...
  3. Use --insecure to ignore certificate errors.
    $ curl --insecure "https://www.example.com/"
    <html>...</html>

    --insecure proceeds despite SSL issues.

  4. Add insecure to ~/.curlrc for all sessions if needed.
    $ echo "insecure" >> ~/.curlrc

    Persistent insecure mode is risky. Use only in controlled environments.

  5. Verify that output is now accessible without SSL errors.

    Carefully review responses; security checks are bypassed.

Discuss the article:

Comment anonymously. Login not required.