Only on Local Machine: [SSL: CERTIFICATE_VERIFY_FAILED] _ssl.c:1108) Error

冷暖自知 提交于 2021-01-29 13:20:45

问题


I can connect fine with Python to any external https site without this error: SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)')))

But I have a local webserver on my laptop with a self-signed certificate that works fine in itself but Python generates an _ssl.c:1108 error when I try to connect to it.

Any ideas?


回答1:


The python client does not have access and trust the CA certificate that signed the web server certificate. In your case that is the self-signed web server certificate.

To get the python client working, you can do the following:

  1. disable certificate verification. That is not a good idea but I guess is ok for a quick test. The emphasis is on "it is not recommended".
  2. Download the self-signed certificate and make it accessible to the python client and specify it as trusted CA certificate.
  3. Download and install a certificate from well known CAs such as LetsEncrypt (free) or commercial CAs. This is the recommended approach.

You could go into depth on the items mentioned herein and get a conceptual understanding how TLS operates.

EDIT 1: You could also get a free certificate from LetsEncrypt CA. Or you could get a free test certificate from most of the commercial CAs like DigiCert etc. See this link for getting and installing a free test certificate signed by a DigiCert test CA.

See this for details on python client configuration for TLS.



来源:https://stackoverflow.com/questions/61221803/only-on-local-machine-ssl-certificate-verify-failed-ssl-c1108-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!