【问题标题】:Confluent kafka python SSL verificationConfluent kafka python SSL验证
【发布时间】:2020-06-20 11:37:03
【问题描述】:

我正在使用 confluent kafka python 'https://github.com/confluentinc/confluent-kafka-python' 编写应用程序。 kafka 和模式注册表都是安全的并使用 https 端点。

在运行应用程序时,我收到以下错误

Result: Failure Exception: SSLError: HTTPSConnectionPool(host='hostname', port=443): 
Max retries exceeded with url: //subjects/schema-value/versions (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])"))) 

问题一:

For connecting to schema registry, where to specify the ceritificate value ?

问题 2:

For testing, i want to disable SSL verification in python, What is the option to do that ?

提前致谢。

【问题讨论】:

  • pip install -U pyopenssl 可以解决它

标签: python apache-kafka ssl-certificate kafka-producer-api confluent-platform


【解决方案1】:

这是我用于 avro 生产者的配置:

avro_producer_conf = {
    "bootstrap.servers": "SSL://127.0.0.1:9094",
    "security.protocol": "ssl",
    # Certificates used by simple Producer
    "ssl.ca.location": "/ssl/root/intermediate/ca-chain.cert.pem",
    "ssl.certificate.location": "/ssl/root/intermediate/producer/producer.cert.pem",
    "ssl.key.location": "/ssl/root/intermediate/producer/producer.key.pem",
    'schema.registry.url': "https://schemaregistry:8081",
    # Certificates used by Schema Registry
    "schema.registry.ssl.ca.location": "/ssl/root/intermediate/ca-chain.cert.pem",
    "schema.registry.ssl.certificate.location": "/ssl/root/intermediate/producer/producer.cert.pem",
    "schema.registry.ssl.key.location": "/ssl/root/intermediate/producer/producer.key.pem"
}

AvroProducer __init__() 方法正在做参数的分离。您想要传递给 SchemaRegistry 的所有内容都需要以 schema.registry.<parameter> 开头。要将 SSL 与 Schema 注册表一起使用,请确保使用非加密密钥(没有密码的私钥)。确保你没有设置REQUESTS_CA_BUNDLE 环境变量,它会混淆库。

【讨论】:

    猜你喜欢
    • 2021-11-07
    • 2019-12-05
    • 1970-01-01
    • 2022-01-09
    • 1970-01-01
    • 2016-11-10
    • 2022-11-21
    • 1970-01-01
    • 2021-12-10
    相关资源
    最近更新 更多