-
Notifications
You must be signed in to change notification settings - Fork 146
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 AWS IAM auth method #166
Conversation
The test error is due to testcontainers/testcontainers-java#3574. I just now noticed #126, which is for the EC2 metadata workflow. |
Authenticate to Vault using the AWS IAM auth method using credentials on the master. This works by constructing an encoded GetCallerIdentity request that's sent to Vault. Both a Credential and CASC SecretSource are supported using a common helper.
e5780b0
to
d6ca933
Compare
I rebased now that #168 is in and (should) fix the test issues. Other changes:
The rest is the same and I won't rebase anymore if there are review comments to address. |
Fix checkstyle issues
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 have no way of testing this, but the code looks good to me :)
Do you think this is ready?
I did test the |
I've tested this now both from 3 caveats I'd like to note, though:
|
@jetersen is it possible to merge this? I need it :) another question I have is @dbnicholson will this work with ECS and EKS aswell? |
I've never tried it from ECS or EKS, but it should work. I have used vault from a role attached to an ECS service and it works. This should work the same by using the session credentials, so if you find it doesn't I think that would be a bug. |
@jetersen any chance to get this merged? It's not critical path for me, but it would be nice to get it out in the world. |
@jetersen ping? |
Hi I see that this PR is merged but is not yet part of an official release. Is there a target date for the next version release that would include this change? |
Any idea when this will be available in a release? |
@agill17 it's been available for quite a while since: https://github.com/jenkinsci/hashicorp-vault-plugin/releases/tag/336.v182c0fbaaeb7 |
Thanks! |
It uses the controller's IAM credentials and role. It would defeat the purpose of having a Jenkins credential if the agent could authenticate to Vault and retrieve the secret. If you want to do that, just run the Vault CLI in your job with |
Authenticate to Vault using the AWS IAM auth method using credentials on
the master. This works by constructing an encoded GetCallerIdentity
request that's sent to Vault via bettercloud's
loginByAwsIam
method. Both a Credential and CASC SecretSourceare supported using a common helper.
Note that this explicitly uses the IAM flow and not the EC2 metadata flow. The latter could be added, but I've never used it and it would require persisting the nonce per instance ID somewhere. I started investigating but I think the IAM workflow is better since it encompasses both techniques by using the EC2 session credentials just like the EC2 flow does. That said, the Vault AWS auth method only supports one or the other, so if someone has configured their's to use the EC2 flow then this wouldn't help them.
There weren't any that I could find, but I'm happy to open one if needed.
None that I know of.