Skip to content

Conversation

@jkakavas
Copy link
Contributor

This is a follow up to #48378 after running the build locally for a few
times in FIPS mode to identify potential test issues. Changes
include:

  • Don't install ingest-attachment for the docs integTest task cluster
    and don't run the related docs tests, since ingest-attachement
    plugin is not supported in FIPS 140 JVMs
  • Move copying extra jars and extra config files earlier on in the
    node configuration so that elasticsearch-keystore and
    elasticsearch-plugin that run before the node starts have all files
    (policy, properties, jars) available.
  • Minor test changes

- Don't install ingest-attachment and don't run the related docs
tests, since ingest-attachement is not supported in FIPS 140 JVMs
- Move copying extra jars and extra config files earlier on in the
node configuration so that elasticsearch-keystore and
elasticsearch-plugin that run before the node starts have all files
(policy, properties, jars) available.
@jkakavas jkakavas added :Delivery/Build Build or test infrastructure v8.0.0 labels Nov 19, 2019
@jkakavas jkakavas requested a review from mark-vieira November 19, 2019 15:26
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (:Core/Infra/Build)

mark-vieira
mark-vieira previously approved these changes Nov 19, 2019
Copy link
Contributor

@mark-vieira mark-vieira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

As per my comment, if we are simply toggling FIPS tests based on a system property we can simplify some things around BuildParams which currently assumes this information isn't available until task execution time. Feel free to merge as is though and I'll submit a follow up PR to refactor this.

forbiddenApisTest.enabled = false
jarHell.enabled = false
thirdPartyAudit.enabled = false
if (Boolean.parseBoolean(System.getProperty("tests.fips.enabled"))){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this again, are we determining whether we are in a fips JVM only by looking at this system property? If so, we should refactor how we set the corresponding BuildParams property and use that instead. As I remember, we used to involve a script command using the runtime java home to make this determination but at some point that was removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're absolutely right. Before #48378 we would check the SecurityProvider that was in use in runtime and determine if we're running in a FIPS 140 JVM. Nowadays, we explicitly control this with the system property so there is no need to defer to runtime and we can handle everything on configuration. Thus, I followed your advice and removed the BuildParams.inFipsJvm and the globalInfo.ready() blocks where applicable. Tagging you for another review based on that

…trustedcerty entry, it's not enough for it to be in privatekeyentry for it to be trusted
@jkakavas jkakavas requested a review from mark-vieira November 20, 2019 08:59
@jkakavas jkakavas dismissed mark-vieira’s stale review November 20, 2019 15:13

further changes require a new look

Copy link
Contributor

@mark-vieira mark-vieira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may have misspoken, we still want to use BuildParams.inFipsJvm everywhere rather than the system property. We can then set the value of the build param in a single location based on the system property in GlobalBuildInfoPlugin as we do for other things.

There are many reasons to do this, such as not hard-coding tests.fips.enabled in a million places, having a static, type-safe method for returning what is a boolean, and providing better error reporting for scenarios where this may have not gotten set for some reason.

private static JavaVersion gradleJavaVersion;
private static JavaVersion compilerJavaVersion;
private static JavaVersion runtimeJavaVersion;
private static Boolean inFipsJvm;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to remove this. We want this property to live here, rather than us checking for a system property all over the place. We simply want to initialize this at configuration time in GlobalBuildInfoPlugin. Then use BuildParams.inFipsJvm everywhere else.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, I will revert and adjust

@jkakavas jkakavas requested a review from mark-vieira November 21, 2019 08:28
Copy link
Contributor

@mark-vieira mark-vieira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one minor comment, otherwise changes LGTM 👍

writer.write(" Compiler java.home : " + compilerJavaHome + "\n");
writer.write(" Runtime JDK Version : " + runtimeJavaVersionEnum + " (" + runtimeJavaVersionDetails + ")");
writer.write(inFipsJvm ? " (in FIPS 140 mode)\n":"\n");
writer.write(inFipsJvm ? " (in FIPS 140 mode)\n" : "\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move this to the PrintGlobalBuildInfoTask since it's more appropriate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think whether or not we're in a FIPS 140 mode is a property of the JVM and were printing the current runtime version here, so it feels natural to add this here. WDYT ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is true, but we aren't actually making this determination based on the JVM. If we were, I'd agree, but since we're just toggling based on a system property, it doesn't make sense to include here. In fact, this will result in potential errors, because this generate task is cached, and we aren't tracking that system property as an input. So we expose ourselves to a scenario where we run a build, change the system property, and still get the old output.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, thanks for elaborating

@mark-vieira
Copy link
Contributor

Changes look good @jkakavas. Feel free to merge, and let's ensure this get's backported to 7.x as well.

@jkakavas jkakavas merged commit 92f1631 into elastic:master Nov 22, 2019
jkakavas added a commit to jkakavas/elasticsearch that referenced this pull request Nov 22, 2019
- Don't install ingest-attachment and don't run the related docs
tests, since ingest-attachment is not supported in FIPS 140 JVMs
- Move copying extra jars and extra config files earlier on in the
node configuration so that elasticsearch-keystore and
elasticsearch-plugin that run before the node starts have all files
(policy, properties, jars) available.
- BCJSSE needs a certificate to be explicitly added in a keystore
as a trustedcerty entry, it's not enough for it to be in privatekeyentry
for it to be trusted
- Set the value for BuildParams.inFipsJvm configuration time
@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants