X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;ds=sidebyside;f=src%2Forg%2Fcacert%2Fgigi%2FLauncher.java;h=a7730adcc9d249350fa555affeb949b109aa919c;hb=4b9842acd7dd0e79de8fc3f88cb8241f9b2f134e;hp=f5b65d73c64d0527ca7526a1803ae12410e5cfdb;hpb=cc328145806d21aa58f433db7774196972ac86a1;p=gigi.git diff --git a/src/org/cacert/gigi/Launcher.java b/src/org/cacert/gigi/Launcher.java index f5b65d73..a7730adc 100644 --- a/src/org/cacert/gigi/Launcher.java +++ b/src/org/cacert/gigi/Launcher.java @@ -2,6 +2,7 @@ package org.cacert.gigi; import java.io.ByteArrayInputStream; import java.io.IOException; +import java.net.HttpURLConnection; import java.net.InetSocketAddress; import java.security.GeneralSecurityException; import java.security.Key; @@ -105,6 +106,7 @@ public class Launcher { public synchronized void boot() throws Exception { Locale.setDefault(Locale.ENGLISH); TimeZone.setDefault(TimeZone.getTimeZone("UTC")); + HttpURLConnection.setFollowRedirects(false); conf = GigiConfig.parse(System.in); ServerConstants.init(conf.getMainProps()); @@ -137,7 +139,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(); @@ -151,8 +153,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); } @@ -282,11 +288,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(); @@ -304,7 +310,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"); @@ -328,7 +334,7 @@ public class Launcher { ContextHandler ch = new ContextHandler(); ch.setHandler(rh); ch.setVirtualHosts(new String[] { - ServerConstants.getStaticHostName() + ServerConstants.getStaticHostName() }); return ch; @@ -351,7 +357,7 @@ public class Launcher { ServletContextHandler sch = new ServletContextHandler(); sch.addVirtualHosts(new String[] { - ServerConstants.getApiHostName() + ServerConstants.getApiHostName() }); sch.addServlet(new ServletHolder(new GigiAPI()), "/*"); return sch;