融合架构注册表SSL配置

时间:2020-02-20 12:21:03

标签: ssl apache-kafka confluent-platform confluent-schema-registry apache-kafka-security

我是kafka领域的新手。

我在RHEL7计算机(主机名:kafka-confluent)中都安装了kafka,zookeeper和架构注册表,它不是集群设置,因此只有1个代理。

现在,我想为我的设置配置SSL加密。我已经根据docs创建了ssl密钥和证书。

然后我配置了属性文件。

我的(融合平台安装目录)/etc/kafka/server.properties

ssl.truststore.location=/home/kafka/kafka.server.truststore.jks
ssl.truststore.password=password
ssl.keystore.location=/home/kafka/kafka.server.keystore.jks
ssl.keystore.password=password
ssl.key.password=password
security.inter.broker.protocol=SSL
ssl.client.auth=required
listeners=PLAINTEXT://:9092,SSL://:9093

我的(融合平台安装目录)/etc/schema-registry/schema-registry.properties

listeners=http://0.0.0.0:8081,https://0.0.0.0:8082
ssl.truststore.location=/home/kafka/kafka.server.truststore.jks
ssl.truststore.password=password
ssl.keystore.location=/home/kafka/kafka.server.keystore.jks
ssl.keystore.password=password
ssl.key.password=password
ssl.client.auth=true

我之前已经创建了一个主题test,当我在服务器中发布消息时,它失败了:

[kafka@kafka-confluent ~]$ echo "Hello, World" | /home/kafka/confluent-5.4.0/bin/kafka-console-producer --broker-list localhost:9093 --topic test > /dev/null

[2020-02-20 18:45:12,193] ERROR Error when sending message to topic test with key: null, value: 13 bytes with error: (org.apache.kafka.clients.producer.internals.ErrorLoggingCallback)
org.apache.kafka.common.errors.TimeoutException: Topic test not present in metadata after 60000 ms.

然后我检查了server.log,它显示了身份验证失败:

[2020-02-20 18:45:47,754] INFO [SocketServer brokerId=0] Failed authentication with /127.0.0.1 (SSL handshake failed) (org.apache.kafka.common.network.Selector)

1 个答案:

答案 0 :(得分:0)

值得检查ssl.endpoint.identification.algorithm

客户端用来验证的端点标识算法 服务器主机名。默认值为https。客户包括客户 经纪人为经纪人之间的通信创建的连接 验证代理主机名与代理服务器中的主机名匹配 证书。通过设置禁用服务器主机名验证 ssl.endpoint.identification.algorithm为空字符串

因此,将ssl.endpoint.identification.algorithm设置为空字符串应该可以解决问题:

ssl.endpoint.identification.algorithm=

请注意,此配置可防止中间人攻击,因此请考虑对其进行相应配置。