From 7e666e0982a8f7ceca1b3738d9c673b2c604e612 Mon Sep 17 00:00:00 2001 From: Darshit Chanpura Date: Wed, 30 Aug 2023 15:17:56 -0400 Subject: [PATCH] Corrects the security config constant name which uses trusted cas Signed-off-by: Darshit Chanpura --- src/main/java/org/opensearch/commons/ConfigConstants.java | 2 +- .../org/opensearch/commons/rest/SecureRestClientBuilder.java | 2 +- .../java/org/opensearch/commons/rest/IntegrationTests.java | 4 ++-- .../opensearch/commons/rest/SecureRestClientBuilderTest.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/opensearch/commons/ConfigConstants.java b/src/main/java/org/opensearch/commons/ConfigConstants.java index 2fcf9dae..d92e7fd0 100644 --- a/src/main/java/org/opensearch/commons/ConfigConstants.java +++ b/src/main/java/org/opensearch/commons/ConfigConstants.java @@ -21,7 +21,7 @@ public class ConfigConstants { public static final String AUTHORIZATION = "Authorization"; // These reside in security plugin. - public static final String OPENSEARCH_SECURITY_SSL_HTTP_PEMCERT_FILEPATH = "plugins.security.ssl.http.pemcert_filepath"; + public static final String OPENSEARCH_SECURITY_SSL_HTTP_PEMTRUSTEDCAS_FILEPATH = "plugins.security.ssl.http.pemtrustedcas_filepath"; public static final String OPENSEARCH_SECURITY_SSL_HTTP_KEYSTORE_FILEPATH = "plugins.security.ssl.http.keystore_filepath"; /** * @deprecated in favor of the {@link #OPENSEARCH_SECURITY_SSL_HTTP_KEYSTORE_PASSWORD_SETTING} secure setting diff --git a/src/main/java/org/opensearch/commons/rest/SecureRestClientBuilder.java b/src/main/java/org/opensearch/commons/rest/SecureRestClientBuilder.java index 74f18b02..df1f7b4c 100644 --- a/src/main/java/org/opensearch/commons/rest/SecureRestClientBuilder.java +++ b/src/main/java/org/opensearch/commons/rest/SecureRestClientBuilder.java @@ -310,7 +310,7 @@ private String resolve(final String originalFile, final Path configPath) { } private String getTrustPem() { - return settings.get(ConfigConstants.OPENSEARCH_SECURITY_SSL_HTTP_PEMCERT_FILEPATH, null); + return settings.get(ConfigConstants.OPENSEARCH_SECURITY_SSL_HTTP_PEMTRUSTEDCAS_FILEPATH, null); } private String getKeystorePasswd() { diff --git a/src/test/java/org/opensearch/commons/rest/IntegrationTests.java b/src/test/java/org/opensearch/commons/rest/IntegrationTests.java index 818c1b6c..35837550 100644 --- a/src/test/java/org/opensearch/commons/rest/IntegrationTests.java +++ b/src/test/java/org/opensearch/commons/rest/IntegrationTests.java @@ -11,7 +11,7 @@ import static org.opensearch.commons.ConfigConstants.OPENSEARCH_SECURITY_SSL_HTTP_KEYSTORE_FILEPATH; import static org.opensearch.commons.ConfigConstants.OPENSEARCH_SECURITY_SSL_HTTP_KEYSTORE_KEYPASSWORD_SETTING; import static org.opensearch.commons.ConfigConstants.OPENSEARCH_SECURITY_SSL_HTTP_KEYSTORE_PASSWORD_SETTING; -import static org.opensearch.commons.ConfigConstants.OPENSEARCH_SECURITY_SSL_HTTP_PEMCERT_FILEPATH; +import static org.opensearch.commons.ConfigConstants.OPENSEARCH_SECURITY_SSL_HTTP_PEMTRUSTEDCAS_FILEPATH; import java.io.File; import java.nio.file.Path; @@ -63,7 +63,7 @@ public void testCreateRestClientWithCerts() throws Exception { .builder() .put("http.port", 9200) .put(OPENSEARCH_SECURITY_SSL_HTTP_ENABLED, true) - .put(OPENSEARCH_SECURITY_SSL_HTTP_PEMCERT_FILEPATH, "sample.pem") + .put(OPENSEARCH_SECURITY_SSL_HTTP_PEMTRUSTEDCAS_FILEPATH, "sample.pem") .put(OPENSEARCH_SECURITY_SSL_HTTP_KEYSTORE_FILEPATH, "test-kirk.jks") .setSecureSettings(createSecureSettings()) .build(); diff --git a/src/test/java/org/opensearch/commons/rest/SecureRestClientBuilderTest.java b/src/test/java/org/opensearch/commons/rest/SecureRestClientBuilderTest.java index 4a034f7e..4af20e8f 100644 --- a/src/test/java/org/opensearch/commons/rest/SecureRestClientBuilderTest.java +++ b/src/test/java/org/opensearch/commons/rest/SecureRestClientBuilderTest.java @@ -60,7 +60,7 @@ public void testMissingConfigPath() { .builder() .put("http.port", 9200) .put("plugins.security.ssl.http.enabled", true) - .put("plugins.security.ssl.http.pemcert_filepath", "sample.pem") + .put("plugins.security.ssl.http.pemtrustedcas_filepath", "sample.pem") .build(); new SecureRestClientBuilder(settings, Paths.get("sample.pem")).build(); });