Skip to content

Commit 07e24a3

Browse files
fix: Auto-create truststore on certificate addition (#756)
* fix: Auto-create truststore on certificate addition * changelog * Increase test timeout * Remove leftover comment * Update CHANGELOG.md Co-authored-by: Malte Sander <[email protected]> --------- Co-authored-by: Malte Sander <[email protected]>
1 parent 09bf1ee commit 07e24a3

File tree

6 files changed

+11
-10
lines changed

6 files changed

+11
-10
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ All notable changes to this project will be documented in this file.
1515

1616
### Fixed
1717

18-
- Previously we had a bug that could lead to missing certificates ([#753]).
18+
- Fix keytool behavior that could lead to missing certificates ([#753], [#756]).
1919

2020
This could be the case when the Stackable PKI rotated its CA certificate or you specified multiple
2121
CAs in your SecretClass.
@@ -30,6 +30,7 @@ All notable changes to this project will be documented in this file.
3030
[#752]: https://github.com/stackabletech/druid-operator/pull/752
3131
[#753]: https://github.com/stackabletech/druid-operator/pull/753
3232
[#755]: https://github.com/stackabletech/druid-operator/pull/755
33+
[#756]: https://github.com/stackabletech/druid-operator/pull/756
3334

3435
## [25.7.0] - 2025-07-23
3536

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"
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
}

tests/templates/kuttl/ldap/20-assert.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ apiVersion: kuttl.dev/v1beta1
33
kind: TestAssert
44
commands:
55
- script: kubectl exec -n $NAMESPACE test-druid-0 -- python /tmp/authcheck.py
6-
timeout: 60
6+
timeout: 180

0 commit comments

Comments
 (0)