I am using Python 3 requests library (version 2.27.1) to make Log Search REST API calls using the https://us.api.insight.rapid7.com/log_search/management/logs resource. Early this morning my processes failed with the error message:
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)
I gather that the above message means the requested resource uses a self-signed cert. I’ve run this code successfully on a daily basis for months and haven’t yet encountered this error. Can you provide any insight (heh) on whether the certificate configurations may be causing this?
This is indeed a little strange, more so as I’m unable to reproduce the error when querying the same API with the same requests version.
Can you please share the script (or a snippet of it) with us so we can investigate this further?
Thanks, Tony! I saw this resolved yesterday afternoon, and I was able to make successful calls to the API. Appreciate the follow-up.
Hey good morning @tony_ennis1. Sorry, I believe I spoke too soon. I am seeing the same SSL error this morning. Here is my code:
That’s frustrating By any chance are you connected on a VPN or through a proxy when you run the script? If so, does it also happen when you are connecting directly to the internet instead?
Ah yes, I am connecting through a proxy, which my traffic is newly routed through. When the proxy was temporarily disabled yesterday the connection worked again. The proxy is back on this morning, so I am guessing that is related to this issue.
Yeah, it appears that would be the case. You’d need to check with the networking team to see if there’s any packet inspection happening that could be causing the cert validation to fail. Perhaps they can put an exclusion in place for that endpoint.
That was it! Configured an exception in the proxy and the requests are now working great. Thanks for your help!