Skip to content

Commit

Permalink
config setup for keystore storepass
Browse files Browse the repository at this point in the history
  • Loading branch information
voxparcxls committed Nov 14, 2023
1 parent 5ec2333 commit 98aa090
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
23 changes: 22 additions & 1 deletion cws-installer/src/main/java/jpl/cws/task/CwsInstaller.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ public class CwsInstaller {
private static String cws_shutdown_port;
private static String cws_tomcat_ajp_port;

private static String cws_keystore_storepass;

private static String cws_smtp_hostname;
private static String cws_smtp_port;

Expand Down Expand Up @@ -265,6 +267,7 @@ public static void main(String args[]) {
setupNotificationEmails();
setupTokenExpirationHours();
setupPorts();
setupKeystorePassword();
setupTaskAssigmentEmails();
setupSMTP();
setupElasticsearch();
Expand Down Expand Up @@ -1060,6 +1063,24 @@ private static void setupLimitToRemoveAbandonedWorkersByDays() {
}


private static void setupKeystorePassword() {
cws_keystore_storepass = getPreset("default_cws_keytool_keystore_storepass");

if (cws_installer_mode.equals("interactive")) {
if (cws_keystore_storepass == null) {
cws_keystore_storepass = readRequiredLine("Enter the Keystore password of .keystore ",
"Must specify a Keystore password!");
} else {
cws_keystore_storepass = readLine("Enter the Keystore password of .keystore " +
"Default is " + cws_keystore_storepass + ": ", cws_keystore_storepass);
}
} else {
if (cws_keystore_storepass == null) {
bailOutMissingOption("default_cws_keytool_keystore_storepass");
}
}
}

private static void setupPorts() {
// PROMPT USER FOR CWS WEB PORT
cws_tomcat_connector_port = getPreset("cws_web_port");
Expand Down Expand Up @@ -2397,7 +2418,7 @@ private static int validateKeystoreTruststore() {
long ONE_DAY_MS = 24 * 60 * 60 * 1000; // 24 hours
try {
KeyStore ks = KeyStore.getInstance("JKS");
ks.load(new FileInputStream(keystoreFilePath), "changeit".toCharArray());
ks.load(new FileInputStream(keystoreFilePath), cws_keystore_storepass.toCharArray());
Enumeration aliases = ks.aliases();
while(aliases.hasMoreElements()) {
String keystoreRoot = (String) aliases.nextElement();
Expand Down
1 change: 1 addition & 0 deletions install/installerPresets.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ default_amq_port=31616
default_amq_jmx_port=37099
default_cws_jmx_port=31099
default_cws_auth_scheme=LDAP
default_cws_keytool_keystore_storepass=changeit
default_startup_autoregister_process_defs=false
default_cws_token_expiration_hours=24
default_smtp_hostname=smtp.localhost
Expand Down

0 comments on commit 98aa090

Please sign in to comment.