11use std:: { io:: Cursor , path:: Path } ;
22
3+ use rustls_pki_types:: { CertificateDer , pem:: PemObject } ;
34use snafu:: { ResultExt as _, Snafu } ;
45use stackable_operator:: commons:: tls_verification:: TlsClientDetails ;
56use tokio:: { fs:: File , io:: AsyncReadExt } ;
@@ -13,7 +14,9 @@ pub enum Error {
1314 ParseCaBundleReqwest { source : reqwest:: Error } ,
1415
1516 #[ snafu( display( "failed to split ca certificate bundle" ) ) ]
16- SplitCaBundle { source : std:: io:: Error } ,
17+ SplitCaBundle {
18+ source : rustls_pki_types:: pem:: Error ,
19+ } ,
1720
1821 #[ snafu( display( "failed to parse ca certificate (via native_tls)" ) ) ]
1922 ParseCaCertNativeTls { source : native_tls:: Error } ,
@@ -58,11 +61,12 @@ pub async fn configure_native_tls(
5861 } else if let Some ( tls_ca_cert_mount_path) = tls. tls_ca_cert_mount_path ( ) {
5962 builder. disable_built_in_roots ( true ) ;
6063 // native-tls doesn't support parsing CA *bundles*, so split them using rustls first
61- for ca_cert in rustls_pemfile :: certs ( & mut Cursor :: new (
64+ let mut pem_bytes = Cursor :: new (
6265 read_file ( & tls_ca_cert_mount_path)
6366 . await
6467 . context ( ReadCaBundleSnafu ) ?,
65- ) ) {
68+ ) ;
69+ for ca_cert in CertificateDer :: pem_reader_iter ( & mut pem_bytes) {
6670 builder. add_root_certificate (
6771 native_tls:: Certificate :: from_der ( & ca_cert. context ( SplitCaBundleSnafu ) ?)
6872 . context ( ParseCaCertNativeTlsSnafu ) ?,
0 commit comments