confluentinc / cp-demo

Confluent Platform Demo including Apache Kafka, ksqlDB, Control Center, Schema Registry, Security, Schema Linking, and Cluster Linking
Apache License 2.0
38 stars 322 forks source link

Use listener scoped sasl mechanism rather than a fallback KafkaServer section #378

Closed danielpetisme closed 3 years ago

danielpetisme commented 3 years ago

Description This issue refers the following discussion https://confluent.slack.com/archives/C60B5SJ1E/p1622746349449000

TL;DR The current setup works because it provides a fallback KafkaServer section in the broker_jaas.conf file where it should only use the listener-scope properties.

When providing a listener scoped JAAS config (like listener.name.internal.plain.sasl.jaas.config for instance) Kafka will 1st search for a listener.name.internal.sasl.enabled.mechanisms. If the listener-scoped mechanism is not found then Kafka will try to load the information from the java.auth.file (here brokerjaas.conf) looking for first for a internal.KafkaServer section or falling back to KafkaServer. Combining both a KafkaServer section and a listener-scoped jaas config is kind of fishy... For instance, the credentials defined for the `user` principals are not used at all in cp-demo (overridden by the one in the inlined jaas config property).