-
Notifications
You must be signed in to change notification settings - Fork 69
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
How to support the refresh of IAM credentials without recreating the Kafka consumer #122
Comments
Hi @j256, If you are using Kafka clients version 2.2.0 and above, the client re-authentication flow should force re-authentication before the IAM credentials expire when using the awsRoleArn mechanism. If you are using a version < 2.2.0, the server will force close the connection after session expiry. So, the behavior you are seeing seems weird. I would like to share a few pointers here.
For points 2 and 3, I am assuming you are using Kafka client versions 2.2.0 and above. Let us know if that's not the case.
Would it be possible for you to verify that the Kafka client session expiration you see in client debug logs is same as the IAM role's session expiration time?
Let us know if you any more help in debugging this. |
So sorry for the delay. Not sure why I didn't see your response until now.
Will do.
We are using 2.8.2.
I will look for these debug messages.
Ok. I'll look for that as well. Thanks much! |
We have been testing with 3.4.1 of kafka-clients. We are creating IAM keys with a 15 minute expiration and we see:
But at the end of the 15 minutes we still see:
This may be user error around the creation of the iAM credentials. We think we are creating the credentials using the |
How are these credentials used by the application? Do you intend to use these keys to assume the From what you shared, it seems like the credentials used to refresh the role credentials (by calling STS client) are getting expired. Can you also share your jaas.config properties ? |
Hi @sankalpbhatia, I have a use case where I need to assume role in another account and consume MSK continuously, will the above approach work there as well for cross account access? Also will the credentials will get automatically refreshed without me doing anything? And last question is, Currently I am using 1.1.5 version of aws-msk-iam-auth library and it needs me to save the credentials in System properties and then the flow works fine, with the new version do I need to do STSAssumeRole or it's not even required with the awsRoleArn and the credentials will refresh automatically (Since I want to use other aws services from source account and when I set the credentials in System properties I fail to access the source resources)? |
Howdy. We are using the
aws-msk-iam-auth
jar with our Java Kafka components using the recommendedawsRoleArn
configurations for theIAMLoginModule
in thesasl.jaas.config
Kafka property which works initially but gets a "Topic authorization failed" error ("Not authorized to access topics") if the IAM credentials expire.Is there a way to have the configurations automatically refresh? Are we missing a configuration option so that this happens automagically?
Thanks.
The text was updated successfully, but these errors were encountered: