Init certificates if sshd active
authorMathieu Baudier <mbaudier@argeo.org>
Tue, 30 May 2023 11:47:06 +0000 (13:47 +0200)
committerMathieu Baudier <mbaudier@argeo.org>
Tue, 30 May 2023 11:47:06 +0000 (13:47 +0200)
org.argeo.cms/src/org/argeo/cms/internal/runtime/CmsStateImpl.java

index 5dc8570099c608bae621e50b43b4f838e9ea092c..4d1d698453015bd0e2f82e122b6899ec0a84f1e9 100644 (file)
@@ -23,6 +23,7 @@ import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
 import java.util.StringJoiner;
+import java.util.TreeMap;
 import java.util.UUID;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ForkJoinPool;
@@ -152,6 +153,16 @@ public class CmsStateImpl implements CmsState {
                                log.debug("## CMS starting... (" + uuid + ")\n" + sb + "\n");
                        }
 
+                       if (log.isTraceEnabled()) {
+                               // print system properties
+                               StringJoiner sb = new StringJoiner("\n");
+                               for (Object key : new TreeMap<>(System.getProperties()).keySet()) {
+                                       sb.add(key + "=" + System.getProperty(key.toString()));
+                               }
+                               log.trace("System properties:\n" + sb + "\n");
+
+                       }
+
                } catch (RuntimeException | IOException e) {
                        log.error("## FATAL: CMS state failed", e);
                }
@@ -186,8 +197,9 @@ public class CmsStateImpl implements CmsState {
                // explicitly load JAAS configuration
                Configuration.getConfiguration();
 
-               boolean initSsl = getDeployProperty(CmsDeployProperty.HTTPS_PORT) != null;
-               if (initSsl) {
+               boolean initCertificates = (getDeployProperty(CmsDeployProperty.HTTPS_PORT) != null)
+                               || (getDeployProperty(CmsDeployProperty.SSHD_PORT) != null);
+               if (initCertificates) {
                        initCertificates();
                }
        }
@@ -236,9 +248,6 @@ public class CmsStateImpl implements CmsState {
                                log.error("Cannot trust CA certificate", e);
                        }
                }
-
-//             if (!Files.exists(keyStorePath))
-//                     PkiUtils.createSelfSignedKeyStore(keyStorePath, keyStorePassword, PkiUtils.PKCS12);
        }
 
        public void stop() {