alexdlaird / pyngrok

A Python wrapper for ngrok
https://pyngrok.readthedocs.io
MIT License
421 stars 59 forks source link

FIXED CANNOT VERIFY CERTIFICATE ERROR #75

Closed HugoLB0 closed 3 years ago

HugoLB0 commented 3 years ago

Description When I tried to use pyngrok, the library need to download brook first. But the SSL certificate cannot be verified. So I added three lines of code to disable SSL certificate check in urllib.

OUTPUT of the error: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1125)>

Issues <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1125)>

Type of Change

Testing Done The library work fine after that change.

alexdlaird commented 3 years ago

This seems like it'd be an issue (temporary or otherwise) with https://bin.equinox.io, not an issue with pyngrok or even a bug, and in either case I'm not sure such a security workaround introduced in to pyngrok when downloading and extracting a binary is a good idea. The certificate appears to be valid (at least at the time of this comment), so does the issue still exist? If so, what is the reason for it being deemed invalid? Are you behind a VPN, or is something else interfering with the connection?

If more context is introduced that makes this relevant to pyngrok, I’ll reconsider it. But if not, you can always tell pip to use your fork instead of the package, and there is syntax to do that in a requirements file as well.

HugoLB0 commented 3 years ago

Hi, yes you’re right I’m using a VPN, but I don’t think the issue is entirely because of that. After some research on the internet, and from what I’ve experienced, the issue is not caused by the website or anything, the issue is urllib itself. So I ended up with what I think is a good solution: we can use a try/except statement to first try to connect to the website and verify the ssl certificate, and if there is a error, catch it with except and just skip the certificate verification.

Sent from my iPhone

On Dec 31, 2020, at 05:56, Alex Laird notifications@github.com wrote:

 Closed #75.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.