-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix nullpointer that occurs when OAuthKafkaPrincipalBuilder is used with Kerberos listener #207
Fix nullpointer that occurs when OAuthKafkaPrincipalBuilder is used with Kerberos listener #207
Conversation
The scenario when using OAuth and Kerberos authentication in the same cluster was indeed not accounted for. The use-case of needing this co-existence in order to be able to slowly migrate away from LDAP is legitimate, yet this is the first time I've heard of it :) I don't see a problem adding this support as long as the existing testsuite tests keep passing. |
7224705
to
6043de0
Compare
@mstruk Thanks for your quick response and willingness to support our use case. As far as I can see, all the test suites are passing. Let me know if there is anything else you need me to do. Any idea when we can expect to see a strimzi-kafka-oauth release with these changes included? |
@akaczano I suggest you add a test to the testsuite, otherwise it's very likely some future work may inadvertently break your fix. |
8b53ac1
to
cf72476
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @akaczano . Maybe remove some of the commented lines that are there for debugging purposes, other than that this looks good to me, unless you still plan to add something.
Thanks for the review @mstruk. I just cleaned up the test file like you mentioned. I do not plan to add anything further. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nits. But LGTM overall.
@@ -20,6 +20,7 @@ Then, you have to add some entries to your `/etc/hosts` file: | |||
127.0.0.1 hydra-jwt | |||
127.0.0.1 kafka | |||
127.0.0.1 mockoauth | |||
127.0.0.1 kerberos |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this have the same alignment as the lines above? I guess technically, it does not matter, but would be more readable.
@@ -0,0 +1,10 @@ | |||
FROM ubuntu:22.04 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mstruk Are you fine with this being based on Ubuntu? Strimzi IMHO does not use Ubuntu images anywhere else. So I would feel better if this used Red Hat UBI images as all our other projects. But I can live with this if you are fine with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that you pointed this out, if I remember correctly, we had some Travis build issues with Ubuntu images on some architectures.
@akaczano Could you try use:
FROM registry.access.redhat.com/ubi8/ubi
or
FROM registry.access.redhat.com/ubi8/openjdk-17
You may need to install some additional packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure; I'll give that a try.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a look at this and it looks very challenging to set it up on ubi8
. Tried a few leads with no luck. The needed package krb5-server
doesn't seem to be available in the repo or is behind some kind of subscription wall. The setup is apparently very complicated as it is, and putting it together with any alternative would be just as complicated if not more. I suggest we keep it as is, and exclude the test run on architectures that will cause problems due to unavailability of platform specific container images.
@mstruk Why does it not run the Travis tests? We should not merge it without that. |
That's a good question. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Travis CI has issues with ubuntu docker images. Travis CI is failing but for some reason that's not visible under Checks.
Signed-off-by: Aidan Kaczanowski <[email protected]>
Signed-off-by: Aidan Kaczanowski <[email protected]>
Signed-off-by: Aidan Kaczanowski <[email protected]>
Signed-off-by: Aidan Kaczanowski <[email protected]>
Signed-off-by: Aidan Kaczanowski <[email protected]>
Signed-off-by: Aidan Kaczanowski <[email protected]>
Signed-off-by: Aidan Kaczanowski <[email protected]>
In order to exclude running the testsuite with kerberos tests (also not starting the `kerberos` container) set the env variable `OAUTH_TESTSUITE_TEST_KERBEROS=false` Signed-off-by: Marko Strukelj <[email protected]>
12d663a
to
fe0930a
Compare
As described in #208,
The principal builder extends the
DefaultKafkaPrincipalBuilder
but it just passes nulls to the two objects,SslPrincipalMapper
andKerberosShortNamer
in the super class constructor. For the first object, some reflection is used to initialize it anyway, but this is not done for theKerberosShortNamer
. The result is that, if this principal builder is used on a broker that has a listener configured for Kerberos authentication, a null pointer exception is thrown here whenever a client tries to authenticate. Since my goal is to add an Oauth listener in-place to an existing Kafka cluster and then begin migrating clients from Kerberos to Oauth, this is a huge problem. As far as I know, there is no way to configure a principal builder for a single listener.This PR just uses the existing reflection mechanisms to instantiate the
KerberosShortNamer
in addition to theSslPrincipalMapper
, by recreating what Kafka does here and here.