Skip to content

Commit f79e947

Browse files
authored
Merge branch 'main' into change_wildcard_default_value
Signed-off-by: Michael Froh <[email protected]>
2 parents dda919a + 0c5ee15 commit f79e947

File tree

40 files changed

+1129
-182
lines changed

40 files changed

+1129
-182
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1111
- Use Lucene `pack` method for `half_float` and `usigned_long` when using `ApproximatePointRangeQuery`.
1212
- Add a mapper for context aware segments grouping criteria ([#19233](https://github.com/opensearch-project/OpenSearch/pull/19233))
1313
- Return full error for GRPC error response ([#19568](https://github.com/opensearch-project/OpenSearch/pull/19568))
14+
- Add support for repository with Server side encryption enabled and client side encryption as well based on a flag. ([#19630)](https://github.com/opensearch-project/OpenSearch/pull/19630))
1415
- Add pluggable gRPC interceptors with explicit ordering([#19005](https://github.com/opensearch-project/OpenSearch/pull/19005))
1516
- Add BindableServices extension point to transport-grpc-spi ([#19304](https://github.com/opensearch-project/OpenSearch/pull/19304))
1617
- Add metrics for the merged segment warmer feature ([#18929](https://github.com/opensearch-project/OpenSearch/pull/18929))
@@ -32,6 +33,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
3233
- Refactor the IndexingStats.Stats class to use the Builder pattern instead of constructors ([#19306](https://github.com/opensearch-project/OpenSearch/pull/19306))
3334
- Remove FeatureFlag.MERGED_SEGMENT_WARMER_EXPERIMENTAL_FLAG. ([#19715](https://github.com/opensearch-project/OpenSearch/pull/19715))
3435
- Change the default value of doc_values in WildcardFieldMapper to true. ([#19796](https://github.com/opensearch-project/OpenSearch/pull/19796))
36+
- Make Engine#loadHistoryUUID() protected and Origin#isFromTranslog() public ([#19753](https://github.com/opensearch-project/OpenSearch/pull/19752))
3537

3638
### Fixed
3739
- Fix Allocation and Rebalance Constraints of WeightFunction are incorrectly reset ([#19012](https://github.com/opensearch-project/OpenSearch/pull/19012))

distribution/tools/fips-demo-installer-cli/src/test/java/org/opensearch/tools/cli/fips/truststore/CreateFipsTrustStoreTests.java

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,52 +8,39 @@
88

99
package org.opensearch.tools.cli.fips.truststore;
1010

11+
import org.opensearch.cli.SuppressForbidden;
1112
import org.opensearch.test.OpenSearchTestCase;
12-
import org.junit.AfterClass;
1313
import org.junit.Before;
1414
import org.junit.BeforeClass;
15+
import org.junit.ClassRule;
16+
import org.junit.rules.TemporaryFolder;
1517

1618
import java.io.IOException;
1719
import java.io.PrintWriter;
1820
import java.io.Writer;
1921
import java.nio.file.Files;
2022
import java.nio.file.Path;
2123
import java.security.KeyStore;
22-
import java.util.Comparator;
2324
import java.util.function.Consumer;
24-
import java.util.stream.Stream;
2525

2626
import picocli.CommandLine;
2727

2828
public class CreateFipsTrustStoreTests extends OpenSearchTestCase {
29+
@ClassRule
30+
public static TemporaryFolder tempFolder = new TemporaryFolder();
2931

3032
private static final Path JAVA_HOME = Path.of(System.getProperty("java.home"));
31-
private static Path sharedTempDir;
33+
private static Path confDir;
3234

3335
private CommandLine.Model.CommandSpec spec;
3436

3537
@BeforeClass
38+
@SuppressForbidden(reason = "the java.io.File is exposed by TemporaryFolder")
3639
public static void setUpClass() throws IOException {
37-
sharedTempDir = Files.createTempDirectory(Path.of(System.getProperty("java.io.tmpdir")), "fips-test-");
38-
Path confDir = sharedTempDir.resolve("config");
40+
confDir = tempFolder.newFolder().toPath().resolve("config");
3941
Files.createDirectories(confDir);
4042
}
4143

42-
@AfterClass
43-
public static void tearDownClass() throws IOException {
44-
if (sharedTempDir != null && Files.exists(sharedTempDir)) {
45-
try (Stream<Path> walk = Files.walk(sharedTempDir)) {
46-
walk.sorted(Comparator.reverseOrder()).forEach(path -> {
47-
try {
48-
Files.delete(path);
49-
} catch (Exception e) {
50-
// Ignore
51-
}
52-
});
53-
}
54-
}
55-
}
56-
5744
@Before
5845
public void setUp() throws Exception {
5946
super.setUp();
@@ -67,7 +54,6 @@ class DummyCommand {}
6754
spec = commandLine.getCommandSpec();
6855

6956
// Clean up any existing truststore file from previous tests
70-
Path confDir = sharedTempDir.resolve("config");
7157
Path trustStorePath = confDir.resolve("opensearch-fips-truststore.bcfks");
7258
if (Files.exists(trustStorePath)) {
7359
Files.delete(trustStorePath);
@@ -150,10 +136,9 @@ public void testConvertToBCFKS() throws Exception {
150136
CommonOptions options = new CommonOptions();
151137
options.force = false;
152138
String password = "testPassword123";
153-
Path confPath = sharedTempDir.resolve("config");
154139

155140
// when
156-
Path result = CreateFipsTrustStore.convertToBCFKS(spec, sourceKeyStore, options, password, confPath);
141+
Path result = CreateFipsTrustStore.convertToBCFKS(spec, sourceKeyStore, options, password, confDir);
157142

158143
// then
159144
assertNotNull(result);
@@ -181,16 +166,15 @@ public void testConvertToBCFKSFileExistsWithoutForce() throws Exception {
181166
String password = "testPassword123";
182167

183168
// Create file first to simulate existing truststore
184-
Path confPath = sharedTempDir.resolve("config");
185-
Path trustStorePath = confPath.resolve("opensearch-fips-truststore.bcfks");
169+
Path trustStorePath = confDir.resolve("opensearch-fips-truststore.bcfks");
186170
Files.createFile(trustStorePath);
187171

188172
assertTrue("Test setup: file should exist", Files.exists(trustStorePath));
189173

190174
// when/then
191175
RuntimeException exception = expectThrows(
192176
RuntimeException.class,
193-
() -> CreateFipsTrustStore.convertToBCFKS(spec, sourceKeyStore, options, password, confPath)
177+
() -> CreateFipsTrustStore.convertToBCFKS(spec, sourceKeyStore, options, password, confDir)
194178
);
195179
assertEquals("Operation cancelled. Trust store file already exists.", exception.getMessage());
196180
}
@@ -207,14 +191,13 @@ public void testConvertToBCFKSFileExistsWithForce() throws Exception {
207191
String password = "testPassword123";
208192

209193
// Create file first
210-
Path confPath = sharedTempDir.resolve("config");
211-
Path trustStorePath = confPath.resolve("opensearch-fips-truststore.bcfks");
194+
Path trustStorePath = confDir.resolve("opensearch-fips-truststore.bcfks");
212195
Files.createFile(trustStorePath);
213196

214197
assertTrue(Files.exists(trustStorePath));
215198

216199
// when
217-
Path result = CreateFipsTrustStore.convertToBCFKS(spec, sourceKeyStore, options, password, confPath);
200+
Path result = CreateFipsTrustStore.convertToBCFKS(spec, sourceKeyStore, options, password, confDir);
218201

219202
// then
220203
assertNotNull(result);

distribution/tools/fips-demo-installer-cli/src/test/java/org/opensearch/tools/cli/fips/truststore/FipsTrustStoreCommandTestCase.java

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import org.junit.AfterClass;
1414
import org.junit.Before;
1515
import org.junit.BeforeClass;
16+
import org.junit.ClassRule;
17+
import org.junit.rules.TemporaryFolder;
1618

1719
import java.io.PrintWriter;
1820
import java.io.StringWriter;
@@ -24,32 +26,24 @@
2426
import picocli.CommandLine;
2527

2628
public abstract class FipsTrustStoreCommandTestCase extends OpenSearchTestCase {
29+
@ClassRule
30+
public static TemporaryFolder tempFolder = new TemporaryFolder();
2731

2832
protected StringWriter outputCapture;
2933
protected StringWriter errorCapture;
3034
protected CommandLine commandLine;
3135
protected static Path sharedTempDir;
3236

3337
@BeforeClass
38+
@SuppressForbidden(reason = "the java.io.File is exposed by TemporaryFolder")
3439
static void setUpClass() throws Exception {
35-
sharedTempDir = Files.createTempDirectory(Path.of(System.getProperty("java.io.tmpdir")), "system-command-test-");
40+
sharedTempDir = tempFolder.newFolder().toPath();
3641
setProperties();
3742
}
3843

3944
@AfterClass
4045
static void tearDownClass() throws Exception {
4146
clearProperties();
42-
if (sharedTempDir != null && Files.exists(sharedTempDir)) {
43-
try (var walk = Files.walk(sharedTempDir)) {
44-
walk.sorted(java.util.Comparator.reverseOrder()).forEach(path -> {
45-
try {
46-
Files.delete(path);
47-
} catch (Exception e) {
48-
// Ignore
49-
}
50-
});
51-
}
52-
}
5347
}
5448

5549
@SuppressForbidden(reason = "set system properties as part of test setup")

distribution/tools/fips-demo-installer-cli/src/test/java/org/opensearch/tools/cli/fips/truststore/TrustStoreServiceTests.java

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88

99
package org.opensearch.tools.cli.fips.truststore;
1010

11+
import org.opensearch.cli.SuppressForbidden;
1112
import org.opensearch.test.OpenSearchTestCase;
12-
import org.junit.AfterClass;
13-
import org.junit.BeforeClass;
13+
import org.junit.ClassRule;
14+
import org.junit.rules.TemporaryFolder;
1415

1516
import java.io.ByteArrayInputStream;
1617
import java.io.PrintWriter;
@@ -27,34 +28,15 @@
2728
import static org.opensearch.tools.cli.fips.truststore.ConfigureSystemTrustStore.findPKCS11ProviderService;
2829

2930
public class TrustStoreServiceTests extends OpenSearchTestCase {
30-
31-
private static Path sharedTempDir;
31+
@ClassRule
32+
public static TemporaryFolder tempFolder = new TemporaryFolder();
3233

3334
private CommandLine.Model.CommandSpec spec;
3435
private StringWriter outputCapture;
3536
private Path confPath;
3637

37-
@BeforeClass
38-
public static void setUpClass() throws Exception {
39-
sharedTempDir = Files.createTempDirectory(Path.of(System.getProperty("java.io.tmpdir")), "truststore-test-");
40-
}
41-
42-
@AfterClass
43-
public static void tearDownClass() throws Exception {
44-
if (sharedTempDir != null && Files.exists(sharedTempDir)) {
45-
try (var walk = Files.walk(sharedTempDir)) {
46-
walk.sorted(java.util.Comparator.reverseOrder()).forEach(path -> {
47-
try {
48-
Files.delete(path);
49-
} catch (Exception e) {
50-
// Ignore
51-
}
52-
});
53-
}
54-
}
55-
}
56-
5738
@Override
39+
@SuppressForbidden(reason = "the java.io.File is exposed by TemporaryFolder")
5840
public void setUp() throws Exception {
5941
super.setUp();
6042
outputCapture = new StringWriter();
@@ -66,7 +48,7 @@ class TestCommand {}
6648
commandLine.setOut(new PrintWriter(outputCapture, true));
6749
spec = commandLine.getCommandSpec();
6850

69-
confPath = Files.createTempDirectory(sharedTempDir, "conf-");
51+
confPath = Files.createTempDirectory(tempFolder.newFolder().toPath(), "conf-");
7052
}
7153

7254
public void testUseSystemTrustStoreUserCancels() {

plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/S3BlobStore.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public boolean serverSideEncryptionBucketKey() {
230230
* null as the S3 client ignores null header values
231231
*/
232232
public String serverSideEncryptionEncryptionContext() {
233-
return serverSideEncryptionEncryptionContext.isEmpty()
233+
return serverSideEncryptionEncryptionContext == null || serverSideEncryptionEncryptionContext.isEmpty()
234234
? null
235235
: Base64.getEncoder().encodeToString(serverSideEncryptionEncryptionContext.getBytes(StandardCharsets.UTF_8));
236236
}
@@ -239,7 +239,7 @@ public String serverSideEncryptionEncryptionContext() {
239239
* Returns the expected bucket owner if set, else null as the S3 client ignores null header values
240240
*/
241241
public String expectedBucketOwner() {
242-
return expectedBucketOwner.isEmpty() ? null : expectedBucketOwner;
242+
return expectedBucketOwner == null || expectedBucketOwner.isEmpty() ? null : expectedBucketOwner;
243243
}
244244

245245
public long bufferSizeInBytes() {

plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/S3Repository.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,4 +683,10 @@ protected void doClose() {
683683
}
684684
super.doClose();
685685
}
686+
687+
@Override
688+
public boolean isSeverSideEncryptionEnabled() {
689+
// s3 is always server side encrypted.
690+
return true;
691+
}
686692
}

plugins/repository-s3/src/test/java/org/opensearch/repositories/s3/S3RepositoryTests.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
package org.opensearch.repositories.s3;
3434

3535
import software.amazon.awssdk.services.s3.S3Client;
36+
import software.amazon.awssdk.services.s3.model.ServerSideEncryption;
3637

3738
import org.opensearch.cluster.metadata.RepositoryMetadata;
3839
import org.opensearch.common.blobstore.BlobStoreException;
@@ -175,6 +176,18 @@ public void testValidateHttpLClientType_Invalid_Values() {
175176
}
176177
}
177178

179+
public void testIsSeverSideEncryptionEnabled_When_AWSKMS_Type() {
180+
Settings settings = Settings.builder()
181+
.put(S3Repository.SERVER_SIDE_ENCRYPTION_TYPE_SETTING.getKey(), ServerSideEncryption.AWS_KMS.toString())
182+
.build();
183+
final RepositoryMetadata metadata = new RepositoryMetadata("dummy-repo", "mock", settings);
184+
try (S3Repository s3Repo = createS3Repo(metadata)) {
185+
186+
// Don't expect any Exception
187+
assertTrue(s3Repo.isSeverSideEncryptionEnabled());
188+
}
189+
}
190+
178191
private S3Repository createS3Repo(RepositoryMetadata metadata) {
179192
return new S3Repository(
180193
metadata,
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
## Version 3.3.1 Release Notes
22

3-
Compatible with OpenSearch and OpenSearch Dashboards version 3.3.1
3+
Compatible with OpenSearch 3.3.1 and OpenSearch Dashboards 3.3.0
44

55
### Fixed
66
* Fix issue with updating core with a patch number other than 0 ([#19377](https://github.com/opensearch-project/OpenSearch/pull/19377))
77
* [Star Tree] Fix sub-aggregator casting for search with profile=true ([#19652](https://github.com/opensearch-project/OpenSearch/pull/19652))
8-
* Fix bwc @timestamp upgrade issue by adding a version check on skip_list param ([#19671](https://github.com/opensearch-project/OpenSearch/pull/19671))
8+
* Fix bwc @timestamp upgrade issue by adding a version check on skip_list param ([#19671](https://github.com/opensearch-project/OpenSearch/pull/19671))
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Version 3.3.2 Release Notes
2+
3+
Compatible with OpenSearch 3.3.2 and OpenSearch Dashboards 3.3.0
4+
5+
### Fixed
6+
* [Star Tree] Fix sub-aggregator casting for search with profile=true ([#19652](https://github.com/opensearch-project/OpenSearch/pull/19652))
7+
* [Java Agent] Allow JRT protocol URLs in protection domain extraction ([#19683](https://github.com/opensearch-project/OpenSearch/pull/19683))
8+
* Fix bwc @timestamp upgrade issue by adding a version check on skip_list param ([#19671](https://github.com/opensearch-project/OpenSearch/pull/19671))
9+
* Fix issue with updating core with a patch number other than 0 ([#19377](https://github.com/opensearch-project/OpenSearch/pull/19377))
10+
* Fix IndexOutOfBoundsException when running include/exclude on non-existent prefix in terms aggregations ([#19637](https://github.com/opensearch-project/OpenSearch/pull/19637))
11+
* Add S3Repository.LEGACY_MD5_CHECKSUM_CALCULATION to list of repository-s3 settings ([#19789](https://github.com/opensearch-project/OpenSearch/pull/19789))
12+
13+
### Dependencies
14+
* Bump ch.qos.logback modules from 1.5.18 to 1.5.20 in HDFS test fixture ([#19764](https://github.com/opensearch-project/OpenSearch/pull/19764))

server/src/main/java/org/opensearch/action/admin/cluster/remotestore/metadata/TransportRemoteStoreMetadataAction.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,9 @@ private Map<String, Map<String, Object>> getSegmentMetadata(
198198
IndexMetadata.INDEX_REMOTE_SEGMENT_STORE_REPOSITORY_SETTING.get(indexMetadata.getSettings()),
199199
index.getUUID(),
200200
shardId,
201-
indexSettings.getRemoteStorePathStrategy()
201+
indexSettings.getRemoteStorePathStrategy(),
202+
null,
203+
RemoteStoreUtils.isServerSideEncryptionEnabledIndex(indexSettings.getIndexMetadata())
202204
);
203205

204206
Map<String, RemoteSegmentMetadata> segmentMetadataMapWithFilenames = remoteDirectory.readLatestNMetadataFiles(5);
@@ -257,7 +259,8 @@ private Map<String, Map<String, Object>> getTranslogMetadataFiles(
257259
tracker,
258260
indexSettings.getRemoteStorePathStrategy(),
259261
new RemoteStoreSettings(clusterService.getSettings(), clusterService.getClusterSettings()),
260-
RemoteStoreUtils.determineTranslogMetadataEnabled(indexMetadata)
262+
RemoteStoreUtils.determineTranslogMetadataEnabled(indexMetadata),
263+
RemoteStoreUtils.isServerSideEncryptionEnabledIndex(indexSettings.getIndexMetadata())
261264
);
262265

263266
Map<String, TranslogTransferMetadata> metadataMap = manager.readLatestNMetadataFiles(5);

0 commit comments

Comments
 (0)