Skip to content

Commit

Permalink
Support Jetty's live cert reload on HTTPS frontend (apache#7355)
Browse files Browse the repository at this point in the history
* Support Jetty's live cert reload

Signed-off-by: Marcus Sorensen <mls@apple.com>

* Update ServerDaemon.java

---------

Signed-off-by: Marcus Sorensen <mls@apple.com>
Co-authored-by: Marcus Sorensen <mls@apple.com>
  • Loading branch information
2 people authored and Sina Kashipazha committed May 19, 2023
1 parent 7eb41a9 commit e13867c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions client/src/main/java/org/apache/cloudstack/ServerDaemon.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.eclipse.jetty.server.handler.RequestLogHandler;
import org.eclipse.jetty.server.handler.gzip.GzipHandler;
import org.eclipse.jetty.server.session.SessionHandler;
import org.eclipse.jetty.util.ssl.KeyStoreScanner;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.util.thread.ScheduledExecutorScheduler;
Expand Down Expand Up @@ -241,6 +242,14 @@ private void createHttpsConnector(final HttpConfiguration httpConfig) {
sslConnector.setPort(httpsPort);
sslConnector.setHost(bindInterface);
server.addConnector(sslConnector);

// add scanner to auto-reload certs
try {
KeyStoreScanner scanner = new KeyStoreScanner(sslContextFactory);
server.addBean(scanner);
} catch (Exception ex) {
LOG.error("failed to set up keystore scanner, manual refresh of certificates will be required", ex);
}
}
}

Expand Down

0 comments on commit e13867c

Please sign in to comment.