如何禁用cURL SSL证书验证 [英] How to disable cURL SSL certificate verification
问题描述
您好,我想为网站使用API,但是我的curl命令出现错误。
Hello i want to use an API for a website but there an error with my curl command.
我想禁用 SSL证书
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.
推荐答案
只需添加 -k
切换到URL之前的某个位置。
Simply add the -k
switch somewhere before the url.
免责声明:使用此方法后果自负。
Disclaimer: Use this at your own risk.
man curl | less +/--insecure
-k,-不安全
(TLS )默认情况下,每个SSL连接curl都会经过验证是安全的。此选项允许curl继续进行操作
,即使对于服务器连接(否则认为不安全)。
-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.
通过确保服务器的证书包含正确的名称并成功验证$来验证服务器连接b $ b使用证书存储。
The server connection is verified by making sure the server's certificate contains the right name and verifies successfully using the cert store.
有关更多详细信息,请参见此在线资源:
https://curl.haxx.se/docs/sslcerts.html
See this online resource for further details: https://curl.haxx.se/docs/sslcerts.html
另请参阅--proxy-insecure和--cacert
See also --proxy-insecure and --cacert
这篇关于如何禁用cURL SSL证书验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!