Skip to content

Commit

Permalink
Deprecation check for Auth realm setting structure (#36664)
Browse files Browse the repository at this point in the history
Adds a deprecation check for changes to the structure of authentication
realm settings.
  • Loading branch information
gwbrown authored Jan 2, 2019
1 parent 8d40f4b commit c4b8232
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ private DeprecationChecks() {
NodeDeprecationChecks::indexThreadPoolCheck,
NodeDeprecationChecks::bulkThreadPoolCheck,
NodeDeprecationChecks::tribeNodeCheck,
NodeDeprecationChecks::authRealmsTypeCheck,
NodeDeprecationChecks::httpPipeliningCheck,
NodeDeprecationChecks::discoveryConfigurationCheck,
NodeDeprecationChecks::azureRepositoryChanges,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,22 @@ static DeprecationIssue tribeNodeCheck(List<NodeInfo> nodeInfos, List<NodeStats>
return null;
}

static DeprecationIssue authRealmsTypeCheck(List<NodeInfo> nodeInfos, List<NodeStats> nodeStats) {
List<String> nodesFound = nodeInfos.stream()
.filter(nodeInfo -> nodeInfo.getSettings().getGroups("xpack.security.authc.realms").size() > 0)
.map(nodeInfo -> nodeInfo.getNode().getName())
.collect(Collectors.toList());

if (nodesFound.size() > 0) {
return new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
"Security realm settings structure changed",
"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-7.0.html" +
"#include-realm-type-in-setting",
"nodes have authentication realm configuration which must be updated at time of upgrade to 7.0: " + nodesFound);
}
return null;
}

static DeprecationIssue httpPipeliningCheck(List<NodeInfo> nodeInfos, List<NodeStats> nodeStats) {
List<String> nodesFound = nodeInfos.stream()
.filter(nodeInfo -> nodeInfo.getSettings().hasValue(HttpTransportSettings.SETTING_PIPELINING.getKey()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@ public void testTribeNodeCheck() {
assertSettingsAndIssue(tribeSetting, randomAlphaOfLength(5), expected);
}

public void testAuthenticationRealmTypeCheck() {
String realm = randomAlphaOfLengthBetween(1, 20);
String authRealmType = "xpack.security.authc.realms." + realm + ".type";
DeprecationIssue expected = new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
"Security realm settings structure changed",
"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-7.0.html" +
"#include-realm-type-in-setting",
"nodes have authentication realm configuration which must be updated at time of upgrade to 7.0: [node_check]");
assertSettingsAndIssue(authRealmType, randomAlphaOfLength(5), expected);
}

public void testHttpPipeliningCheck() {
DeprecationIssue expected = new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
"HTTP pipelining setting removed as pipelining is now mandatory",
Expand Down

0 comments on commit c4b8232

Please sign in to comment.