-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add kerberos support #1366
Add kerberos support #1366
Conversation
dd3b45e
to
c127e9b
Compare
Hi. I've just created my solution for kerberos auth, but I will be happy to test your solution (native is better than libsasl2 <3 ). |
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! It works. Dynamic SPN (for kafka cluster) should be supported. And of course error handling :) I will cancel my PR and I'm waiting for this to merge!
1d89026
to
eefdd51
Compare
@mieczkowski I did some changes, also handled errors, I'm starting in go and kafka, so accept suggestions WDYT? |
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.
Looks good (and it works with kafka cluster :) ). One missing return, one suggestion about config, and some missing error checks. We should always check and handle errors from external libraries, even if we are pretty sure that it will not happen ;)
gssapi_kerberos.go
Outdated
if err != nil { | ||
return err | ||
} | ||
krbAuth.client = krb5client.NewClientWithKeytab(krbAuth.config.Username, krbAuth.config.Realm, kt, cfg) |
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.
How about move loading kt and cfg into (c *Config) Validate()
? Keytab and KerberosConfig files should be validated in client creation, not in runtime
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 understand that could be semantically better but..
After thinking on this, I don't see the difference, now the (c *Config) Validate()
happens on the Open method, same as kerberos client creation (where the keytab parsing happens), same place where authentication happens.
Also, If I follow the same logic kerberos config validation, which happens when the kerberos client instance is created, I will need to move the kerberos client instantiation to (c *Config) Validate()
.
0bc673e
to
282954a
Compare
1862b42
to
3ec45e5
Compare
@mieczkowski @eapache @bai Could you review this one please? Thanks |
Any updates on this? Thanks |
Thanks for your contribution! |
@bai Is there a release planned soon to include this feature? |
Yp, I'll cut a release in the next few days. |
@bai Thanks! |
Hi @bai, any update on when a release will be cut? |
@rubenvp8510 I am trying to use kerberos authetication but getting error "wrong Token ID. Expected 0504, was 6030". |
@shriram1993 Could you please put information about your environment? version of kafka, how is it configured? how Kerberos is configured? I see similar errors on other libraries that relies on gokrb5 for handling Kerberos authentication messages colinmarc/hdfs#145 , I think it could be something related to encryption. Thanks. |
Kafka version: 0.11.03 The configuration set in krb5.conf |
How to support SASL_PLAINTEXT? |
@rubenvp8510 I have the same question. My Kerberos server is expecting security protocol 'SASL_PLAINTEXT' but there is no way to set same in configuration. Please suggest. cfg := sarama.NewConfig() |
@rubenvp8510 |
SASL_PLAINTEXT |
I'm going to start looking at how to implement SASL_PLAINTEXT support .@yzpnet @shriram1993 Could you provide me your kafka configuration? That would help a lot. I'm a little bit confused, In one comment I read "Kerberos server only supports SASL_PLAINTEXT." but as far as I know the problem is not in the communication with the KDC but with Kafka I'm assuming that the implementation needs to support Kafka SASL_PLAINTEXT + Kerberos. correct me if I misunderstood please. Thank you! |
Kafka config: jaas-cache.conf: Krb5.conf: |
Yes!! You are right. The issue is not with KDC it is with Kafka. |
well, this should work with SASL_PLAINTEXT by default, I'm reviewing what would cause the error you are seeing. |
After reviewing this in detail, I was managed to reproduce the issue, it seems like the actual implementation of Kerberos authentication does not support rc4-hmac. The thing here is that the RFC-4121 (or at least the JAVA implementation) only support the use of aes128-cts-hmac-sha1-96 and aes256-cts-hmac-sha1-96 as a method for encrypt and integrity check for tkt and tgs. For work with rc4-hmac we would need to implement RFC-1964. So, I would say this should work if you configure your Active Directory[1] to support those encrypt types and your krb5.conf to use it (not sure but I think you need to regenerate your keytab files if you are using). You can also need to disable FAST negotiation, I'll send a PR to expose that option for sarama. Let me know if this works for you so I can close the corresponding issue. I'll test it and post my configs here. |
Hi again Confirmed that the issue is with rc4-hmac This is my configuration:
Followed the guide mentioned in my previous comment to configure AES encrypt types for my user accounts and regenerate keytabs for my services. I regenerated my keytabs using this command:
|
i don't need kerberos auth,how to disable it ,because i do not want download so many third-party library. |
Signed-off-by: Ruben Vargas ruben.vp8510@gmail.com
This is a pure go solution.