-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Vault - AWS IAM/EC2 Auth- GovCloud #6631
Comments
The URL it's attempting to access is https://sts.amazonaws.com and default to us-east-1 |
Hi @marcuschaney -- a couple things going on here. First, you mention the AWS Secrets Engine, but it looks like you're actually trying to use the AWS auth method, correct? Assuming that's the case, you need to set the Third, you need to ensure the Vault client CLI is configured to send login data for the correct AWS region. This is a bit... tricky. I think that GovCloud operates a bit differently than the AWS standard partition when it comes to STS, but it's hard for me to verify that personally. I suggest you try running |
@joelthompson Awesome, thank you so much! After exporting the region (even though it was set in AWS configure), my colleague was able to successfully generate an auth token. So he is unblocked! For me, I assume the resolution would be similar? I'm actually trying to utilize the Secrets Engine. Will test that this afternoon. |
Great! Unfortunately you're running into one of the maddening inconsistencies between the different languages' SDKs. I think that you could also set the
I'm not as familiar with the AWS Secrets Engine as I am with the auth method. I think configuring the region as you mentioned should just work as you expected, but if not, you may also need to configure the |
@joelthompson looking good with the aws auth in GovCloud! I actually don't need to use the AWS Secret engine, that was just miscommunication with management. So now that I'm working in GovCloud, I've run into an odd issue in a different partition. After doing the AWS_REGION=us-test-east-1 export and writing the STS, IAM and EC2 endpoints to auth/aws/config/client, I still receive the below error: "unable to resolve partition "aws-test-b" (which is oddly how the ARNs are identified is this partition) to a region. Any ideas? |
Hi @marcuschaney -- I know why Vault is doing that, but I'm a bit confused as to why you have ARNs with a partition of Basically, you're running into this bit of code that was intended to try to support GovCloud and the China partition, hopefully the comment explains what was going on: vault/builtin/credential/aws/backend.go Lines 221 to 235 in 4cba25c
In order for it to work, you need to have a partition that's known to the AWS golang SDK. According to https://docs.aws.amazon.com/govcloud-us/latest/ug-west/using-govcloud-arns.html GovCloud ARNs should have a partition of |
Hey, thanks for the response! So this is actually a classified partition, that’s why I submitted the name with “test”. But yeah, isn’t odd that the partition is prefixed with “aws” but the actual region is prefixed with “us”. This environment is always a pain, so I figure I’ll have to implement some kind of workaround. I can successfully curl the STS and IAM endpoints, but when Vault calls IAM for the role, it comes back with that error. |
@joelthompson so I guess I can actually divulge the partition and region. Please see below: aws-iso-b is the partition and the region is us-isob-east-1 |
@joelthompson RESOLVED! So, instead of specifying IAM Principal like below: vault write auth/aws/role/feds-role-iam I specified IAM Instance Profile instead, then inferred EC2 instance type along with the relevant region. vault write auth/aws/role/feds-role-iam |
@joelthompson so I got passed that just to run into the 403 error from STS attempting to reach us-east-1, even after doing "export AWS_REGION=us-isob-east-1. Also, I ensure that was set via "aws configure". I saw here that fix was implemented to specify region at login, what version was that implemented in? I'm running v1.0.1 |
Hi @marcuschaney -- I don't believe that fix has made it into a Vault release yet. Anyway, some general thoughts:
I'll try to think some more about how best to support this kind of use case. |
Hey @joelthompson I've decided to go the EC2 auth path, which doesn't required the STS call. Now, I'm getting a "500 Internal Server Error" when attempting to do the following: pkcs7=$(curl -s curl --request POST Same when I go directly to the server IP via port 8200. |
@joelthompson trying the workaround you mentioned here: #4014 $ vault write auth/aws/login identity=$(curl -s http://169.254.169.254/latest/dynamic/instance-identity/document | base64 -w 0) signature=$(curl -s http://169.254.169.254/latest/dynamic/instance-identity/signature | tr -d '\n') role=<ROLE_NAME> I now get the below error: This integration is kicking my butt! I appreciate all your help! |
Hey @marcuschaney -- just a heads up, you might run into similar issues when Vault tries to make AWS EC2 API calls to validate that the instance is real. Anyway, in this case, you need to teach Vault about the certificate that it should use to verify the signature, as described at https://www.vaultproject.io/docs/auth/aws.html#varying-public-certificates -- you'll likely need to talk to your AWS support contacts to get the public key. |
Also, just thinking a bit outside the box, does AWS provide SDKs for the classified region? If so, maybe you'll have better luck just forking Vault and swapping out the AWS golang SDK with the alternate SDK? |
@joelthompson Perfect, thank you for that info! I'll reach out to support for the cert. Also, I'll inquire about the SDKs for that region, but I know we've encountered issues dealing with SDKs up there before. I'll update accordingly. Thanks! |
@joelthompson was able to get the cert from AWS! Have you ever seen this error when attempting to write to Vault's certificate directory: Code 500. Errors: 1 error occurred: I've tried this without the "---Begin" etc, and without that. Looking at the documentation, it just shows the cert without the "Begin" and "End"; however, I still get this funky error. I'm trying "vault write auth/aws/config/certificate/awspublic aws_public_cert=awspublic |
Hi @marcuschaney -- actually, you need to base64-encode the certificate (including the beginning "-----BEGIN..." and ending "-----END..." lines). If you look at the docs (https://www.vaultproject.io/api/auth/aws/index.html#sample-payload-2) they show a sample payload of When base64-decoded, that becomes:
|
@joelthompson Awesome, that did it!! Thank you so much for all your assistance! I was able to successfully add the cert (even though curl -v showed "no content" during the PUT). I was able to verify by doing: curl Which returned the decoded version of the certificate along with a request ID. |
All,
Has anyone experienced issues when attempting to generate credentials via Vault's "AWS Secrets Engine" for GovCloud? We're attempting to follow the documentation, but it seems to be an issue with the Region/Endpoints. https://www.vaultproject.io/docs/secrets/aws/index.html
The errors we receive are below:
vault login -method=aws role=test-role-iam
Error authenticating: Error making API request.
URL: PUT http://XXXXXXXX:8200/v1/auth/aws/login
Code: 400. Errors:
Sender
SignatureDoesNotMatch
Credential should be scoped to a valid region, not 'us-east-1'.
XXXXXXXXXXXX
Also, we noticed that there isn't a drop down selection in the GUI for "us-gov-west-1", so is this even being read when we pass in the following argument "vault write aws/config/root \ region=us-gov-west-1" ?
The text was updated successfully, but these errors were encountered: