Skip to content

Commit 8d2dbfa

Browse files
jkakavasalbertzaharovits
authored andcommitted
[TEST] Allow to run in FIPS JVM (#32607)
* Do not attempt to run cases with ssl.verification_mode NONE in SessionFactoryTests so that the tests can run in a FIPS 140 JVM
1 parent e5a1dac commit 8d2dbfa

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/ldap/support/SessionFactoryTests.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,13 @@ public void testConnectionFactoryReturnsCorrectLDAPConnectionOptions() throws Ex
9393
options = SessionFactory.connectionOptions(realmConfig, sslService.apply(settings), logger);
9494
assertThat(options.getSSLSocketVerifier(), is(instanceOf(TrustAllSSLSocketVerifier.class)));
9595

96-
settings = Settings.builder().put("ssl.verification_mode", VerificationMode.NONE).build();
97-
realmConfig = new RealmConfig(realmName, settings, environment.settings(), environment, threadContext);
98-
options = SessionFactory.connectionOptions(realmConfig, sslService.apply(settings), logger);
99-
assertThat(options.getSSLSocketVerifier(), is(instanceOf(TrustAllSSLSocketVerifier.class)));
96+
// Can't run in FIPS with verification_mode none, disable this check instead of duplicating the test case
97+
if (inFipsJvm() == false) {
98+
settings = Settings.builder().put("ssl.verification_mode", VerificationMode.NONE).build();
99+
realmConfig = new RealmConfig(realmName, settings, environment.settings(), environment, threadContext);
100+
options = SessionFactory.connectionOptions(realmConfig, sslService.apply(settings), logger);
101+
assertThat(options.getSSLSocketVerifier(), is(instanceOf(TrustAllSSLSocketVerifier.class)));
102+
}
100103

101104
settings = Settings.builder().put("ssl.verification_mode", VerificationMode.FULL).build();
102105
realmConfig = new RealmConfig(realmName, settings, environment.settings(), environment, threadContext);

0 commit comments

Comments
 (0)