From 72b0164f0031034142bc18f91973a256ac7feeee Mon Sep 17 00:00:00 2001 From: Dinu John <86094133+dinujoh@users.noreply.github.com> Date: Fri, 23 Feb 2024 11:47:15 -0600 Subject: [PATCH] Support Kafka SASL_SSL/SSL security protocol for self signed certifice - Renamed the field names for certificate, truststore and password. - Removed redundant information from build.gradle Signed-off-by: Dinu John <86094133+dinujoh@users.noreply.github.com> --- data-prepper-plugins/http-common/build.gradle | 13 ------------- .../kafka/configuration/EncryptionConfig.java | 6 +++--- .../resources/kafka-pipeline-auth-insecure.yaml | 2 +- .../resources/kafka-pipeline-no-auth-ssl-none.yaml | 2 +- .../test/resources/kafka-pipeline-no-auth-ssl.yaml | 2 +- ...kafka-pipeline-sasl-ssl-certificate-content.yaml | 2 +- .../kafka-pipeline-sasl-ssl-truststore.yaml | 4 ++-- .../src/test/resources/kafka-pipeline-sasl-ssl.yaml | 2 +- 8 files changed, 10 insertions(+), 23 deletions(-) diff --git a/data-prepper-plugins/http-common/build.gradle b/data-prepper-plugins/http-common/build.gradle index a4b3f202b6..3f6d2a6ff2 100644 --- a/data-prepper-plugins/http-common/build.gradle +++ b/data-prepper-plugins/http-common/build.gradle @@ -1,25 +1,12 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - plugins { id 'java' } -repositories { - mavenCentral() -} - dependencies { implementation 'org.apache.httpcomponents:httpcore:4.4.16' testImplementation testLibs.bundles.junit } -test { - useJUnitPlatform() -} - jacocoTestCoverageVerification { dependsOn jacocoTestReport violationRules { diff --git a/data-prepper-plugins/kafka-plugins/src/main/java/org/opensearch/dataprepper/plugins/kafka/configuration/EncryptionConfig.java b/data-prepper-plugins/kafka-plugins/src/main/java/org/opensearch/dataprepper/plugins/kafka/configuration/EncryptionConfig.java index 9ee67e92a4..4b1e975c74 100644 --- a/data-prepper-plugins/kafka-plugins/src/main/java/org/opensearch/dataprepper/plugins/kafka/configuration/EncryptionConfig.java +++ b/data-prepper-plugins/kafka-plugins/src/main/java/org/opensearch/dataprepper/plugins/kafka/configuration/EncryptionConfig.java @@ -11,13 +11,13 @@ public class EncryptionConfig { @JsonProperty("type") private EncryptionType type = EncryptionType.SSL; - @JsonProperty("certificateContent") + @JsonProperty("certificate_content") private String certificateContent; - @JsonProperty("trustStoreFilePath") + @JsonProperty("trust_store_file_path") private String trustStoreFilePath; - @JsonProperty("trustStorePassword") + @JsonProperty("trust_store_password") private String trustStorePassword; @JsonProperty("insecure") diff --git a/data-prepper-plugins/kafka-plugins/src/test/resources/kafka-pipeline-auth-insecure.yaml b/data-prepper-plugins/kafka-plugins/src/test/resources/kafka-pipeline-auth-insecure.yaml index 0092fac3b4..b62ebfdf08 100644 --- a/data-prepper-plugins/kafka-plugins/src/test/resources/kafka-pipeline-auth-insecure.yaml +++ b/data-prepper-plugins/kafka-plugins/src/test/resources/kafka-pipeline-auth-insecure.yaml @@ -5,7 +5,7 @@ log-pipeline : - "localhost:9092" encryption: type: "NONE" - certificateContent: "CERTIFICATE_DATA" + certificate_content: "CERTIFICATE_DATA" insecure: "true" authentication: sasl: diff --git a/data-prepper-plugins/kafka-plugins/src/test/resources/kafka-pipeline-no-auth-ssl-none.yaml b/data-prepper-plugins/kafka-plugins/src/test/resources/kafka-pipeline-no-auth-ssl-none.yaml index fef3ceb423..4bae77dc5e 100644 --- a/data-prepper-plugins/kafka-plugins/src/test/resources/kafka-pipeline-no-auth-ssl-none.yaml +++ b/data-prepper-plugins/kafka-plugins/src/test/resources/kafka-pipeline-no-auth-ssl-none.yaml @@ -5,7 +5,7 @@ log-pipeline : - "localhost:9092" encryption: type: "NONE" - certificateContent: "CERTIFICATE_DATA" + certificate_content: "CERTIFICATE_DATA" topics: - name: "quickstart-events" group_id: "groupdID1" diff --git a/data-prepper-plugins/kafka-plugins/src/test/resources/kafka-pipeline-no-auth-ssl.yaml b/data-prepper-plugins/kafka-plugins/src/test/resources/kafka-pipeline-no-auth-ssl.yaml index 7c526e3723..5d894ab0cf 100644 --- a/data-prepper-plugins/kafka-plugins/src/test/resources/kafka-pipeline-no-auth-ssl.yaml +++ b/data-prepper-plugins/kafka-plugins/src/test/resources/kafka-pipeline-no-auth-ssl.yaml @@ -5,7 +5,7 @@ log-pipeline : - "localhost:9092" encryption: type: "SSL" - certificateContent: "CERTIFICATE_DATA" + certificate_content: "CERTIFICATE_DATA" topics: - name: "quickstart-events" group_id: "groupdID1" diff --git a/data-prepper-plugins/kafka-plugins/src/test/resources/kafka-pipeline-sasl-ssl-certificate-content.yaml b/data-prepper-plugins/kafka-plugins/src/test/resources/kafka-pipeline-sasl-ssl-certificate-content.yaml index 16511fbdc8..d1fe45810d 100644 --- a/data-prepper-plugins/kafka-plugins/src/test/resources/kafka-pipeline-sasl-ssl-certificate-content.yaml +++ b/data-prepper-plugins/kafka-plugins/src/test/resources/kafka-pipeline-sasl-ssl-certificate-content.yaml @@ -5,7 +5,7 @@ log-pipeline : - "localhost:9092" encryption: type: "SSL" - certificateContent: "CERTIFICATE_DATA" + certificate_content: "CERTIFICATE_DATA" authentication: sasl: plaintext: diff --git a/data-prepper-plugins/kafka-plugins/src/test/resources/kafka-pipeline-sasl-ssl-truststore.yaml b/data-prepper-plugins/kafka-plugins/src/test/resources/kafka-pipeline-sasl-ssl-truststore.yaml index ad010746e5..fe499a6901 100644 --- a/data-prepper-plugins/kafka-plugins/src/test/resources/kafka-pipeline-sasl-ssl-truststore.yaml +++ b/data-prepper-plugins/kafka-plugins/src/test/resources/kafka-pipeline-sasl-ssl-truststore.yaml @@ -5,8 +5,8 @@ log-pipeline : - "localhost:9092" encryption: type: "SSL" - trustStoreFilePath: "some-file-path" - trustStorePassword: "some-password" + trust_store_file_path: "some-file-path" + trust_store_password: "some-password" authentication: sasl: plaintext: diff --git a/data-prepper-plugins/kafka-plugins/src/test/resources/kafka-pipeline-sasl-ssl.yaml b/data-prepper-plugins/kafka-plugins/src/test/resources/kafka-pipeline-sasl-ssl.yaml index 16511fbdc8..d1fe45810d 100644 --- a/data-prepper-plugins/kafka-plugins/src/test/resources/kafka-pipeline-sasl-ssl.yaml +++ b/data-prepper-plugins/kafka-plugins/src/test/resources/kafka-pipeline-sasl-ssl.yaml @@ -5,7 +5,7 @@ log-pipeline : - "localhost:9092" encryption: type: "SSL" - certificateContent: "CERTIFICATE_DATA" + certificate_content: "CERTIFICATE_DATA" authentication: sasl: plaintext: