Closed ausrasul closed 1 month ago
I couldn't find an option to turn of server certificate validation or provide the custom CA
You should be able to use native-tls
or rustls-tls
+rustls-tls-native-roots
and install your custom certificate into your OS storage (I don't use macOS, so I cannot help here, sorry).
If you're absolutely sure you want to provide certs directly in the application (for testing, because it's dangerous for production), you can create a custom HTTP client and provide it to Client::with_http_client()
(a good start here is the default impl).
native-tls
check Certificaterustls
check RootCertStoreWe can implement a more straightforward way to provide certs of custom CA, but it's definitely a feature request, not a bug cc @slvrtrn
Thanks Loyd, I wanted an option during development like dangerously disable certificate validation.
But even in rustls, I started to get the notion that disabling verification is removed and discouraged. Even during development. So I won't ask for it :)
I opted to toggle to http during dev. Installing the server's CA on the OS or in a custom client isn't practical/portable in our environment but it's good to know.
disabling verification is removed and discouraged
Yep, so I was talking about providing a custom certificate, not disabling verification.
Anyway, reqwest
provides a method to add a custom certificate, I think we can do the same
isn't practical/portable in our environment
Would you like to provide more details here?
Yes I checked reqwest, I could put the effort to implement clickhouse HttpClient. But it would be nice to have in the default client.
Currently we're doing a proof of concept, the cluster is created with docker-compose. A script takes number of shards, replicas and cluster name and generats server's configs, CA, and a docker-compose file.
So I start with clean slate cluster every time I want to try something new. This is done on a remote machine so I don't have direct access to the CA file. Additional reason for this is that the whole project can be replicated on a colleague's env without manual steps.
However I can change this and commit the test CA so it stays the same. Then I can add it in a custom client if env = dev. But this as bad as (may be less) disabling verification, only more verbose.
How would you go about it?
Describe the bug
I'm trying to connect to a local clickhouse server running https with self signed certificate. Using "native-tls" or "rustls-tls" features, I couldn't find an option to turn of server certificate validation or provide the custom CA. I get the following error:
I tried to browse to https://localhost:8444/play and it works despite the self-signed warnings.
Steps to reproduce
Expected behaviour
Connection should be made.
Code example
main.rs
Cargo.toml
Error log
Using rustls-tls:
Using native-tls:
Configuration
Environment
ClickHouse server