-
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
Fix tsh aws ecr
Internal Server Error
#10475
Conversation
tsh aws ecr
error: AWS endpoints ID vs service name mapping
tsh aws ecr
error: AWS endpoints ID vs service name mappingtsh aws ecr
Internal Server Error
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.
The fix LGTM , though as you mentioned this is not comprehensive solution. For example right now the streams.dynamodb
aws API endpoint is not properly resolved because the service name for dynamo db is still dynamodDB and there is no easy way to distinguish where request should be forwarded.
I was thinking about how right now the aws proxy is implemented and maybe the current solution can be improved.
For example right now we are using --enbpoint-url
aws cli flag that overwrite the AWS api and API url needs to be reconstructed from metadata included in Credential header.
Not sure but it seems that aws cli access the solution with PROXY_HTTPS can be leverages where HTTPS header is not modify and HTTPS proxy adds the Destination URL to Headers allowing teleport app service to reconstruct the real AWS
URL endpoint picked by aws tool.
So our AWS ALPN proxy will behave like MITM proxy where request is modified and additional metadata are added designation URL in moved to header and real URL is replace with teleport proxy address. The connection can be TLS terminated with a cert generated on the fly based on clientHello.ServerName
field
This approach will also simplify integration external aws client like terraform.
For sure this approach should be not related to this PR and discussed separately as AWS CLI access improvement.
@r0mant @greedy52 What do you think about HTTPS_PROXY approach ?
@smallinsky I've thought about HTTPS proxy. I think it will definitely make this case easier as there will be no need for endpoint "resolution". But it has its own problems with my understanding how HTTP/HTTPS_PROXY works
I'd love to do a prototype on this and see how things work out. Maybe separately from this bug fix? If it works, server probably can support both mode (just an additional header check i guess) alternatively, someone suggested instead of proxying, we can just call AssumeRole to get a temporary token for client to use directly. |
As discussed, I will try out the |
Friendly ping @gabrielcorado @jimbishopp. Thanks! |
Fix #10467
Background/Problem
[aws cli/tsh client] -> [aws local proxy] -> [teleport app service] -> [aws]
Each AWS service has its own service endpoints/hostnames. Since the AWS client (e.g aws cli) has to send the request to our proxies by overriding
endpoint-url
, we loose which endpoint it suppose to send to.To compensate that, the app service uses the service name and region info, found in the auth header, to resolve the real AWS endpoint. We currently call
aws-sdk-go
'sEndpointFor
for this.However,
SigningName
(e.g.ecr
), sometimes, can be different from theEndpointsID
(e.g.api.ecr
), which is the key used insideEndpointFor
call.EndpointFor
does not support all AWS services, by default.SigningName
, but they use different endpionts/hostnamesChanges
SigningName
back toEndpointsID
ResolveUnknownService
Testing
Try
tsh aws
with different services.