@@ -6,10 +6,7 @@ use stackable_operator::{
66} ;
77
88use crate :: crd:: {
9- constants:: {
10- STACKABLE_MOUNT_PATH_TLS , STACKABLE_TLS_STORE_PASSWORD , STACKABLE_TRUST_STORE ,
11- SYSTEM_TRUST_STORE , SYSTEM_TRUST_STORE_PASSWORD ,
12- } ,
9+ constants:: { STACKABLE_MOUNT_PATH_TLS , STACKABLE_TLS_STORE_PASSWORD , STACKABLE_TRUST_STORE } ,
1310 logdir:: ResolvedLogDir ,
1411} ;
1512
@@ -52,20 +49,17 @@ pub fn tls_secret_names<'a>(
5249 if names. is_empty ( ) { None } else { Some ( names) }
5350}
5451
55- pub fn convert_system_trust_store_to_pkcs12 ( ) -> Vec < String > {
56- vec ! [ format!(
57- "keytool -importkeystore -srckeystore {SYSTEM_TRUST_STORE} -srcstoretype jks -srcstorepass {SYSTEM_TRUST_STORE_PASSWORD} -destkeystore {STACKABLE_TRUST_STORE}/truststore.p12 -deststoretype pkcs12 -deststorepass {STACKABLE_TLS_STORE_PASSWORD} -noprompt "
58- ) ]
52+ pub fn convert_system_trust_store_to_pkcs12 ( ) -> String {
53+ format ! (
54+ "cert-tools generate-pkcs12-truststore --pem /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem --out {STACKABLE_TRUST_STORE}/truststore.p12 --out-password {STACKABLE_TLS_STORE_PASSWORD}"
55+ )
5956}
6057
61- pub fn import_truststore ( secret_name : & str ) -> Vec < String > {
58+ pub fn import_truststore ( secret_name : & str ) -> String {
6259 let mount_trust_store_path = format ! ( "{STACKABLE_MOUNT_PATH_TLS}/{secret_name}/truststore.p12" ) ;
6360 let trust_store_path = format ! ( "{STACKABLE_TRUST_STORE}/truststore.p12" ) ;
6461
65- vec ! [
66- format!( "echo Importing [{mount_trust_store_path}] to [{trust_store_path}] ..." ) ,
67- format!(
68- "keytool -importkeystore -srckeystore {mount_trust_store_path} -srcalias 1 -srcstorepass \" \" -destkeystore {trust_store_path} -destalias stackable-{secret_name} -storepass {STACKABLE_TLS_STORE_PASSWORD} -noprompt"
69- ) ,
70- ]
62+ format ! (
63+ "cert-tools generate-pkcs12-truststore --pkcs12 {trust_store_path}:{STACKABLE_TLS_STORE_PASSWORD} --pkcs12 {mount_trust_store_path} --out {trust_store_path} --out-password {STACKABLE_TLS_STORE_PASSWORD}"
64+ )
7165}
0 commit comments