Skip to content

Commit

Permalink
Add setting reindex.remote.allowlist, and deprecate setting reindex.r…
Browse files Browse the repository at this point in the history
…emote.whitelist

Signed-off-by: Tianli Feng <ftianli@amazon.com>
  • Loading branch information
Tianli Feng committed Feb 22, 2022
1 parent fb187ea commit c8dfd68
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/rest-high-level/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ check.dependsOn(asyncIntegTest)
testClusters.all {
testDistribution = 'ARCHIVE'
systemProperty 'opensearch.scripting.update.ctx_in_params', 'false'
setting 'reindex.remote.whitelist', '[ "[::1]:*", "127.0.0.1:*" ]'
setting 'reindex.remote.allowlist', '[ "[::1]:*", "127.0.0.1:*" ]'

extraConfigFile 'roles.yml', file('roles.yml')
user username: System.getProperty('tests.rest.cluster.username', 'test_user'),
Expand Down
2 changes: 1 addition & 1 deletion modules/reindex/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ testClusters.all {
module ':modules:parent-join'
module ':modules:lang-painless'
// Whitelist reindexing from the local node so we can test reindex-from-remote.
setting 'reindex.remote.whitelist', '127.0.0.1:*'
setting 'reindex.remote.allowlist', '127.0.0.1:*'
}

test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public Collection<Object> createComponents(
public List<Setting<?>> getSettings() {
final List<Setting<?>> settings = new ArrayList<>();
settings.add(TransportReindexAction.REMOTE_CLUSTER_WHITELIST);
settings.add(TransportReindexAction.REMOTE_CLUSTER_ALLOWLIST);
settings.addAll(ReindexSslConfig.getSettings());
return settings;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,15 @@ public class TransportReindexAction extends HandledTransportAction<ReindexReques
"reindex.remote.whitelist",
emptyList(),
Function.identity(),
Property.NodeScope
Property.NodeScope, Property.Deprecated
);
// The setting below is going to replace the above.
// To keep backwards compatibility, the old usage is remained, and it's also used as the fallback for the new usage.
public static final Setting<List<String>> REMOTE_CLUSTER_ALLOWLIST = Setting.listSetting(
"reindex.remote.allowlist",
REMOTE_CLUSTER_WHITELIST,
Function.identity(),
Property.NodeScope
);
public static Optional<RemoteReindexExtension> remoteExtension = Optional.empty();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public void testUnwhitelistedRemote() {
IllegalArgumentException.class,
() -> checkRemoteWhitelist(buildRemoteWhitelist(whitelist), newRemoteInfo("not in list", port))
);
assertEquals("[not in list:" + port + "] not whitelisted in reindex.remote.whitelist", e.getMessage());
assertEquals("[not in list:" + port + "] not whitelisted in reindex.remote.allowlist", e.getMessage());
}

public void testRejectMatchAll() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@
---
"unwhitelisted remote host fails":
- do:
catch: /\[badremote:9200\] not whitelisted in reindex.remote.whitelist/
catch: /\[badremote:9200\] not whitelisted in reindex.remote.allowlist/
reindex:
body:
source:
Expand Down

0 comments on commit c8dfd68

Please sign in to comment.