Skip to content

Commit 0105589

Browse files
committed
ServerDaemon: Explicit provider and keystore type in FIPS mode
1 parent dbf9970 commit 0105589

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

client/src/main/java/org/apache/cloudstack/ServerDaemon.java

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,7 @@ private void createHttpsConnector(final HttpConfiguration httpConfig) {
261261
// Configure SSL
262262
if (httpsEnable && StringUtils.isNotEmpty(keystoreFile) && new File(keystoreFile).exists()) {
263263
// SSL Context
264-
final SslContextFactory sslContextFactory = new SslContextFactory.Server();
265-
266-
// Define keystore path and passwords
267-
sslContextFactory.setKeyStorePath(keystoreFile);
268-
sslContextFactory.setKeyStorePassword(keystorePassword);
269-
sslContextFactory.setKeyManagerPassword(keystorePassword);
264+
final SslContextFactory sslContextFactory = getSslContextFactory();
270265

271266
// HTTPS config
272267
final HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig);
@@ -290,6 +285,22 @@ private void createHttpsConnector(final HttpConfiguration httpConfig) {
290285
}
291286
}
292287

288+
private SslContextFactory getSslContextFactory() {
289+
final SslContextFactory sslContextFactory = new SslContextFactory.Server();
290+
291+
// Define keystore path and passwords
292+
sslContextFactory.setKeyStorePath(keystoreFile);
293+
sslContextFactory.setKeyStorePassword(keystorePassword);
294+
sslContextFactory.setKeyManagerPassword(keystorePassword);
295+
296+
if (CloudStackFipsUtils.FIPS_MODE) {
297+
// Explicit provider and keystore type
298+
sslContextFactory.setProvider("BCFIPS");
299+
sslContextFactory.setKeyStoreType("BCFKS");
300+
}
301+
return sslContextFactory;
302+
}
303+
293304
private Pair<SessionHandler,HandlerCollection> createHandlers() {
294305
final WebAppContext webApp = new WebAppContext();
295306
webApp.setContextPath(contextPath);

0 commit comments

Comments
 (0)