Skip to content
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

Deprecation check for audit log prefix settings #36661

Merged
merged 1 commit into from
Dec 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ private DeprecationChecks() {
static List<BiFunction<List<NodeInfo>, List<NodeStats>, DeprecationIssue>> NODE_SETTINGS_CHECKS =
Collections.unmodifiableList(Arrays.asList(
NodeDeprecationChecks::httpEnabledSettingRemoved,
NodeDeprecationChecks::auditLogPrefixSettingsCheck,
NodeDeprecationChecks::indexThreadPoolCheck,
NodeDeprecationChecks::tribeNodeCheck,
NodeDeprecationChecks::httpPipeliningCheck,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,21 @@ static DeprecationIssue httpEnabledSettingRemoved(List<NodeInfo> nodeInfos, List
return null;
}

static DeprecationIssue auditLogPrefixSettingsCheck(List<NodeInfo> nodeInfos, List<NodeStats> nodeStats) {
List<String> nodesFound = nodeInfos.stream()
.filter(nodeInfo -> nodeInfo.getSettings().getByPrefix("xpack.security.audit.logfile.prefix").isEmpty() == false)
.map(nodeInfo -> nodeInfo.getNode().getName())
.collect(Collectors.toList());
if (nodesFound.size() > 0) {
return new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
"Audit log node info settings renamed",
"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_70_cluster_changes.html" +
"#audit-logfile-local-node-info",
"nodes with audit log settings that have been renamed: " + nodesFound);
}
return null;
}

static DeprecationIssue indexThreadPoolCheck(List<NodeInfo> nodeInfos, List<NodeStats> nodeStats) {
List<String> nodesFound = nodeInfos.stream()
.filter(nodeInfo -> nodeInfo.getSettings().getByPrefix("thread_pool.index.").isEmpty() == false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ public void testHttpEnabledCheck() {
assertSettingsAndIssue("http.enabled", Boolean.toString(randomBoolean()), expected);
}

public void testAuditLoggingPrefixSettingsCheck() {
DeprecationIssue expected = new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
"Audit log node info settings renamed",
"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_70_cluster_changes.html" +
"#audit-logfile-local-node-info",
"nodes with audit log settings that have been renamed: [node_check]");
assertSettingsAndIssue("xpack.security.audit.logfile.prefix.emit_node_host_address", Boolean.toString(randomBoolean()), expected);
assertSettingsAndIssue("xpack.security.audit.logfile.prefix.emit_node_host_name", Boolean.toString(randomBoolean()), expected);
assertSettingsAndIssue("xpack.security.audit.logfile.prefix.emit_node_name", Boolean.toString(randomBoolean()), expected);
}

public void testIndexThreadPoolCheck() {
DeprecationIssue expected = new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
"Index thread pool removed in favor of combined write thread pool",
Expand Down