Skip to content

Commit ebd64ad

Browse files
committed
fix: Auto-create truststore on certificate addition
1 parent 09bf1ee commit ebd64ad

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

rust/operator-binary/src/authentication/ldap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ pub fn prepare_container_commands(
100100
command: &mut Vec<String>,
101101
) {
102102
if let Some(tls_ca_cert_mount_path) = provider.tls.tls_ca_cert_mount_path() {
103-
command.push(add_cert_to_trust_store_cmd(
103+
command.extend(add_cert_to_trust_store_cmd(
104104
&tls_ca_cert_mount_path,
105105
STACKABLE_TLS_DIR,
106106
TLS_STORE_PASSWORD,

rust/operator-binary/src/authentication/oidc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ pub fn main_container_commands(
111111
command: &mut Vec<String>,
112112
) {
113113
if let Some(tls_ca_cert_mount_path) = provider.tls.tls_ca_cert_mount_path() {
114-
command.push(add_cert_to_jvm_trust_store_cmd(&tls_ca_cert_mount_path))
114+
command.extend(add_cert_to_jvm_trust_store_cmd(&tls_ca_cert_mount_path))
115115
}
116116
}
117117

rust/operator-binary/src/crd/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ impl DruidRole {
997997

998998
if let Some(s3) = s3 {
999999
if let Some(ca_cert_file) = s3.tls.tls_ca_cert_mount_path() {
1000-
commands.push(add_cert_to_jvm_trust_store_cmd(&ca_cert_file));
1000+
commands.extend(add_cert_to_jvm_trust_store_cmd(&ca_cert_file));
10011001
}
10021002
}
10031003

rust/operator-binary/src/crd/security.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -475,14 +475,14 @@ pub fn add_cert_to_trust_store_cmd(
475475
cert_file: &str,
476476
destination_directory: &str,
477477
store_password: &str,
478-
) -> String {
478+
) -> Vec<String> {
479479
let truststore = format!("{destination_directory}/truststore.p12");
480-
format!(
481-
"cert-tools generate-pkcs12-truststore --pkcs12 {truststore}:{store_password} --pem {cert_file} --out {truststore} --out-password {store_password}"
482-
)
480+
vec![format!(
481+
"if [ -f {truststore} ]; then cert-tools generate-pkcs12-truststore --pkcs12 {truststore}:{store_password} --pem {cert_file} --out {truststore} --out-password {store_password}; else cert-tools generate-pkcs12-truststore --pem {cert_file} --out {truststore} --out-password {store_password}; fi" // "cert-tools generate-pkcs12-truststore --pkcs12 {truststore}:{store_password} --pem {cert_file} --out {truststore} --out-password {store_password}"
482+
)]
483483
}
484484

485485
/// Generate a bash command to add a CA to the truststore that is passed to the JVM
486-
pub fn add_cert_to_jvm_trust_store_cmd(cert_file: &str) -> String {
486+
pub fn add_cert_to_jvm_trust_store_cmd(cert_file: &str) -> Vec<String> {
487487
add_cert_to_trust_store_cmd(cert_file, "/stackable", STACKABLE_TRUST_STORE_PASSWORD)
488488
}

0 commit comments

Comments
 (0)