Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ private DeprecationChecks() {
NodeDeprecationChecks::azureRepositoryChanges,
NodeDeprecationChecks::gcsRepositoryChanges,
NodeDeprecationChecks::fileDiscoveryPluginRemoved,
NodeDeprecationChecks::defaultSSLSettingsRemoved
NodeDeprecationChecks::defaultSSLSettingsRemoved,
NodeDeprecationChecks::watcherNotificationsSecureSettingsCheck
));

static List<Function<IndexMetaData, DeprecationIssue>> INDEX_SETTINGS_CHECKS =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,29 @@ static DeprecationIssue discoveryConfigurationCheck(List<NodeInfo> nodeInfos, Li
return null;
}

static DeprecationIssue watcherNotificationsSecureSettingsCheck(List<NodeInfo> nodeInfos, List<NodeStats> nodeStats) {
List<String> nodesFound = nodeInfos.stream().filter(nodeInfo ->
(false == nodeInfo.getSettings().getByPrefix("xpack.notification.email.account.")
.filter(s -> s.endsWith(".smtp.password")).isEmpty())
|| (false == nodeInfo.getSettings().getByPrefix("xpack.notification.hipchat.account.")
.filter(s -> s.endsWith(".auth_token")).isEmpty())
|| (false == nodeInfo.getSettings().getByPrefix("xpack.notification.jira.account.")
.filter(s -> s.endsWith(".url") || s.endsWith(".user") || s.endsWith(".password")).isEmpty())
|| (false == nodeInfo.getSettings().getByPrefix("xpack.notification.pagerduty.account.")
.filter(s -> s.endsWith(".service_api_key")).isEmpty())
|| (false == nodeInfo.getSettings().getByPrefix("xpack.notification.slack.account.").filter(s -> s.endsWith(".url"))
.isEmpty()))
.map(nodeInfo -> nodeInfo.getNode().getName()).collect(Collectors.toList());
if (nodesFound.size() > 0) {
return new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
"Watcher notification accounts' authentication settings must be defined securely",
"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-7.0.html" +
"#watcher-notifications-account-settings",
"nodes which have insecure notification account settings are: " + nodesFound);
}
return null;
}

static DeprecationIssue azureRepositoryChanges(List<NodeInfo> nodeInfos, List<NodeStats> nodeStats) {
List<String> nodesFound = nodeInfos.stream()
.filter(nodeInfo ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,44 @@ public void testBulkThreadPoolCheck() {
assertSettingsAndIssue("thread_pool.bulk.queue_size", Integer.toString(randomIntBetween(1, 20000)), expected);
}

public void testWatcherNotificationsSecureSettings() {
DeprecationIssue expected = new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
"Watcher notification accounts' authentication settings must be defined securely",
"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-7.0.html"
+ "#watcher-notifications-account-settings",
"nodes which have insecure notification account settings are: [node_check]");
assertSettingsAndIssue("xpack.notification.email.account." + randomAlphaOfLength(4) + ".smtp.password", randomAlphaOfLength(4),
expected);
expected = new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
"Watcher notification accounts' authentication settings must be defined securely",
"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-7.0.html"
+ "#watcher-notifications-account-settings",
"nodes which have insecure notification account settings are: [node_check]");
assertSettingsAndIssue("xpack.notification.hipchat.account." + randomAlphaOfLength(4) + ".auth_token", randomAlphaOfLength(4),
expected);
expected = new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
"Watcher notification accounts' authentication settings must be defined securely",
"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-7.0.html"
+ "#watcher-notifications-account-settings",
"nodes which have insecure notification account settings are: [node_check]");
assertSettingsAndIssue("xpack.notification.jira.account." + randomAlphaOfLength(4) + ".url", randomAlphaOfLength(4), expected);
assertSettingsAndIssue("xpack.notification.jira.account." + randomAlphaOfLength(4) + ".user", randomAlphaOfLength(4), expected);
assertSettingsAndIssue("xpack.notification.jira.account." + randomAlphaOfLength(4) + ".password", randomAlphaOfLength(4), expected);
expected = new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
"Watcher notification accounts' authentication settings must be defined securely",
"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-7.0.html"
+ "#watcher-notifications-account-settings",
"nodes which have insecure notification account settings are: [node_check]");
assertSettingsAndIssue("xpack.notification.pagerduty.account." + randomAlphaOfLength(4) + ".service_api_key",
randomAlphaOfLength(4), expected);
expected = new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
"Watcher notification accounts' authentication settings must be defined securely",
"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-7.0.html"
+ "#watcher-notifications-account-settings",
"nodes which have insecure notification account settings are: [node_check]");
assertSettingsAndIssue("xpack.notification.slack.account." + randomAlphaOfLength(4) + ".url", randomAlphaOfLength(4), expected);
}

public void testTribeNodeCheck() {
String tribeSetting = "tribe." + randomAlphaOfLengthBetween(1, 20) + ".cluster.name";
DeprecationIssue expected = new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
Expand Down