Skip to content

Commit 66ff80b

Browse files
committed
fix unify key store constants
1 parent 57585c2 commit 66ff80b

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

rust/operator-binary/src/controller/build/security.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ use stackable_operator::{
3030
};
3131

3232
use crate::crd::{
33-
DruidRole, STACKABLE_TRUST_STORE_PASSWORD, STACKABLE_TRUST_STORE_TYPE,
33+
DruidRole, KEY_STORE_FILE, STACKABLE_TRUST_STORE_PASSWORD, STACKABLE_TRUST_STORE_TYPE,
34+
TRUST_STORE_FILE,
3435
security::{DruidTlsSecurity, PLAINTEXT_PORT_NAME, STACKABLE_TLS_DIR, TLS_PORT_NAME},
3536
};
3637

@@ -83,10 +84,6 @@ const TLS_ALIAS_NAME: &str = "1";
8384
const AUTH_TRUST_STORE_PATH: &str = "druid.auth.basic.ssl.trustStorePath";
8485
const AUTH_TRUST_STORE_TYPE: &str = "druid.auth.basic.ssl.trustStoreType";
8586
const AUTH_TRUST_STORE_PASSWORD: &str = "druid.auth.basic.ssl.trustStorePassword";
86-
// PKCS12 store file names (within the TLS store directory).
87-
const TRUST_STORE_FILE: &str = "truststore.p12";
88-
const KEY_STORE_FILE: &str = "keystore.p12";
89-
9087
// The layer-4 protocol used by all of Druid's exposed ports.
9188
const TCP_PROTOCOL: &str = "TCP";
9289

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ pub const HDFS_CONFIG_DIRECTORY: &str = "/stackable/hdfs";
8181
pub const LOG_CONFIG_DIRECTORY: &str = "/stackable/log_config";
8282
pub const RW_CONFIG_DIRECTORY: &str = "/stackable/rwconfig";
8383

84+
pub const TRUST_STORE_FILE: &str = "truststore.p12";
85+
pub const KEY_STORE_FILE: &str = "keystore.p12";
86+
8487
// store directories
8588
pub const STACKABLE_TRUST_STORE: &str = "/stackable/truststore.p12";
8689
pub const STACKABLE_TRUST_STORE_PASSWORD: &str = "changeit";

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use stackable_operator::v2::types::kubernetes::SecretClassName;
22

33
use crate::crd::{
4-
STACKABLE_TRUST_STORE_PASSWORD, authentication::AuthenticationClassesResolved, v1alpha1,
4+
STACKABLE_TRUST_STORE_PASSWORD, TRUST_STORE_FILE,
5+
authentication::AuthenticationClassesResolved, v1alpha1,
56
};
67

78
/// The validated TLS security decision for a Druid cluster: which server/internal TLS `SecretClass`
@@ -82,7 +83,7 @@ pub fn add_cert_to_trust_store_cmd(
8283
destination_directory: &str,
8384
store_password: &str,
8485
) -> Vec<String> {
85-
let truststore = format!("{destination_directory}/truststore.p12");
86+
let truststore = format!("{destination_directory}/{TRUST_STORE_FILE}");
8687
vec![format!(
8788
"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"
8889
)]

0 commit comments

Comments
 (0)