]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/Launcher.java
Merge "Update notes about password security"
[gigi.git] / src / org / cacert / gigi / Launcher.java
index 5811be77f5b00dc7a12ab30adcb2c5933b323c3e..7bf5bd119554387739d8b07a2647342cde3f82df 100644 (file)
@@ -69,7 +69,6 @@ public class Launcher {
             String proto = httpFields.getStringField("X-Real-Proto");
             String cert = httpFields.getStringField("X-Client-Cert");
             request.setSecure("https".equals(proto));
-            System.out.println(request.isSecure());
             request.setScheme(proto);
             if ( !"https".equals(proto)) {
                 cert = null;
@@ -138,7 +137,7 @@ public class Launcher {
         if (conf.getMainProps().getProperty("proxy", "false").equals("true")) {
             httpConfig.addCustomizer(new ExtendedForwarded());
             s.setConnectors(new Connector[] {
-                ConnectorsLauncher.createConnector(conf, s, httpConfig, false)
+                    ConnectorsLauncher.createConnector(conf, s, httpConfig, false)
             });
         } else {
             HttpConfiguration httpsConfig = createHttpConfiguration();
@@ -152,8 +151,12 @@ public class Launcher {
 
     private void initEmails(GigiConfig conf) throws GeneralSecurityException, IOException, KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException {
         KeyStore privateStore = conf.getPrivateStore();
-        Certificate mail = privateStore.getCertificate("mail");
-        Key k = privateStore.getKey("mail", conf.getPrivateStorePw().toCharArray());
+        Certificate mail = null;
+        Key k = null;
+        if (privateStore != null && privateStore.containsAlias("mail")) {
+            mail = privateStore.getCertificate("mail");
+            k = privateStore.getKey("mail", conf.getPrivateStorePw().toCharArray());
+        }
         EmailProvider.initSystem(conf.getMainProps(), mail, k);
     }
 
@@ -283,11 +286,11 @@ public class Launcher {
 
             ContextHandler ch = generateGigiServletContext(webAppServlet);
             ch.setVirtualHosts(new String[] {
-                ServerConstants.getWwwHostName()
+                    ServerConstants.getWwwHostName()
             });
             ContextHandler chSecure = generateGigiServletContext(webAppServlet);
             chSecure.setVirtualHosts(new String[] {
-                ServerConstants.getSecureHostName()
+                    ServerConstants.getSecureHostName()
             });
 
             HandlerList hl = new HandlerList();
@@ -305,7 +308,7 @@ public class Launcher {
             hw.setHandler(rh);
 
             ServletContextHandler servlet = new ServletContextHandler(ServletContextHandler.SESSIONS);
-            servlet.setInitParameter(SessionManager.__SessionCookieProperty, "CACert-Session");
+            servlet.setInitParameter(SessionManager.__SessionCookieProperty, "SomeCA-Session");
             servlet.addServlet(webAppServlet, "/*");
             ErrorPageErrorHandler epeh = new ErrorPageErrorHandler();
             epeh.addErrorPage(404, "/error");
@@ -329,7 +332,7 @@ public class Launcher {
             ContextHandler ch = new ContextHandler();
             ch.setHandler(rh);
             ch.setVirtualHosts(new String[] {
-                ServerConstants.getStaticHostName()
+                    ServerConstants.getStaticHostName()
             });
 
             return ch;
@@ -352,7 +355,7 @@ public class Launcher {
             ServletContextHandler sch = new ServletContextHandler();
 
             sch.addVirtualHosts(new String[] {
-                ServerConstants.getApiHostName()
+                    ServerConstants.getApiHostName()
             });
             sch.addServlet(new ServletHolder(new GigiAPI()), "/*");
             return sch;