Skip to content

Conversation

@ebarlas
Copy link
Contributor

@ebarlas ebarlas commented Nov 13, 2025

This change augments the reload_secure_settings API response with the following properties for each node object:

  • secure_setting_names: JSON array of secure setting names from ES keystore
  • keystore_last_modified_time: JSON string with ES keystore last-modified date-time

This change is a response to recurring ES admin confusion about which securing settings are being reloaded from which keystore. See issue #112268.


Curl call to reload_secure_settings targeting local ES distribution:

Screenshot 2025-11-13 at 11 33 03 AM

@ebarlas ebarlas requested a review from a team November 13, 2025 19:28
@ebarlas ebarlas self-assigned this Nov 13, 2025
@ebarlas ebarlas added >enhancement :Security/Security Security issues without another label Team:Security Meta label for security team labels Nov 13, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @ebarlas, I've created a changelog YAML for you.

@ebarlas ebarlas marked this pull request as ready for review November 13, 2025 19:30
@ebarlas ebarlas requested a review from a team as a code owner November 13, 2025 19:30
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-security (Team:Security)

Copy link
Contributor

@jfreden jfreden left a comment

Choose a reason for hiding this comment

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

The PR looks great and the code is solid as always! I have a couple of comments.

At a higher level, it was discussed in the issue if the absolute path to the keystore should be included or not. My understanding from the discussion is that you landed on including it but it's not part of the change?

return ElasticsearchException.readException(this);
}

/**
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice addition!

try {
return Files.readAttributes(path, BasicFileAttributes.class).lastModifiedTime().toMillis();
} catch (IOException e) {
return null; // fallback to null if we can't read the time
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should log a warning here since it's unexpected. We just refreshed the keystore and now we can't get the modified timestamp.

summary: Include Secure Setting Names and Keystore Modified Time in Reload API Response
area: Security
type: enhancement
issues: []
Copy link
Contributor

Choose a reason for hiding this comment

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

This could reference #112268

try {
assertThat(nodesReloadResponse, notNullValue());
final Map<String, NodesReloadSecureSettingsResponse.NodeResponse> nodesMap = nodesReloadResponse.getNodesMap();
assertThat(nodesMap.size(), equalTo(cluster().size()));
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it matters but this test is disabled when running in fips mode. Since we're reading properties on the keystore we might want to make sure it works in fips mode too?

public static class NodeResponse extends BaseNodeResponse {

private Exception reloadException = null;
private static final TransportVersion KEYSTORE_DETAILS = TransportVersion.fromName("keystore_details_in_reload_response");
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: might want to use more specific naming since we might want to add more details in the future.

import java.util.List;
import java.util.Optional;

public class NodesReloadSecureSettingsResponseTests extends ESTestCase {
Copy link
Contributor

Choose a reason for hiding this comment

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

There is actually an abstract class that does testing like this AbstractBWCSerializationTestCase that's used throughout the code base. You might want to consider extending that for more test coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>enhancement :Security/Security Security issues without another label Team:Security Meta label for security team v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants