Replies: 1 comment 1 reply
|
There's no per-host hook, Easiest way out is two clients and picking one per request: let strict = reqwest::Client::new();
let lax = reqwest::Client::builder()
.tls_danger_accept_invalid_certs(true)
.build()?;
let host = url.host_str().unwrap_or_default();
let client = if is_exempt(host) { &lax } else { &strict };They keep separate connection pools, so a connection opened without validation can't be reused for a host you do validate. With a single client and a custom verifier that's on you to think about. The verifier route works too, and your read of it is right: One thing to know before you do: that method takes |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi!
If I had a list of domains or wildcards or similar (e.g.
["*.onion", "*.home.arpa"]etc) what would be the best way to only disable validation for these specific domains?For
ClientBuilderthere exists the optiontls_danger_accept_invalid_certswhich can globally enable or disable certificate validation for the entire client, but this is not what I am looking for as I want to keep validation enabled for requests not matching the configured hosts.I've seen I can use
tls_backend_preconfiguredto pass in an entire rustls backend which I assume could fix this, but that seems like overkill when I only need to disable validation for some domains?That could also quickly lead to security issues if i only check the SAN on the host itelf, and a mitm attacker serves a certificate for a SAN host we ignore but that we're supposed to validate.ServerCertVerifierfrom rustls providesserver_namein theverify_server_certmethod, so I could use that to determine if certs should be verified. There is however still no easy way to pass a custom validator into reqwest, which would be the ideal solution i thinkAll reactions