-
Notifications
You must be signed in to change notification settings - Fork 177
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
okta-credential_process does not cache credentials #256
Comments
Thank you for the issue report, @llamahunter. I’m apprehensive about writing the cached credentials to the files as I think part of the goal of credential_process is avoiding that. For some reason I thought AWS CLI implemented caching based on the expiry a credential_process returned. I’m not sure why it wants expiry if it isn’t managing it. I’ll look into a secure way to cache credentials. |
Apparently, the 'current thinking' is that it's the responsibility of the program calling the aws sdk which then calls credentials_process. That program is supposed to implement its own persistent caching system. This seems kind of dumb to me, as it means the every implementation of some program that is deferring secure authentication to IAM/Okta/whatever is now responsible for managing the security of persistent tokens. Seems that this should be built in once, at a lower level, so that it isn't screwed up by every utility program. |
I have implemented credential caching for my use case in aws-iam-authenticator (will be submitting a pull request to them soon). So, fwiw, you can possibly ignore this issue. |
That’s fantastic. Thank you, @llamahunter! I’ll test your aws-iam-authenticator change and consider updating docs here to recommend it as a caching solution once merged. |
I think aws-iam-authenticator is kind of kubernetes specific, so probably not generally useful. Anyway, this is why I think the caching should actually be dealt with down in the aws-sdk-go or, maybe, the credential_process provider. Now that I've dug into it, I think the credential_process may be too low, as the aws-sdk does not seem to consult it if there are already expired credentials available. So, aws-sdk is probably the right place, but they say every application implemented on top of them should do their own caching. ¯\_(ツ)_/¯ |
Good to know. Thank you. I've had some significant frustration and disappointment with credential_process myself. I wound up writing shell wrappers using withokta and OKTA_ENV_MODE instead as it worked the way I wanted. I think I may have to put a caveat in the readme about these limitations of credential_process. |
I've run into a similar performance issue, but not with
I don't understand why there is such a stark difference. I thought that |
So, in my case,
So perhaps this should be a new issue altogether? For reference, here is my Python script:
So it seems like there is a performance issue in
|
Seems like a different issue at this point. More of a 'why is okta saml so slow compared to a naive implementation'? |
Yeah, I think you're right. I'll open a new issue. I thought they might be related due to similar caching problems but I'm not really sure that is the case. Thanks. |
I did a bunch of fixes in this code. We do not use the MODE mentioned here or withOkta. For interim, I delegate to python. This is very inefficient with starting the python process Vs JVM. The caching works fine for us. We have this working fine with multiple users and accounts. |
Describe the bug
the okta-credential_process does not cache credentials, making it very slow on every invocation.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
On invocation of missing or expired credentials, okta-credential_process updates .aws/credentials with new temporary credentials like it does when running okta-aws. On subsequent calls to okta-credential_process, if the .aws/credentials are still unexpired, reuse them. Only refetch new credentials (updating .aws/credentials) when expired. Speeds up repeated usage by 10x.
Screenshots
N/A
Additional context
It appears the problem is due to conflation of OKTA_ENV_MODE to both control how the results are communicated via the environment and whether session reuse should be enabled. I think these are two different things. A bit of hacking in OktaAwsCliAssumeRole.doRequest() to comment out the if test of environment.oktaEnvMode around the call to profileHelper.createAwsProfile() seems to make it work 10x faster. (also, had to set OKTA_PROFILE=default). But, not sure of what else is going on. Seems the caller of credentials_process is smart about only calling it if there aren't unexpired credentials in ~/.aws/credentials.
The text was updated successfully, but these errors were encountered: