fix(core): pin etcd metrics and consul clients to rustls

This commit is contained in:
xiangwenhai authored and GitHub committed 2026-09-10 19:23:28 +08:00
1 parent 77323715e7
commit 065da1a829
2 files changed
+10

No files matched your search

+5
View File
@@ -1224,7 +1224,12 @@ async fn build_etcd_metrics_client_with_identity(
options: &EtcdMetricsConnectionOptions, options: &EtcdMetricsConnectionOptions,
include_identity: bool, include_identity: bool,
) -> Result<reqwest::Client, String> { ) -> 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() let mut builder = reqwest::Client::builder()
.use_rustls_tls()
.connect_timeout(ETCD_METRICS_TIMEOUT) .connect_timeout(ETCD_METRICS_TIMEOUT)
.timeout(ETCD_METRICS_TIMEOUT) .timeout(ETCD_METRICS_TIMEOUT)
.redirect(reqwest::redirect::Policy::none()); .redirect(reqwest::redirect::Policy::none());
+5
View File
@@ -19,7 +19,12 @@ pub struct ConsulClient {
impl ConsulClient { impl ConsulClient {
pub async fn new(mut config: ConsulConfig) -> Result<Self, String> { 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() let mut builder = reqwest::Client::builder()
.use_rustls_tls()
.connect_timeout(Duration::from_secs(config.connect_timeout_secs.max(1))) .connect_timeout(Duration::from_secs(config.connect_timeout_secs.max(1)))
.redirect(reqwest::redirect::Policy::none()); .redirect(reqwest::redirect::Policy::none());
if config.request_timeout_secs > 0 { if config.request_timeout_secs > 0 {