-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Enable testing in FIPS140 JVM #31666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
e294ff8
Replace JKS with default keystore
jkakavas 3874a1d
Merge remote-tracking branch 'origin/master' into fips-testing
jkakavas 5f17449
Merge remote-tracking branch 'origin/master' into fips-testing
jkakavas 459734d
Merge remote-tracking branch 'origin/master' into fips-testing
jkakavas c2ba7f7
Ensure our tests can run in a FIPS JVM
jkakavas 5e232c3
Merge remote-tracking branch 'origin/master' into fips-testing
jkakavas 534e865
Checkstyle warnings
jkakavas 1c66768
Address feedback
jkakavas 5bdca0b
Merge remote-tracking branch 'origin/master' into fips-testing
jkakavas 04911a4
Merge remote-tracking branch 'origin/master' into fips-testing
jkakavas e5009ea
Address feedback
jkakavas 0d6b842
fix typo
jkakavas f6dfb02
Add call to countdown() for the reloadLatch
jkakavas 20ce308
Merge remote-tracking branch 'origin/master' into fips-testing
jkakavas c2e3de6
address feedback
jkakavas e55ea07
Fix test
jkakavas e114e01
Remove debug prints and run precommit checks
jkakavas b958d2b
Ensure PrivateKey is readable(#32021)
jkakavas dc710f9
Fix failing test
jkakavas eddb426
Merge remote-tracking branch 'origin/master' into fips-testing
jkakavas 75a73f1
Merge remote-tracking branch 'origin/master' into fips-testing
jkakavas 89cf245
remove import
jkakavas ff9505e
Merge remote-tracking branch 'origin/master' into fips-testing
jkakavas dcac90c
Merge branch 'fips-testing' of github.com:jkakavas/elasticsearch into…
jkakavas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,8 @@ | |
import org.elasticsearch.transport.TcpTransport; | ||
import org.junit.AfterClass; | ||
import org.junit.BeforeClass; | ||
import org.junit.ClassRule; | ||
import org.junit.rules.ExternalResource; | ||
|
||
import javax.net.ssl.KeyManagerFactory; | ||
import javax.net.ssl.SSLContext; | ||
|
@@ -87,6 +89,14 @@ protected Collection<Class<? extends Plugin>> nodePlugins() { | |
|
||
private static Path keyStoreFile; | ||
|
||
@ClassRule | ||
public static final ExternalResource MUTE_IN_FIPS_JVM = new ExternalResource() { | ||
@Override | ||
protected void before() { | ||
assumeFalse("Can't run in a FIPS JVM because none if the supported Keystore types can be used", inFipsJvm()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/if/of |
||
} | ||
}; | ||
|
||
@BeforeClass | ||
public static void setupKeyStore() throws IOException { | ||
Path tempDir = createTempDir(); | ||
|
@@ -99,9 +109,6 @@ public static void setupKeyStore() throws IOException { | |
|
||
@Override | ||
protected Settings nodeSettings(int nodeOrdinal) { | ||
if (inFipsJvm()) { | ||
return Settings.EMPTY; | ||
} | ||
Path resolve = logDir.resolve(Integer.toString(nodeOrdinal)); | ||
try { | ||
Files.createDirectory(resolve); | ||
|
@@ -137,9 +144,6 @@ protected Path nodeConfigPath(int nodeOrdinal) { | |
*/ | ||
@BeforeClass | ||
public static void startHttpd() throws Exception { | ||
if (inFipsJvm()) { | ||
return; | ||
} | ||
logDir = createTempDir(); | ||
SSLContext sslContext = getSSLContext(); | ||
httpsServer = MockHttpServer.createHttps(new InetSocketAddress(InetAddress.getLoopbackAddress().getHostAddress(), 0), 0); | ||
|
@@ -265,9 +269,6 @@ private static SSLContext getSSLContext() throws Exception { | |
|
||
@AfterClass | ||
public static void stopHttpd() throws IOException { | ||
if (inFipsJvm()) { | ||
return; | ||
} | ||
for (int i = 0; i < internalCluster().size(); i++) { | ||
// shut them all down otherwise we get spammed with connection refused exceptions | ||
internalCluster().stopRandomDataNode(); | ||
|
@@ -278,7 +279,6 @@ public static void stopHttpd() throws IOException { | |
} | ||
|
||
public void testJoin() throws ExecutionException, InterruptedException { | ||
assumeFalse("Can't run in a FIPS JVM because none if the supported Keystore types can be used", inFipsJvm()); | ||
// only wait for the cluster to form | ||
ensureClusterSizeConsistency(); | ||
// add one more node and wait for it to join | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a comment that this builds a keystore programmatically so that it is keystore format independent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it is not entirely keystore format independent. This was changed for the same reason the tests that load a JKS keystore from disk are changed. One can't
KeyManagerFactory#init()
with a JKS store in a FIPS JVM. Can it be that I missed the essence of your comment ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main reason I want a comment is so that someone doesn’t come along and go “this is silly let’s just use a keystore”