Fixed programmatically using a Certificate object for HttpServer

This commit is contained in:
Ziver Koc 2021-08-22 02:11:06 +02:00
parent c197606204
commit ac27882ad1

View file

@ -95,12 +95,12 @@ public class HalServer {
HttpServer tmpHttpServer = null; HttpServer tmpHttpServer = null;
if ("dns".equals(HalContext.getStringProperty(HalContext.CONFIG_HTTP_EXTERNAL_ACME_TYPE, ""))) { if ("dns".equals(HalContext.getStringProperty(HalContext.CONFIG_HTTP_EXTERNAL_ACME_TYPE, ""))) {
acme = new AcmeClient(acmeDataStore, new AcmeManualDnsChallengeFactory(), AcmeClient.ACME_SERVER_LETSENCRYPT_STAGING); acme = new AcmeClient(acmeDataStore, new AcmeManualDnsChallengeFactory());
} else if ("http".equals(HalContext.getStringProperty(HalContext.CONFIG_HTTP_EXTERNAL_ACME_TYPE, "http"))) { } else if ("http".equals(HalContext.getStringProperty(HalContext.CONFIG_HTTP_EXTERNAL_ACME_TYPE, "http"))) {
tmpHttpServer = new HttpServer(80); tmpHttpServer = new HttpServer(80);
tmpHttpServer.start(); tmpHttpServer.start();
acme = new AcmeClient(acmeDataStore, new AcmeHttpChallengeFactory(tmpHttpServer), AcmeClient.ACME_SERVER_LETSENCRYPT_STAGING); acme = new AcmeClient(acmeDataStore, new AcmeHttpChallengeFactory(tmpHttpServer));
} else { } else {
throw new IllegalArgumentException("Unknown config value for " + externalServerUrl); throw new IllegalArgumentException("Unknown config value for " + externalServerUrl);
} }
@ -118,7 +118,7 @@ public class HalServer {
} }
} }
httpExternal = new HttpServer(HalContext.getIntegerProperty(CONFIG_HTTP_EXTERNAL_PORT), certificate); httpExternal = new HttpServer(HalContext.getIntegerProperty(CONFIG_HTTP_EXTERNAL_PORT), acmeDataStore.getDomainKeyPair().getPrivate(), certificate);
httpExternal.start(); httpExternal.start();
logger.info("External https server up and running at: " + externalServerUrl); logger.info("External https server up and running at: " + externalServerUrl);