-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(schema-registry): add SSL support for SchemaRegistry (#425)
- Loading branch information
1 parent
acd7e69
commit 1857335
Showing
10 changed files
with
503 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright (c) The original authors | ||
# | ||
# Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
version: '3.8' | ||
services: | ||
kafka: | ||
image: "confluentinc/cp-kafka:7.5.0" | ||
ports: | ||
- "9092:9092" | ||
container_name: kafka | ||
environment: | ||
KAFKA_NODE_ID: 101 | ||
# random cluster ID used for formatting LOG_DIR for KRaft | ||
CLUSTER_ID: 'xtzWWN4bTjitpL3kfd9s5g' | ||
KAFKA_CONTROLLER_QUORUM_VOTERS: '101@kafka:29093' | ||
KAFKA_PROCESS_ROLES: 'broker,controller' | ||
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092' | ||
KAFKA_LISTENERS: 'PLAINTEXT://kafka:29092,PLAINTEXT_HOST://0.0.0.0:9092,CONTROLLER://kafka:29093' | ||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: 'CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT' | ||
KAFKA_CONTROLLER_LISTENER_NAMES: 'CONTROLLER' | ||
KAFKA_INTER_BROKER_LISTENER_NAME: 'PLAINTEXT' | ||
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 | ||
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 | ||
CONFLUENT_METRICS_REPORTER_BOOTSTRAP_SERVERS: kafka:29092 | ||
CONFLUENT_METRICS_REPORTER_TOPIC_REPLICAS: 1 | ||
CONFLUENT_METRICS_ENABLE: 'false' | ||
KAFKA_AUTHORIZER_CLASS_NAME: org.apache.kafka.metadata.authorizer.StandardAuthorizer | ||
KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: 'true' | ||
KAFKA_SUPER_USERS: 'User:anonymous' | ||
networks: | ||
- kafka-platform | ||
|
||
schema-registry: | ||
image: confluentinc/cp-schema-registry:7.5.0 | ||
hostname: schema-registry | ||
container_name: schema-registry | ||
ports: | ||
- "8081:8081" | ||
- "8082:8082" | ||
environment: | ||
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: PLAINTEXT://kafka:29092 | ||
SCHEMA_REGISTRY_HOST_NAME: schema-registry | ||
SCHEMA_REGISTRY_LISTENERS: https://0.0.0.0:8081,http://0.0.0.0:8082 | ||
SCHEMA_REGISTRY_SSL_KEYSTORE_LOCATION: "/app/certs/kafka.keystore.jks" | ||
SCHEMA_REGISTRY_SSL_KEYSTORE_PASSWORD: "password" | ||
SCHEMA_REGISTRY_SSL_KEYSTORE_TYPE: "JKS" | ||
SCHEMA_REGISTRY_SSL_KEY_PASSWORD: "password" | ||
SCHEMA_REGISTRY_SSL_TRUSTSTORE_LOCATION: "/app/certs/kafka.truststore.jks" | ||
SCHEMA_REGISTRY_SSL_TRUSTSTORE_PASSWORD: "password" | ||
SCHEMA_REGISTRY_SSL_TRUSTSTORE_TYPE: "JKS" | ||
SCHEMA_REGISTRY_SSL_CLIENT_AUTH: "true" | ||
volumes: | ||
- ./certs/:/app/certs | ||
depends_on: | ||
- kafka | ||
networks: | ||
- kafka-platform | ||
akhq: | ||
image: tchiotludo/akhq | ||
hostname: akhq | ||
container_name: akhq | ||
depends_on: | ||
- kafka | ||
ports: | ||
- "8087:8080" | ||
environment: | ||
AKHQ_CONFIGURATION: | | ||
akhq: | ||
connections: | ||
docker-kafka-server: | ||
properties: | ||
bootstrap.servers: "kafka:29092" | ||
schema-registry: | ||
url: "http://schema-registry:8081" | ||
connect: | ||
- name: "connect" | ||
url: "http://connect:8083" | ||
networks: | ||
- kafka-platform | ||
|
||
connect: | ||
image: confluentinc/cp-kafka-connect:7.5.0 | ||
container_name: connect | ||
depends_on: | ||
- kafka | ||
ports: | ||
- "8083:8083" | ||
- "8000:8000" | ||
environment: | ||
CONNECT_BOOTSTRAP_SERVERS: 'kafka:29092' | ||
CONNECT_REST_ADVERTISED_HOST_NAME: connect | ||
CONNECT_REST_PORT: 8083 | ||
CONNECT_GROUP_ID: kafka-connect | ||
CONNECT_CONFIG_STORAGE_TOPIC: _connect-configs | ||
CONNECT_CONFIG_STORAGE_REPLICATION_FACTOR: 1 | ||
CONNECT_OFFSET_FLUSH_INTERVAL_MS: 10000 | ||
CONNECT_OFFSET_STORAGE_TOPIC: _connect-offsets | ||
CONNECT_OFFSET_STORAGE_REPLICATION_FACTOR: 1 | ||
CONNECT_STATUS_STORAGE_TOPIC: _connect-status | ||
CONNECT_STATUS_STORAGE_REPLICATION_FACTOR: 1 | ||
CONNECT_KEY_CONVERTER: org.apache.kafka.connect.storage.StringConverter | ||
CONNECT_VALUE_CONVERTER: org.apache.kafka.connect.storage.StringConverter | ||
CONNECT_INTERNAL_KEY_CONVERTER: "org.apache.kafka.connect.json.JsonConverter" | ||
CONNECT_INTERNAL_VALUE_CONVERTER: "org.apache.kafka.connect.json.JsonConverter" | ||
CONNECT_PLUGIN_PATH: "/usr/local/share/kafka/plugins,/usr/share/filestream-connectors" | ||
networks: | ||
- kafka-platform | ||
|
||
networks: | ||
kafka-platform: | ||
driver: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
...sion-rest-client/src/main/java/io/streamthoughts/jikkou/http/client/SslConfigSupport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* Copyright (c) The original authors | ||
* | ||
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 | ||
*/ | ||
package io.streamthoughts.jikkou.http.client; | ||
|
||
import io.streamthoughts.jikkou.core.config.ConfigProperty; | ||
import io.streamthoughts.jikkou.core.config.Configuration; | ||
import io.streamthoughts.jikkou.http.client.ssl.SSLConfig; | ||
|
||
public interface SslConfigSupport { | ||
|
||
static ConfigProperty<String> sslKeyStoreLocation(final String configNamespace) { | ||
return ConfigProperty | ||
.ofString(configNamespace + ".sslKeyStoreLocation") | ||
.description("The location of the key store file."); | ||
} | ||
|
||
static ConfigProperty<String> sslKeyStoreType(final String configNamespace) { | ||
return ConfigProperty | ||
.ofString(configNamespace + ".sslKeyStoreType") | ||
.description("The file format of the key store file.") | ||
.orElse("PKCS12"); | ||
} | ||
|
||
static ConfigProperty<String> sslKeyStorePassword(final String configNamespace) { | ||
return ConfigProperty | ||
.ofString(configNamespace + ".sslKeyStorePassword") | ||
.description("The password for the key store file."); | ||
} | ||
|
||
static ConfigProperty<String> sslKeyPassword(final String configNamespace) { | ||
return ConfigProperty | ||
.ofString(configNamespace + ".sslKeyPassword") | ||
.description("The password of the private key in the key store file."); | ||
} | ||
|
||
static ConfigProperty<String> sslTrustStoreLocation(final String configNamespace) { | ||
return ConfigProperty | ||
.ofString(configNamespace + ".sslTrustStoreLocation") | ||
.description("The location of the trust store file."); | ||
} | ||
|
||
static ConfigProperty<String> sslTrustStoreType(final String configNamespace) { | ||
return ConfigProperty | ||
.ofString(configNamespace + ".sslTrustStoreType") | ||
.description("The file format of the trust store file.") | ||
.orElse("PKCS12"); | ||
} | ||
|
||
static ConfigProperty<String> sslTrustStorePassword(final String configNamespace) { | ||
return ConfigProperty | ||
.ofString(configNamespace + ".sslTrustStorePassword") | ||
.description("The password for the trust store file."); | ||
} | ||
|
||
static ConfigProperty<Boolean> sslIgnoreHostnameVerification(final String configNamespace) { | ||
return ConfigProperty | ||
.ofBoolean(configNamespace + ".sslIgnoreHostnameVerification") | ||
.description("Specifies whether to ignore the hostname verification.") | ||
.orElse(false); | ||
} | ||
|
||
static SSLConfig getSslConfig(final String configNamespace, | ||
final Configuration configuration) { | ||
return new SSLConfig( | ||
SslConfigSupport.sslKeyStoreLocation(configNamespace).getOptional(configuration).orElse(null), | ||
SslConfigSupport.sslKeyStorePassword(configNamespace).getOptional(configuration).orElse(null), | ||
SslConfigSupport.sslKeyStoreType(configNamespace).get(configuration), | ||
SslConfigSupport.sslKeyPassword(configNamespace).getOptional(configuration).orElse(null), | ||
SslConfigSupport.sslTrustStoreLocation(configNamespace).getOptional(configuration).orElse(null), | ||
SslConfigSupport.sslTrustStorePassword(configNamespace).getOptional(configuration).orElse(null), | ||
SslConfigSupport.sslTrustStoreType(configNamespace).get(configuration), | ||
SslConfigSupport.sslIgnoreHostnameVerification(configNamespace).get(configuration) | ||
); | ||
} | ||
} |
Oops, something went wrong.