Closed Megidd closed 6 years ago
@Megidd you can use the stackoverflow answer in conjuction with our documentation here to pass in the verify
argument to your certificate.
Or you could install your self-signed certificate as a root certificate system-wide (the exact location will depend on your SSL library and operating system), so that it is trusted by all applications. After all, you want curl
, your web browser, etc, to trust this certificate - don't you?
Since all the HTTP requests python-cloudant makes go through Requests
you should also be able to use the REQUESTS_CA_BUNDLE
environment variable to point to a CA certificate file that will allow Requests
to validate your certificate without needing to pass the verify
argument to each request.
Setting the environment variable works - but really the whole r_session
handling could be better.
For one, the r_session
is None
until you use client.connect()
, which since we want to set the SSL path to prevent connect
from failing, kind of defeats the purpose...
Furthermore, if we use a bogus connect()
call to create r_session
, it still does not work well, for example, it will still give an SSL error even setting verify
to False
.
I think the r_session
object should be created together with the Cloudant
or CouchDB
object, so that we could chance the r_session
before actually connecting.
@AndreaPisoni Thanks for providing these details. We have no plans to implement this but you are welcome to raise a PR and our team will review it.
Cloudant (python-cloudant) version(s) that are affected by this issue.
Python version
A small code sample that demonstrates the issue: I have the following code in
script.py
file:Error
I'm using CouchDB with a self-signed SSL certificate, but I receive the following error:
Tried so far:
I have tried solutions like this one: How to get Python requests to trust a self signed SSL certificate?, but they are not helpful.