Open anoronh4 opened 9 months ago
Hi @anoronh4 if yoy are using a self-signed certificate you need to define the CA as well for example:
ssl_ctx = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH)
ssl_ctx.load_verify_locations('ca.pem')
ssl_ctx.load_cert_chain(certfile='client-cert.pem',
keyfile='client-key.pem')
await nats.connect(servers=["tls://127.0.0.1:4443"], tls=ssl_ctx)
thanks for getting back to me. the person who sent the certfile and keyfile to me sent me their rootCA.pem file as well and unfortunately, it's still not working, i get CERTIFICATE_VERIFY_FAILED
. none of us are experts certificates or ssl so it could be that the files are being generated or installed the wrong way but it's a bit difficult to tell what's the underlying issue. in any case, i am getting the impression that this is an ssl issue, not a nats issue!
Observed behavior
when trying to connect to a secure nats server with TLS protocol i get the error:
I can work around this error by setting:
but this seems unsafe.
Expected behavior
expecting to connect to the server while also verifying the certificate.
Server and client version
i don't seem to have nats or nats-server in my PATH, only the nats-py was installed. my nats-py version is 2.6.0 i also have an up to date version of certifi and pip-system-certs
Host environment
MacOS
Steps to reproduce
the cert.pm file was not provided to me by the nats server maintainers. I have tried a number of ways to generate my own cert.pm or cacert.pm files to use in the context, but the problem persists. commenting out that line does not appear to make a difference. I also tried running
security find-certificate -a -p > ~/all_mac_certs.pem
and exporting the key from my Mac's keychain to get new inputs forload_verify_locations()
but i'm kind of lost here.my certifi installation is up to date.