Replies: 3 comments 1 reply
-
This is by design as SASL is not used on the internal listeners. Your listener's SASL configuration is under the listener prefix. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick reply, @scholzj. Trace logging on my Kafka client yielded a little bit more info.
The AdminClient is unable to fetch metadata from the cluster and ultimately times out trying, even though the nodes are accessible and requests arrive in our JAR. |
Beta Was this translation helpful? Give feedback.
-
I still don't know what caused this issue, but I managed to circumvent it by falling back to creating a listener with regular oauth configuration (type: oauth) and using Strimzi's JaasServerOauthValidatorCallbackHandler instead of our (unnecessary) custom class. Authentication now works and the client is able to fetch metadata from the cluster. Authentication config of the listener (I provided the jwks Urls both in regular config and in JAAS config. Still need to remove one of those):
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am having an issue where I can't connect to the Strimzi brokers using OAUTHBEARER protocol.
We use a custom Stimzi image based on
kafka:0.35.1-kafka-3.4.0
. The custom image allows us to include our custom JAR, see below.Sorry for the lengthy post. I tried to provide all the relevant details. In the code samples and config below I replaced our domain by
example.com
.I use both OAUTHBEARER and SCRAM-SHA-512 under the same custom listener on port 9092. I can connect with Apache (Java) KafkaAdminClient using SCRAM-SHA-512 and username/password, create a topic and I can create a KafkaProducer and KafkaCconsumer and produce and consume messages on this topic.
With OAUTHBEARER however, I keep running into this error:
Cancelled in-flight API_VERSIONS request with correlation id 36 due to node -1 being disconnected
This is the listener config from the Strimzi manifest:
The class
TokenValidatorCallbackHandler
is our custom JAR. It is an implementation ofAuthenticateCallbackHandler
. The JAR validates the incoming token that our client obtains from our identity provider. It does this using public keys it obtains from the same identity provider. (I am aware this scenario is supported out of the box by Strimzi, but for reasons beyond my control this is currently our solution).I am somewhat confident our
TokenValidatorCallbackHandler
JAR is doing what it is supposed to. Itshandle()
method is below.The jwkProvider is built earlier with the jwks URL. I am confident the jwkProvider is created correctly, so not including its creation.
When I run our Java admin / producer code (see below), in the log I see no exceptions and I see the "Token verified" LOG statement, which would not happen if the token could not be verified.
I also check the logged token and it is indeed coming from our IDP. I am quite confident the fetching of the token by the client (code below) and the verification of the token by our custom JAR work OK.
I hope I am doing the right thing by returning the new token at cb.token(token); at the end. This is still a question mark for me.
If indeed I am supposed to return the token to the callback, then I think the JAR is working as designed and should not be the cause of the problem.
The sdsext / 9092 custom listener config from
/tmp/strimzi.properties
on the broker looks like this:The common listener config:
The
sasl.enabled.mechanisms
is empty in the common listener config. Is this by design? Could this be causing the issue? Can I set it via the Strimzi manifest somehow?Then the
main()
method from my test client calledExampleProducer
below. Our test client useskafka-clients
3.4.0 (same Kafka version as our Strimzi)This code fails on
client.describeCluster().nodes().get()
. Full log output from running this:Finally, the content of the
oauth.properties
file that theExampleProducer
loads properties from:Some things I already figured out:
org.apache.kafka.clients.NetworkClient
are coming from itsprocessDisconnection()
method. ThediconnectState.state()
isREADY
. So none of theswitch
options are matched. https://github.com/a0x8o/kafka/blob/54eff6af115ee647f60129f2ce6a044cb17215d0/clients/src/main/java/org/apache/kafka/clients/NetworkClient.java#L760.Beta Was this translation helpful? Give feedback.
All reactions