You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ga...@apache.org on 2024/06/14 15:43:27 UTC
(flink) branch master updated: [FLINK-35371][security] Add configuration for SSL keystore and truststore type
This is an automated email from the ASF dual-hosted git repository.
gaborgsomogyi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/master by this push:
new 0919ff20b91 [FLINK-35371][security] Add configuration for SSL keystore and truststore type
0919ff20b91 is described below
commit 0919ff20b918736c86f6c3449b21b3f1528bb2c0
Author: ammar-master <35...@users.noreply.github.com>
AuthorDate: Fri Jun 14 08:43:20 2024 -0700
[FLINK-35371][security] Add configuration for SSL keystore and truststore type
---
.../generated/security_configuration.html | 24 +++++++++++
.../shortcodes/generated/security_ssl_section.html | 24 +++++++++++
.../flink/configuration/SecurityOptions.java | 44 +++++++++++++++++++
.../runtime/rpc/pekko/CustomSSLEngineProvider.java | 35 +++++++++++++++-
.../apache/flink/runtime/rpc/pekko/PekkoUtils.java | 6 +++
.../flink/runtime/rpc/pekko/PekkoUtilsTest.java | 14 +++++++
.../org/apache/flink/runtime/net/SSLUtils.java | 17 +++++++-
.../org/apache/flink/runtime/net/SSLUtilsTest.java | 49 ++++++++++++++++++++++
8 files changed, 209 insertions(+), 4 deletions(-)
diff --git a/docs/layouts/shortcodes/generated/security_configuration.html b/docs/layouts/shortcodes/generated/security_configuration.html
index 069825bdd65..ff19479042e 100644
--- a/docs/layouts/shortcodes/generated/security_configuration.html
+++ b/docs/layouts/shortcodes/generated/security_configuration.html
@@ -134,6 +134,12 @@
<td>String</td>
<td>The secret to decrypt the keystore file for Flink's for Flink's internal endpoints (rpc, data transport, blob server).</td>
</tr>
+ <tr>
+ <td><h5>security.ssl.internal.keystore-type</h5></td>
+ <td style="word-wrap: break-word;">JVM default keystore type</td>
+ <td>String</td>
+ <td>The type of keystore for Flink's internal endpoints (rpc, data transport, blob server).</td>
+ </tr>
<tr>
<td><h5>security.ssl.internal.session-cache-size</h5></td>
<td style="word-wrap: break-word;">-1</td>
@@ -158,6 +164,12 @@
<td>String</td>
<td>The password to decrypt the truststore for Flink's internal endpoints (rpc, data transport, blob server).</td>
</tr>
+ <tr>
+ <td><h5>security.ssl.internal.truststore-type</h5></td>
+ <td style="word-wrap: break-word;">JVM default keystore type</td>
+ <td>String</td>
+ <td>The type of truststore for Flink's internal endpoints (rpc, data transport, blob server).</td>
+ </tr>
<tr>
<td><h5>security.ssl.protocol</h5></td>
<td style="word-wrap: break-word;">"TLSv1.2"</td>
@@ -206,6 +218,12 @@
<td>String</td>
<td>The secret to decrypt the keystore file for Flink's for Flink's external REST endpoints.</td>
</tr>
+ <tr>
+ <td><h5>security.ssl.rest.keystore-type</h5></td>
+ <td style="word-wrap: break-word;">JVM default keystore type</td>
+ <td>String</td>
+ <td>The type of the keystore for Flink's external REST endpoints.</td>
+ </tr>
<tr>
<td><h5>security.ssl.rest.truststore</h5></td>
<td style="word-wrap: break-word;">(none)</td>
@@ -218,6 +236,12 @@
<td>String</td>
<td>The password to decrypt the truststore for Flink's external REST endpoints.</td>
</tr>
+ <tr>
+ <td><h5>security.ssl.rest.truststore-type</h5></td>
+ <td style="word-wrap: break-word;">JVM default keystore type</td>
+ <td>String</td>
+ <td>The type of the truststore for Flink's external REST endpoints.</td>
+ </tr>
<tr>
<td><h5>security.ssl.verify-hostname</h5></td>
<td style="word-wrap: break-word;">true</td>
diff --git a/docs/layouts/shortcodes/generated/security_ssl_section.html b/docs/layouts/shortcodes/generated/security_ssl_section.html
index 3a4e55a8e95..ad5c72b3cf2 100644
--- a/docs/layouts/shortcodes/generated/security_ssl_section.html
+++ b/docs/layouts/shortcodes/generated/security_ssl_section.html
@@ -44,6 +44,12 @@
<td>String</td>
<td>The secret to decrypt the keystore file for Flink's for Flink's internal endpoints (rpc, data transport, blob server).</td>
</tr>
+ <tr>
+ <td><h5>security.ssl.internal.keystore-type</h5></td>
+ <td style="word-wrap: break-word;">JVM default keystore type</td>
+ <td>String</td>
+ <td>The type of keystore for Flink's internal endpoints (rpc, data transport, blob server).</td>
+ </tr>
<tr>
<td><h5>security.ssl.internal.truststore</h5></td>
<td style="word-wrap: break-word;">(none)</td>
@@ -56,6 +62,12 @@
<td>String</td>
<td>The password to decrypt the truststore for Flink's internal endpoints (rpc, data transport, blob server).</td>
</tr>
+ <tr>
+ <td><h5>security.ssl.internal.truststore-type</h5></td>
+ <td style="word-wrap: break-word;">JVM default keystore type</td>
+ <td>String</td>
+ <td>The type of truststore for Flink's internal endpoints (rpc, data transport, blob server).</td>
+ </tr>
<tr>
<td><h5>security.ssl.protocol</h5></td>
<td style="word-wrap: break-word;">"TLSv1.2"</td>
@@ -98,6 +110,12 @@
<td>String</td>
<td>The secret to decrypt the keystore file for Flink's for Flink's external REST endpoints.</td>
</tr>
+ <tr>
+ <td><h5>security.ssl.rest.keystore-type</h5></td>
+ <td style="word-wrap: break-word;">JVM default keystore type</td>
+ <td>String</td>
+ <td>The type of the keystore for Flink's external REST endpoints.</td>
+ </tr>
<tr>
<td><h5>security.ssl.rest.truststore</h5></td>
<td style="word-wrap: break-word;">(none)</td>
@@ -110,6 +128,12 @@
<td>String</td>
<td>The password to decrypt the truststore for Flink's external REST endpoints.</td>
</tr>
+ <tr>
+ <td><h5>security.ssl.rest.truststore-type</h5></td>
+ <td style="word-wrap: break-word;">JVM default keystore type</td>
+ <td>String</td>
+ <td>The type of the truststore for Flink's external REST endpoints.</td>
+ </tr>
<tr>
<td><h5>security.ssl.verify-hostname</h5></td>
<td style="word-wrap: break-word;">true</td>
diff --git a/flink-core/src/main/java/org/apache/flink/configuration/SecurityOptions.java b/flink-core/src/main/java/org/apache/flink/configuration/SecurityOptions.java
index a8f0d24674c..a6b95811140 100644
--- a/flink-core/src/main/java/org/apache/flink/configuration/SecurityOptions.java
+++ b/flink-core/src/main/java/org/apache/flink/configuration/SecurityOptions.java
@@ -24,6 +24,7 @@ import org.apache.flink.annotation.docs.Documentation;
import org.apache.flink.configuration.description.Description;
import org.apache.flink.core.security.token.DelegationTokenProvider;
+import java.security.KeyStore;
import java.time.Duration;
import java.util.List;
@@ -40,6 +41,7 @@ public class SecurityOptions {
public static final String DELEGATION_TOKEN_PROVIDER_PREFIX =
DelegationTokenProvider.CONFIG_PREFIX + ".<serviceName>";
+ private static final String DEFAULT_KEYSTORE_DOC = "JVM default keystore type";
// ------------------------------------------------------------------------
// Custom Security Service Loader
@@ -386,6 +388,17 @@ public class SecurityOptions {
"The secret to decrypt the key in the keystore "
+ "for Flink's internal endpoints (rpc, data transport, blob server).");
+ /** For internal SSL, the type of the keystore. */
+ @Documentation.Section(Documentation.Sections.SECURITY_SSL)
+ @Documentation.OverrideDefault(DEFAULT_KEYSTORE_DOC)
+ public static final ConfigOption<String> SSL_INTERNAL_KEYSTORE_TYPE =
+ key("security.ssl.internal.keystore-type")
+ .stringType()
+ .defaultValue(KeyStore.getDefaultType())
+ .withDescription(
+ "The type of keystore "
+ + "for Flink's internal endpoints (rpc, data transport, blob server).");
+
/**
* For internal SSL, the truststore file containing the public CA certificates to verify the ssl
* peers.
@@ -409,6 +422,17 @@ public class SecurityOptions {
"The password to decrypt the truststore "
+ "for Flink's internal endpoints (rpc, data transport, blob server).");
+ /** For internal SSL, the type of the truststore. */
+ @Documentation.Section(Documentation.Sections.SECURITY_SSL)
+ @Documentation.OverrideDefault(DEFAULT_KEYSTORE_DOC)
+ public static final ConfigOption<String> SSL_INTERNAL_TRUSTSTORE_TYPE =
+ key("security.ssl.internal.truststore-type")
+ .stringType()
+ .defaultValue(KeyStore.getDefaultType())
+ .withDescription(
+ "The type of truststore "
+ + "for Flink's internal endpoints (rpc, data transport, blob server).");
+
/** For internal SSL, the sha1 fingerprint of the internal certificate to verify the client. */
@Documentation.Section(Documentation.Sections.SECURITY_SSL)
public static final ConfigOption<String> SSL_INTERNAL_CERT_FINGERPRINT =
@@ -457,6 +481,16 @@ public class SecurityOptions {
"The secret to decrypt the key in the keystore "
+ "for Flink's external REST endpoints.");
+ /** For external (REST) SSL, the type of the keystore. */
+ @Documentation.Section(Documentation.Sections.SECURITY_SSL)
+ @Documentation.OverrideDefault(DEFAULT_KEYSTORE_DOC)
+ public static final ConfigOption<String> SSL_REST_KEYSTORE_TYPE =
+ key("security.ssl.rest.keystore-type")
+ .stringType()
+ .defaultValue(KeyStore.getDefaultType())
+ .withDescription(
+ "The type of the keystore for Flink's external REST endpoints.");
+
/**
* For external (REST) SSL, the truststore file containing the public CA certificates to verify
* the ssl peers.
@@ -480,6 +514,16 @@ public class SecurityOptions {
"The password to decrypt the truststore "
+ "for Flink's external REST endpoints.");
+ /** For external (REST) SSL, the type of the truststore. */
+ @Documentation.Section(Documentation.Sections.SECURITY_SSL)
+ @Documentation.OverrideDefault(DEFAULT_KEYSTORE_DOC)
+ public static final ConfigOption<String> SSL_REST_TRUSTSTORE_TYPE =
+ key("security.ssl.rest.truststore-type")
+ .stringType()
+ .defaultValue(KeyStore.getDefaultType())
+ .withDescription(
+ "The type of the truststore for Flink's external REST endpoints.");
+
/** For external (REST) SSL, the sha1 fingerprint of the rest client certificate to verify. */
@Documentation.Section(Documentation.Sections.SECURITY_SSL)
public static final ConfigOption<String> SSL_REST_CERT_FINGERPRINT =
diff --git a/flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/pekko/CustomSSLEngineProvider.java b/flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/pekko/CustomSSLEngineProvider.java
index abb0a6f1fad..e2ea1801ea8 100644
--- a/flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/pekko/CustomSSLEngineProvider.java
+++ b/flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/pekko/CustomSSLEngineProvider.java
@@ -27,7 +27,12 @@ import org.apache.pekko.remote.transport.netty.ConfigSSLEngineProvider;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.security.GeneralSecurityException;
+import java.security.KeyStore;
import java.util.List;
/**
@@ -38,6 +43,8 @@ public class CustomSSLEngineProvider extends ConfigSSLEngineProvider {
private final String sslTrustStore;
private final String sslTrustStorePassword;
private final List<String> sslCertFingerprints;
+ private final String sslKeyStoreType;
+ private final String sslTrustStoreType;
public CustomSSLEngineProvider(ActorSystem system) {
super(system);
@@ -46,6 +53,8 @@ public class CustomSSLEngineProvider extends ConfigSSLEngineProvider {
sslTrustStore = securityConfig.getString("trust-store");
sslTrustStorePassword = securityConfig.getString("trust-store-password");
sslCertFingerprints = securityConfig.getStringList("cert-fingerprints");
+ sslKeyStoreType = securityConfig.getString("key-store-type");
+ sslTrustStoreType = securityConfig.getString("trust-store-type");
}
@Override
@@ -59,13 +68,35 @@ public class CustomSSLEngineProvider extends ConfigSSLEngineProvider {
.fingerprints(sslCertFingerprints)
.build();
- trustManagerFactory.init(loadKeystore(sslTrustStore, sslTrustStorePassword));
+ trustManagerFactory.init(
+ loadKeystore(sslTrustStore, sslTrustStorePassword, sslTrustStoreType));
return trustManagerFactory.getTrustManagers();
- } catch (GeneralSecurityException e) {
+ } catch (GeneralSecurityException | IOException e) {
// replicate exception handling from SSLEngineProvider
throw new RemoteTransportException(
"Server SSL connection could not be established because SSL context could not be constructed",
e);
}
}
+
+ @Override
+ public KeyStore loadKeystore(String filename, String password) {
+ try {
+ return loadKeystore(filename, password, sslKeyStoreType);
+ } catch (IOException | GeneralSecurityException e) {
+ throw new RemoteTransportException(
+ "Server SSL connection could not be established because key store could not be loaded",
+ e);
+ }
+ }
+
+ private KeyStore loadKeystore(String filename, String password, String keystoreType)
+ throws IOException, GeneralSecurityException {
+ KeyStore keyStore = KeyStore.getInstance(keystoreType);
+ try (InputStream fin = Files.newInputStream(Paths.get(filename))) {
+ char[] passwordCharArray = password.toCharArray();
+ keyStore.load(fin, passwordCharArray);
+ }
+ return keyStore;
+ }
}
diff --git a/flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/pekko/PekkoUtils.java b/flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/pekko/PekkoUtils.java
index 7458c4d9a02..7571c078f8f 100644
--- a/flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/pekko/PekkoUtils.java
+++ b/flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/pekko/PekkoUtils.java
@@ -322,6 +322,8 @@ class PekkoUtils {
configuration.get(
SecurityOptions.SSL_INTERNAL_KEYSTORE_PASSWORD,
configuration.get(SecurityOptions.SSL_KEYSTORE_PASSWORD));
+ final String sslKeyStoreType =
+ configuration.get(SecurityOptions.SSL_INTERNAL_KEYSTORE_TYPE);
final String sslKeyPassword =
configuration.get(
@@ -337,6 +339,8 @@ class PekkoUtils {
configuration.get(
SecurityOptions.SSL_INTERNAL_TRUSTSTORE_PASSWORD,
configuration.get(SecurityOptions.SSL_TRUSTSTORE_PASSWORD));
+ final String sslTrustStoreType =
+ configuration.get(SecurityOptions.SSL_INTERNAL_TRUSTSTORE_TYPE);
final String sslCertFingerprintString =
configuration.get(SecurityOptions.SSL_INTERNAL_CERT_FINGERPRINT);
@@ -368,9 +372,11 @@ class PekkoUtils {
.add(" security {")
.add(" key-store = \"" + sslKeyStore + "\"")
.add(" key-store-password = \"" + sslKeyStorePassword + "\"")
+ .add(" key-store-type = \"" + sslKeyStoreType + "\"")
.add(" key-password = \"" + sslKeyPassword + "\"")
.add(" trust-store = \"" + sslTrustStore + "\"")
.add(" trust-store-password = \"" + sslTrustStorePassword + "\"")
+ .add(" trust-store-type = \"" + sslTrustStoreType + "\"")
.add(" protocol = " + sslProtocol + "")
.add(" enabled-algorithms = " + sslAlgorithms + "")
.add(" random-number-generator = \"\"")
diff --git a/flink-rpc/flink-rpc-akka/src/test/java/org/apache/flink/runtime/rpc/pekko/PekkoUtilsTest.java b/flink-rpc/flink-rpc-akka/src/test/java/org/apache/flink/runtime/rpc/pekko/PekkoUtilsTest.java
index 553b2cd5589..8bd864a29db 100644
--- a/flink-rpc/flink-rpc-akka/src/test/java/org/apache/flink/runtime/rpc/pekko/PekkoUtilsTest.java
+++ b/flink-rpc/flink-rpc-akka/src/test/java/org/apache/flink/runtime/rpc/pekko/PekkoUtilsTest.java
@@ -263,4 +263,18 @@ class PekkoUtilsTest {
.isEqualTo("org.apache.flink.runtime.rpc.pekko.CustomSSLEngineProvider");
assertThat(sslConfig.getStringList("security.cert-fingerprints")).contains(fingerprint);
}
+
+ @Test
+ void getConfigCustomKeyOrTruststoreType() {
+ final Configuration configuration = new Configuration();
+ configuration.set(SecurityOptions.SSL_INTERNAL_ENABLED, true);
+ configuration.set(SecurityOptions.SSL_INTERNAL_KEYSTORE_TYPE, "JKS");
+ configuration.set(SecurityOptions.SSL_INTERNAL_TRUSTSTORE_TYPE, "JKS");
+
+ final Config config =
+ PekkoUtils.getConfig(configuration, new HostAndPort("localhost", 31337));
+ final Config securityConfig = config.getConfig("pekko.remote.classic.netty.ssl.security");
+ assertThat(securityConfig.getString("key-store-type")).isEqualTo("JKS");
+ assertThat(securityConfig.getString("trust-store-type")).isEqualTo("JKS");
+ }
}
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/net/SSLUtils.java b/flink-runtime/src/main/java/org/apache/flink/runtime/net/SSLUtils.java
index 89e7b029c50..c9f9d0e60c9 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/net/SSLUtils.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/net/SSLUtils.java
@@ -212,6 +212,12 @@ public class SSLUtils {
? SecurityOptions.SSL_INTERNAL_TRUSTSTORE_PASSWORD
: SecurityOptions.SSL_REST_TRUSTSTORE_PASSWORD,
config.get(SecurityOptions.SSL_TRUSTSTORE_PASSWORD));
+ // do not use getAndCheckOption here as there is no fallback option and a default is
+ // specified
+ String truststoreType =
+ internal
+ ? config.get(SecurityOptions.SSL_INTERNAL_TRUSTSTORE_TYPE)
+ : config.get(SecurityOptions.SSL_REST_TRUSTSTORE_TYPE);
// Support for the REST client connecting to external HTTPS URLs to fall back to the
// default trust store of the provider (JDK).
@@ -233,7 +239,7 @@ public class SSLUtils {
+ " is missing.");
}
- KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
+ KeyStore trustStore = KeyStore.getInstance(truststoreType);
try (InputStream trustStoreFile =
Files.newInputStream(new File(trustStoreFilePath).toPath())) {
trustStore.load(trustStoreFile, trustStorePassword.toCharArray());
@@ -285,7 +291,14 @@ public class SSLUtils {
: SecurityOptions.SSL_REST_KEY_PASSWORD,
SecurityOptions.SSL_KEY_PASSWORD);
- KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
+ // do not use getAndCheckOption here as there is no fallback option and a default is
+ // specified
+ String keystoreType =
+ internal
+ ? config.get(SecurityOptions.SSL_INTERNAL_KEYSTORE_TYPE)
+ : config.get(SecurityOptions.SSL_REST_KEYSTORE_TYPE);
+
+ KeyStore keyStore = KeyStore.getInstance(keystoreType);
try (InputStream keyStoreFile = Files.newInputStream(new File(keystoreFilePath).toPath())) {
keyStore.load(keyStoreFile, keystorePassword.toCharArray());
}
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/net/SSLUtilsTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/net/SSLUtilsTest.java
index fc8af22ea65..183665fcb6a 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/net/SSLUtilsTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/net/SSLUtilsTest.java
@@ -40,6 +40,7 @@ import java.io.InputStream;
import java.net.ServerSocket;
import java.nio.file.Files;
import java.security.KeyStore;
+import java.security.KeyStoreException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.cert.Certificate;
@@ -148,6 +149,17 @@ public class SSLUtilsTest {
.isInstanceOf(Exception.class);
}
+ /** Tests that REST Client SSL Engine creation fails with bad SSL configuration. */
+ @ParameterizedTest
+ @MethodSource("parameters")
+ void testRESTClientSSLBadTruststoreType(String sslProvider) {
+ Configuration clientConfig = createRestSslConfigWithTrustStore(sslProvider);
+ clientConfig.set(SecurityOptions.SSL_REST_TRUSTSTORE_TYPE, "bad-truststore-type");
+
+ assertThatThrownBy(() -> SSLUtils.createRestClientSSLEngineFactory(clientConfig))
+ .isInstanceOf(KeyStoreException.class);
+ }
+
@ParameterizedTest
@MethodSource("parameters")
void testRESTSSLConfigCipherAlgorithms(String sslProvider) throws Exception {
@@ -208,6 +220,17 @@ public class SSLUtilsTest {
.isInstanceOf(Exception.class);
}
+ /** Tests that REST Server SSL Engine creation fails with bad SSL configuration. */
+ @ParameterizedTest
+ @MethodSource("parameters")
+ void testRESTServerSSLBadKeystoreType(String sslProvider) {
+ Configuration serverConfig = createRestSslConfigWithKeyStore(sslProvider);
+ serverConfig.set(SecurityOptions.SSL_REST_KEYSTORE_TYPE, "bad-keystore-type");
+
+ assertThatThrownBy(() -> SSLUtils.createRestServerSSLEngineFactory(serverConfig))
+ .isInstanceOf(KeyStoreException.class);
+ }
+
// ----------------------- mutual auth contexts --------------------------
@ParameterizedTest
@@ -293,6 +316,19 @@ public class SSLUtilsTest {
.isInstanceOf(Exception.class);
}
+ @ParameterizedTest
+ @MethodSource("parameters")
+ void testInternalSSLWrongTruststoreType(String sslProvider) {
+ final Configuration config = createInternalSslConfigWithKeyAndTrustStores(sslProvider);
+ config.set(SecurityOptions.SSL_INTERNAL_TRUSTSTORE_TYPE, "bad-truststore-type");
+
+ assertThatThrownBy(() -> SSLUtils.createInternalServerSSLEngineFactory(config))
+ .isInstanceOf(KeyStoreException.class);
+
+ assertThatThrownBy(() -> SSLUtils.createInternalClientSSLEngineFactory(config))
+ .isInstanceOf(KeyStoreException.class);
+ }
+
@ParameterizedTest
@MethodSource("parameters")
void testInternalSSLWrongKeyPassword(String sslProvider) {
@@ -306,6 +342,19 @@ public class SSLUtilsTest {
.isInstanceOf(Exception.class);
}
+ @ParameterizedTest
+ @MethodSource("parameters")
+ void testInternalSSLWrongKeystoreType(String sslProvider) {
+ final Configuration config = createInternalSslConfigWithKeyAndTrustStores(sslProvider);
+ config.set(SecurityOptions.SSL_INTERNAL_KEYSTORE_TYPE, "bad-keystore-type");
+
+ assertThatThrownBy(() -> SSLUtils.createInternalServerSSLEngineFactory(config))
+ .isInstanceOf(KeyStoreException.class);
+
+ assertThatThrownBy(() -> SSLUtils.createInternalClientSSLEngineFactory(config))
+ .isInstanceOf(KeyStoreException.class);
+ }
+
// -------------------- protocols and cipher suites -----------------------
/** Tests if SSLUtils set the right ssl version and cipher suites for SSLServerSocket. */