Skip to content

Commit 49ca629

Browse files
authored
Mute enrollment tests in FIPS 140-2 mode (#74538)
We don't support enrollment mode in FIPS 140-2 mode as we are using PKCS#12 keystores. This change mutes related tests in FIPS 140-2 mode. Resolves: #74256
1 parent 3f44a5b commit 49ca629

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/action/enrollment/TransportKibanaEnrollmentActionTests.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.elasticsearch.xpack.core.ssl.SSLConfiguration;
3131
import org.elasticsearch.xpack.core.ssl.SSLService;
3232
import org.junit.Before;
33+
import org.junit.BeforeClass;
3334

3435
import java.nio.file.Files;
3536
import java.nio.file.Path;
@@ -50,19 +51,23 @@ public class TransportKibanaEnrollmentActionTests extends ESTestCase {
5051
private List<ChangePasswordRequest> changePasswordRequests;
5152
private TransportKibanaEnrollmentAction action;
5253
private Client client;
53-
private Path httpCaPath;
54+
55+
@BeforeClass
56+
public static void muteInFips(){
57+
assumeFalse("Enrollment is not supported in FIPS 140-2 as we are using PKCS#12 keystores", inFipsJvm());
58+
}
5459

5560
@Before @SuppressWarnings("unchecked") public void setup() throws Exception {
5661
changePasswordRequests = new ArrayList<>();
5762
final Environment env = mock(Environment.class);
5863
final Path tempDir = createTempDir();
59-
httpCaPath = tempDir.resolve("httpCa.p12");
64+
final Path httpCaPath = tempDir.resolve("httpCa.p12");
6065
Files.copy(getDataPath("/org/elasticsearch/xpack/security/action/enrollment/httpCa.p12"), httpCaPath);
6166
when(env.configFile()).thenReturn(tempDir);
6267
final MockSecureSettings secureSettings = new MockSecureSettings();
6368
secureSettings.setString("keystore.secure_password", "password");
6469
final Settings settings = Settings.builder()
65-
.put("keystore.path", "httpCa.p12")
70+
.put("keystore.path", httpCaPath)
6671
.setSecureSettings(secureSettings)
6772
.build();
6873
when(env.settings()).thenReturn(settings);

x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/enrollment/CreateEnrollmentTokenTests.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.elasticsearch.xpack.security.tool.HttpResponse;
2626
import org.hamcrest.Matchers;
2727
import org.junit.Before;
28+
import org.junit.BeforeClass;
2829

2930
import java.io.IOException;
3031
import java.net.HttpURLConnection;
@@ -50,6 +51,11 @@
5051
public class CreateEnrollmentTokenTests extends ESTestCase {
5152
private Environment environment;
5253

54+
@BeforeClass
55+
public static void muteInFips(){
56+
assumeFalse("Enrollment is not supported in FIPS 140-2 as we are using PKCS#12 keystores", inFipsJvm());
57+
}
58+
5359
@Before
5460
public void setupMocks() throws Exception {
5561
final Path tempDir = createTempDir();

0 commit comments

Comments
 (0)