@@ -712,7 +712,7 @@ ca_roots_file = "{}"
712
712
let component_no1_host_client_tls_opts = component_no1_client_tls_opts
713
713
. get ( & "localhost:6551" . parse :: < Authority > ( ) . unwrap ( ) )
714
714
. unwrap ( ) ;
715
-
715
+
716
716
// verify that the last client_tls block wins for same component-id and host combination
717
717
assert ! ( component_no1_host_client_tls_opts. custom_root_ca. is_some( ) ) ;
718
718
}
@@ -740,7 +740,7 @@ pub struct ParsedClientTlsOpts {
740
740
pub custom_root_ca : Option < Vec < rustls_pki_types:: CertificateDer < ' static > > > ,
741
741
pub cert_chain : Option < Vec < rustls_pki_types:: CertificateDer < ' static > > > ,
742
742
pub private_key : Option < Arc < rustls_pki_types:: PrivateKeyDer < ' static > > > ,
743
- pub ca_webpki_roots : Option < bool > ,
743
+ pub ca_webpki_roots : bool ,
744
744
}
745
745
746
746
fn parse_client_tls_opts ( inp : & ClientTlsOpts ) -> Result < ParsedClientTlsOpts , anyhow:: Error > {
@@ -772,12 +772,23 @@ fn parse_client_tls_opts(inp: &ClientTlsOpts) -> Result<ParsedClientTlsOpts, any
772
772
} )
773
773
. collect :: < Result < Vec < Authority > , anyhow:: Error > > ( ) ?;
774
774
775
+ let custom_root_ca_provided = custom_root_ca. is_some ( ) ;
776
+
777
+ // use_ca_webpki_roots is true if
778
+ // 1. ca_webpki_roots is explicitly true in runtime config OR
779
+ // 2. custom_root_ca is not provided
780
+ //
781
+ // if custom_root_ca is provided, use_ca_webpki_roots defaults to false
782
+ let ca_webpki_roots =
783
+ inp. ca_webpki_roots
784
+ . unwrap_or ( if custom_root_ca_provided { false } else { true } ) ;
785
+
775
786
Ok ( ParsedClientTlsOpts {
776
787
hosts : parsed_hosts,
777
788
components : inp. component_ids . clone ( ) ,
778
789
custom_root_ca,
779
790
cert_chain,
780
791
private_key,
781
- ca_webpki_roots : inp . ca_webpki_roots ,
792
+ ca_webpki_roots,
782
793
} )
783
794
}
0 commit comments