-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Test adjustments for FIPS 140 in Java 8 #52211
Changes from all commits
1d5f2aa
1b023f4
633fb3a
e8c278f
31f796f
dd52078
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,6 +93,7 @@ | |
import java.util.stream.Collectors; | ||
|
||
import static java.util.stream.Collectors.toList; | ||
import static org.elasticsearch.test.ESTestCase.inFipsSunJsseJvm; | ||
|
||
public class LocalStateCompositeXPackPlugin extends XPackPlugin implements ScriptPlugin, ActionPlugin, IngestPlugin, NetworkPlugin, | ||
ClusterPlugin, DiscoveryPlugin, MapperPlugin, AnalysisPlugin, PersistentTaskPlugin, EnginePlugin { | ||
|
@@ -153,12 +154,17 @@ public Collection<Object> createComponents(Client client, ClusterService cluster | |
NamedXContentRegistry xContentRegistry, Environment environment, | ||
NodeEnvironment nodeEnvironment, NamedWriteableRegistry namedWriteableRegistry) { | ||
List<Object> components = new ArrayList<>(); | ||
// This is a hack, but the settings we add in #additionalSettings() are not added to the environment instance | ||
// (in org.elasticsearch.node.Node) which is passed in `createComponents` of each of the plugins. So the environment | ||
// we get here wouldn't have the additional setting. This is a known issue, and once it is resolved, the code here | ||
// can be adjusted accordingly | ||
final Environment updatedEnvironment = getUpdatedEnvironment(environment); | ||
components.addAll(super.createComponents(client, clusterService, threadPool, resourceWatcherService, scriptService, | ||
xContentRegistry, environment, nodeEnvironment, namedWriteableRegistry)); | ||
xContentRegistry, updatedEnvironment, nodeEnvironment, namedWriteableRegistry)); | ||
|
||
filterPlugins(Plugin.class).stream().forEach(p -> | ||
components.addAll(p.createComponents(client, clusterService, threadPool, resourceWatcherService, scriptService, | ||
xContentRegistry, environment, nodeEnvironment, namedWriteableRegistry)) | ||
xContentRegistry, updatedEnvironment, nodeEnvironment, namedWriteableRegistry)) | ||
); | ||
return components; | ||
} | ||
|
@@ -476,4 +482,15 @@ private <T> List<T> filterPlugins(Class<T> type) { | |
.collect(Collectors.toList()); | ||
} | ||
|
||
private Environment getUpdatedEnvironment(Environment existingEnvironment){ | ||
jkakavas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (inFipsSunJsseJvm()) { | ||
Settings additionalSettings = Settings.builder() | ||
.put(existingEnvironment.settings()) | ||
.put(XPackSettings.DIAGNOSE_TRUST_EXCEPTIONS_SETTING.getKey(), false) | ||
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. Can't this be returnned from 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. Apologies if I misunderstood @rjernst but did you read through #52211 (comment) ? I'll go and double check this again but this was supposed to show why additionalSettings doesn't solve this here 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. Sorry I missed that explanation. It looks to me like a bug. We should be passing the final environment everywhere once it is created. 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. I'll raise a PR to fix that then and change to use additionalSettings here 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. I've opened #52602 to cleanup the name to avoid this situation. |
||
.build(); | ||
return new Environment(additionalSettings, existingEnvironment.configFile()); | ||
} | ||
return existingEnvironment; | ||
} | ||
|
||
} |
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.
I'm not sure how we track this and if we have an issue for it ( couldn't find one but I might have failed ) . There was some relevant discussion around this in #49667. Discussed it briefly with @rjernst on slack, and I didn't want to open an issue for this specific case here as it is only part of the problem.
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.
That doesn't sound right to me. Doesn't
environment
contain the extra settings here? I think it's supposed to.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.
Yes environment should have the extra settings. My comment in slack was about the Settings passed into Plugin constructors.