File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ rmcp = { workspace = true }
1717futures = { workspace = true }
1818uuid = { workspace = true }
1919reqwest = { workspace = true }
20+ rustls = { workspace = true }
21+ rustls-platform-verifier = { workspace = true }
2022
2123[lints .clippy ]
2224unwrap_used = " deny"
Original file line number Diff line number Diff line change @@ -34,10 +34,22 @@ pub async fn connect_https(
3434 . pool_max_idle_per_host ( 10 )
3535 . tcp_keepalive ( std:: time:: Duration :: from_secs ( 60 ) ) ;
3636
37- // Configure mTLS if certificate chain is provided
37+ // Configure TLS: use mTLS cert chain if provided, otherwise use
38+ // platform-verified TLS so the OS CA store is trusted.
3839 if let Some ( cert_chain) = certificate_chain {
3940 let tls_config = cert_chain. create_client_config ( ) ?;
4041 client_builder = client_builder. use_preconfigured_tls ( tls_config) ;
42+ } else {
43+ let arc_crypto_provider = std:: sync:: Arc :: new ( rustls:: crypto:: ring:: default_provider ( ) ) ;
44+ if let Ok ( tls_config) = rustls:: ClientConfig :: builder_with_provider ( arc_crypto_provider)
45+ . with_safe_default_protocol_versions ( )
46+ . map ( |builder| {
47+ rustls_platform_verifier:: BuilderVerifierExt :: with_platform_verifier ( builder)
48+ . with_no_client_auth ( )
49+ } )
50+ {
51+ client_builder = client_builder. use_preconfigured_tls ( tls_config) ;
52+ }
4153 }
4254
4355 let http_client = client_builder. build ( ) ?;
Original file line number Diff line number Diff line change @@ -17,5 +17,7 @@ rmcp = { workspace = true }
1717tracing = { workspace = true }
1818toml = { workspace = true }
1919reqwest = { workspace = true }
20+ rustls = { workspace = true }
21+ rustls-platform-verifier = { workspace = true }
2022axum = { workspace = true }
2123axum-server = { workspace = true }
Original file line number Diff line number Diff line change @@ -374,7 +374,9 @@ impl ProxyServer {
374374 . pool_max_idle_per_host ( 10 )
375375 . tcp_keepalive ( std:: time:: Duration :: from_secs ( 60 ) ) ;
376376
377- // Configure mTLS if certificate chain is provided
377+ // Configure TLS: use mTLS cert chain if provided, otherwise use
378+ // platform-verified TLS so the OS CA store is trusted (needed for
379+ // warden container where a custom CA is installed).
378380 if let Some ( cert_chain) = certificate_chain. as_ref ( ) {
379381 match cert_chain. create_client_config ( ) {
380382 Ok ( tls_config) => {
@@ -385,6 +387,22 @@ impl ProxyServer {
385387 return ;
386388 }
387389 }
390+ } else {
391+ // No mTLS cert chain — use platform verifier to trust system CA store
392+ let arc_crypto_provider =
393+ std:: sync:: Arc :: new ( rustls:: crypto:: ring:: default_provider ( ) ) ;
394+ if let Ok ( tls_config) = rustls:: ClientConfig :: builder_with_provider (
395+ arc_crypto_provider,
396+ )
397+ . with_safe_default_protocol_versions ( )
398+ . map ( |builder| {
399+ rustls_platform_verifier:: BuilderVerifierExt :: with_platform_verifier (
400+ builder,
401+ )
402+ . with_no_client_auth ( )
403+ } ) {
404+ client_builder = client_builder. use_preconfigured_tls ( tls_config) ;
405+ }
388406 }
389407
390408 if let Some ( headers_map) = headers {
You can’t perform that action at this time.
0 commit comments