fix(core): pin etcd metrics and consul clients to rustls
This commit is contained in:
1 parent
77323715e7
commit
065da1a829
2 files changed
+10
No files matched your search
@@ -1224,7 +1224,12 @@ async fn build_etcd_metrics_client_with_identity(
|
||||
options: &EtcdMetricsConnectionOptions,
|
||||
include_identity: bool,
|
||||
) -> Result<reqwest::Client, String> {
|
||||
// The desktop binary pulls in reqwest's default `default-tls` feature, which unifies with
|
||||
// this crate's `rustls-tls` and makes `Client::builder()` silently select native-tls.
|
||||
// native-tls rejects the PEM client identity built below with `incompatible TLS identity
|
||||
// type`, so an mTLS etcd would lose its client certificate and fail the handshake.
|
||||
let mut builder = reqwest::Client::builder()
|
||||
.use_rustls_tls()
|
||||
.connect_timeout(ETCD_METRICS_TIMEOUT)
|
||||
.timeout(ETCD_METRICS_TIMEOUT)
|
||||
.redirect(reqwest::redirect::Policy::none());
|
||||
|
||||
@@ -19,7 +19,12 @@ pub struct ConsulClient {
|
||||
|
||||
impl ConsulClient {
|
||||
pub async fn new(mut config: ConsulConfig) -> Result<Self, String> {
|
||||
// The desktop build unifies reqwest with both `default-tls` and `rustls-tls`,
|
||||
// and `TlsBackend` defaults to native-tls there, which rejects the PEM identity
|
||||
// below with `incompatible TLS identity type`. Pin rustls like the etcd metrics
|
||||
// client so mTLS Consul works in every target.
|
||||
let mut builder = reqwest::Client::builder()
|
||||
.use_rustls_tls()
|
||||
.connect_timeout(Duration::from_secs(config.connect_timeout_secs.max(1)))
|
||||
.redirect(reqwest::redirect::Policy::none());
|
||||
if config.request_timeout_secs > 0 {
|
||||
|
||||
Reference in new issue
Block a user