-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Index Level Encryption plugin #12902
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
base: main
Are you sure you want to change the base?
Changes from 8 commits
8802124
69a443b
eb6e499
ee0b4ab
cdfc719
0d80266
56d9156
bcb359e
198deb2
6dbf41d
3bd44e5
ded0f58
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /* | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * The OpenSearch Contributors require contributions made to | ||
| * this file be licensed under the Apache-2.0 license or a | ||
| * compatible open source license. | ||
| * | ||
| * Modifications Copyright OpenSearch Contributors. See | ||
| * GitHub history for details. | ||
| */ | ||
|
|
||
| apply plugin: 'opensearch.build' | ||
| apply plugin: 'opensearch.publish' | ||
| apply plugin: 'opensearch.yaml-rest-test' | ||
| apply plugin: 'opensearch.internal-cluster-test' | ||
|
|
||
| opensearchplugin { | ||
| description 'Encrypts and decrypts index data at rest.' | ||
| classname 'org.opensearch.index.store.CryptoDirectoryPlugin' | ||
| } | ||
|
|
||
| dependencies { | ||
| testImplementation project(path: ':modules:reindex') | ||
| testImplementation "commons-io:commons-io:2.13.0" | ||
| } | ||
|
|
||
| //restResources { | ||
| // restApi { | ||
| // includeCore '_common', 'cluster', 'nodes', 'index', 'indices', 'get' | ||
| // } | ||
| //} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| /* | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * The OpenSearch Contributors require contributions made to | ||
| * this file be licensed under the Apache-2.0 license or a | ||
| * compatible open source license. | ||
| */ | ||
| package org.opensearch.index.store; | ||
|
|
||
| import org.opensearch.action.search.SearchResponse; | ||
| import org.opensearch.common.settings.Settings; | ||
| import org.opensearch.index.reindex.ReindexAction; | ||
| import org.opensearch.index.reindex.ReindexModulePlugin; | ||
| import org.opensearch.index.reindex.ReindexRequestBuilder; | ||
| import org.opensearch.plugins.Plugin; | ||
| import org.opensearch.test.OpenSearchIntegTestCase; | ||
|
|
||
| import java.util.Arrays; | ||
| import java.util.Collection; | ||
|
|
||
| import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS; | ||
| import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS; | ||
| import static org.hamcrest.Matchers.is; | ||
|
|
||
| public class CryptoDirectoryIntegTestCase extends OpenSearchIntegTestCase { | ||
| @Override | ||
| protected Collection<Class<? extends Plugin>> nodePlugins() { | ||
| return Arrays.asList( | ||
| CryptoDirectoryPlugin.class, | ||
| MockCryptoKeyProviderPlugin.class, | ||
| MockCryptoPlugin.class, | ||
| ReindexModulePlugin.class | ||
| ); | ||
| } | ||
|
|
||
| @Override | ||
| public Settings indexSettings() { | ||
| return Settings.builder() | ||
| .put(super.indexSettings()) | ||
| .put("index.store.type", "cryptofs") | ||
| .put("index.store.kms.type", "dummy") | ||
| .put(SETTING_NUMBER_OF_SHARDS, 1) | ||
| .put(SETTING_NUMBER_OF_REPLICAS, 0) | ||
| .build(); | ||
| } | ||
|
|
||
| public void testReindex() { | ||
| // Create an index and index some documents | ||
| createIndex("test"); | ||
| createIndex("test_copy"); | ||
| long nbDocs = randomIntBetween(10, 1000); | ||
| for (long i = 0; i < nbDocs; i++) { | ||
| index("test", "doc", "" + i, "foo", "bar"); | ||
| } | ||
| refresh(); | ||
| SearchResponse response = client().prepareSearch("test").get(); | ||
| assertThat(response.getHits().getTotalHits().value, is(nbDocs)); | ||
|
|
||
| // Reindex | ||
| reindex().source("test").destination("test_copy").refresh(true).get(); | ||
| SearchResponse copy_response = client().prepareSearch("test_copy").get(); | ||
| assertThat(copy_response.getHits().getTotalHits().value, is(nbDocs)); | ||
|
|
||
| } | ||
|
|
||
| ReindexRequestBuilder reindex() { | ||
| return new ReindexRequestBuilder(client(), ReindexAction.INSTANCE); | ||
| } | ||
|
|
||
|
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.