Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable cURL SSL certificate verification [duplicate]

Hello i want to use an API for a website but there an error with my curl command.

I want to disable SSL certificate verification.

curl: (60) SSL certificate problem: self signed certificate in certificate chain More details here: https://curl.haxx.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. 
like image 675
Micky Avatar asked Feb 27 '18 15:02

Micky


People also ask

How do I disable SSL certificate verification in curl?

If you'd like to turn off curl's verification of the certificate, use the -k (or --insecure) option.

How does curl verify SSL certificate?

libcurl performs peer SSL certificate verification by default. This is done by using a CA certificate store that the SSL library can use to make sure the peer's server certificate is valid.


1 Answers

Simply add the -k switch somewhere before the url.

Disclaimer: Use this at your own risk.

man curl | less +/--insecure 

-k, --insecure (TLS) By default, every SSL connection curl makes is verified to be secure. This option allows curl to proceed and operate even for server connections otherwise considered insecure.

The server connection is verified by making sure the server's certificate contains the right name and verifies successfully using the cert store.

See this online resource for further details: https://curl.haxx.se/docs/sslcerts.html

See also --proxy-insecure and --cacert

like image 121
Gilles Quenot Avatar answered Oct 11 '22 14:10

Gilles Quenot