forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[7.7] Fix ReloadSecureSettings API to consume password (elastic#54771) (
elastic#55060) The secure_settings_password was never taken into consideration in the ReloadSecureSettings API. This commit fixes that and adds necessary REST layer testing. Doing so, it also: - Allows TestClusters to have a password protected keystore so that it can be set for tests. - Adds a parameter to the run task so that elastisearch can be run with a password protected keystore from source.
- Loading branch information
Showing
19 changed files
with
393 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 24 additions & 1 deletion
25
...-api-spec/src/main/resources/rest-api-spec/test/nodes.reload_secure_settings/10_basic.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,31 @@ | ||
--- | ||
"node_reload_secure_settings test": | ||
"node_reload_secure_settings test wrong password": | ||
- skip: | ||
version: " - 7.6.99" | ||
reason: "support for reloading password protected keystores was introduced in 7.7.0" | ||
|
||
- do: | ||
nodes.reload_secure_settings: | ||
node_id: _local | ||
body: | ||
secure_settings_password: awrongpasswordhere | ||
- set: | ||
nodes._arbitrary_key_: node_id | ||
|
||
- is_true: nodes | ||
- is_true: cluster_name | ||
- match: { nodes.$node_id.reload_exception.type: "security_exception" } | ||
- match: { nodes.$node_id.reload_exception.reason: "Provided keystore password was incorrect" } | ||
|
||
--- | ||
"node_reload_secure_settings test correct(empty) password": | ||
|
||
- do: | ||
nodes.reload_secure_settings: {} | ||
|
||
- set: | ||
nodes._arbitrary_key_: node_id | ||
|
||
- is_true: nodes | ||
- is_true: cluster_name | ||
- is_false: nodes.$node_id.reload_exception |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
/* | ||
* Tests that need to run against an Elasticsearch cluster that | ||
* is using a password protected keystore in its nodes. | ||
*/ | ||
|
||
apply plugin: 'elasticsearch.testclusters' | ||
apply plugin: 'elasticsearch.standalone-rest-test' | ||
apply plugin: 'elasticsearch.rest-test' | ||
dependencies { | ||
testCompile project(path: xpackModule('core'), configuration: 'default') | ||
} | ||
|
||
testClusters.integTest { | ||
testDistribution = 'DEFAULT' | ||
numberOfNodes = 2 | ||
keystorePassword 's3cr3t' | ||
|
||
setting 'xpack.security.enabled', 'true' | ||
setting 'xpack.security.authc.anonymous.roles', 'anonymous' | ||
setting 'xpack.security.transport.ssl.enabled', 'true' | ||
setting 'xpack.security.transport.ssl.certificate', 'transport.crt' | ||
setting 'xpack.security.transport.ssl.key', 'transport.key' | ||
setting 'xpack.security.transport.ssl.key_passphrase', 'transport-password' | ||
setting 'xpack.security.transport.ssl.certificate_authorities', 'ca.crt' | ||
|
||
extraConfigFile 'transport.key', file('src/test/resources/ssl/transport.key') | ||
extraConfigFile 'transport.crt', file('src/test/resources/ssl/transport.crt') | ||
extraConfigFile 'ca.crt', file('src/test/resources/ssl/ca.crt') | ||
extraConfigFile 'roles.yml', file('src/test/resources/roles.yml') | ||
|
||
user username: 'admin_user', password: 'admin-password' | ||
user username:'test-user' ,password: 'test-password', role: 'user_role' | ||
} |
Oops, something went wrong.