Skip to content

Two way TLS to schema registry doesn't work anymore with 3.31.0 #498

@yvespp

Description

@yvespp

With version 3.31.0 we are no longer able to connect to the schema registry with two way TLS.
Test URL: https://my-host/topic/my-topic/messages?partition=0&offset=0&count=100&keyFormat=DEFAULT&format=AVRO&isAnyProto=false
Exception:

A 500 error has occurred: Request processing failed; nested exception is org.apache.kafka.common.errors.SerializationException: Error retrieving Avro value schema for id 3109
org.apache.kafka.common.errors.SerializationException: Error retrieving Avro value schema for id 3109 at io.confluent.kafka.serializers.AbstractKafkaAvroDeserializer$DeserializationContext.schemaFromRegistry(AbstractKafkaAvroDeserializer.java:345)
        at io.confluent.kafka.serializers.AbstractKafkaAvroDeserializer$DeserializationContext.schemaFromRegistry(AbstractKafkaAvroDeserializer.java:345)
        at io.confluent.kafka.serializers.AbstractKafkaAvroDeserializer.deserialize(AbstractKafkaAvroDeserializer.java:152)
        at io.confluent.kafka.serializers.KafkaAvroDeserializer.deserialize(KafkaAvroDeserializer.java:53)
...
Caused by: java.net.SocketException: Broken pipe (Write failed)
        at java.base/java.net.SocketOutputStream.socketWrite0(Native Method)
...
        at io.confluent.kafka.serializers.AbstractKafkaAvroDeserializer$DeserializationContext.schemaFromRegistry(AbstractKafkaAvroDeserializer.java:342)
        ... 87 more

With -Djavax.net.debug=all I can see, that no certificate was selected:

javax.net.ssl|DEBUG|33|XNIO-1 task-1|2023-04-04 08:53:02.440 CEST|ServerHelloDone.java:151|Consuming ServerHelloDone handshake message (
javax.net.ssl|DEBUG|33|XNIO-1 task-1|2023-04-04 08:53:02.440 CEST|CertificateMessage.java:299|No X.509 certificate for client authentication, use empty Certificate message instead

With 3.30.0 it was enough to configure this:

Properties in KAFKA_PROPERTIES_FILE:

security.protocol=SSL
ssl.keystore.password=...
ssl.keystore.location=...
ssl.truststore.password=...
ssl.truststore.location=...

JVM_OPTS:

-Djavax.net.ssl.keyStore=... -Djavax.net.ssl.keyStorePassword=...
-Djavax.net.ssl.trustStore=... -Djavax.net.ssl.trustStorePassword=...

I also tried setting schema.registry.ssl.keystore.* via properties and JVM_OPTS but it didn't make a difference.

I think the cause for this is the update of the Kafka libs from 7.2 to 7.3 because we had a similar problem with kafka-avro-console-consumer. In the newer version we had to set all the keystore/truststore settings via --property schema.registry.ssl.keystore.* to get it to work again.

Is there a way to set the KafkaAvroDeserializerConfig directly? Log:

2023-04-04 09:17:39.782  INFO 1 [  XNIO-1 task-2] o.a.k.c.c.AbstractConfig                 : KafkaAvroDeserializerConfig values:
...
        schema.registry.basic.auth.user.info = [hidden]
        schema.registry.ssl.cipher.suites = null
        schema.registry.ssl.enabled.protocols = [TLSv1.2, TLSv1.3]
        schema.registry.ssl.endpoint.identification.algorithm = https
        schema.registry.ssl.engine.factory.class = null
        schema.registry.ssl.key.password = null
        schema.registry.ssl.keymanager.algorithm = SunX509
        schema.registry.ssl.keystore.certificate.chain = null
        schema.registry.ssl.keystore.key = null
        schema.registry.ssl.keystore.location = null
        schema.registry.ssl.keystore.password = null
        schema.registry.ssl.keystore.type = JKS
        schema.registry.ssl.protocol = TLSv1.3
        schema.registry.ssl.provider = null
        schema.registry.ssl.secure.random.implementation = null
        schema.registry.ssl.trustmanager.algorithm = PKIX
        schema.registry.ssl.truststore.certificates = null
        schema.registry.ssl.truststore.location = null
        schema.registry.ssl.truststore.password = null
        schema.registry.ssl.truststore.type = JKS
        schema.registry.url = [https://my-schema-reg/]
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinginvestigateWe are currently investigating the issuestale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions