-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
CLI v2 ecs execute-command does not support SSO Session profiles #7902
Comments
I have the same problem. |
Thanks for reaching out. @diegomosela which AWS CLI version are you using? Is this something that was working for you and @cupakromer before updating to a newer version of the AWS CLI? This may just be a limitation in the session manager plugin as reported here: aws/session-manager-plugin#58. |
@tim-finnigan I do not see the same issue using the session manager directly. It connects just fine using the SSO profile. $ session-manager-plugin --version
1.2.463.0
$ aws sso login --profile my-sso-profile
Attempting to automatically open the SSO authorization page...
...
$ aws ssm start-session --profile my-sso-profile --target ecs:my-ecs-cluster_redacted_redacted-123456
Starting session with SessionId: [email protected]
# |
@cupakromer I saw the original error you reported here in re:Post: https://repost.aws/questions/QUnv5hnNAXTeCRICHYRsDbJA/failing-in-kms-handshake. Can you validate your configuration per the documentation referenced there? |
Greetings! It looks like this issue hasn’t been active in longer than five days. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one. |
@tim-finnigan thank you for that link, unfortunately it's for a different error. The very end of the error messages are different and point to different issues. My error:
Error from linked repost:
Further, as noted in the main description the error occurs when using SSO token provider configuration and the CLI process succeeds when using legacy non-refreshable configuration. |
Just encountered the same thing:
Executing |
Having the issue on MacOS:
|
It looks like everyone is using 1.2.463.0, maybe there was a recent change in that release causing this? If someone wants to try rolling back their version they could rule that out. I also reached out to the session manager team for more info and currently waiting to hear back. |
Rolled back to 1.2.398.0 from https://s3.amazonaws.com/session-manager-downloads/plugin/1.2.398.0/ubuntu_64bit/session-manager-plugin.deb works fine, so yep looks like the latest release broke it. Nice spot @tim-finnigan |
wait scratch that, it's not working (I forgot to switch to SSO). Same problem ----------ERROR------- session-manager-plugin --version |
I'm experiencing the same issue across multiple environments: a clean Ubuntu 18.04, Windows 10, and WSL2. In each case, I encounter the following error when trying to start a session using AWS CLI: ----------ERROR-------
Encountered error while initiating handshake. KMSEncryption failed on client with status 2 error: Failed to process action KMSEncryption: Error calling KMS GenerateDataKey API: SSOProviderInvalidToken: the SSO session has expired or is invalid
caused by: open /home/user/.aws/sso/cache/058a9705fcdfbb9d98609a30f295c69b3034e687.json: no such file or directory Here are the versions of session-manager-plugin and AWS CLI I'm using: $ session-manager-plugin --version
1.2.463.0
$ aws --version
aws-cli/2.13.5 Python/3.11.4 Linux/5.4.0-150-generic exe/x86_64.ubuntu.18 prompt/off also tried with
I've attempted to resolve the issue by refreshing the SSO login and verifying the SSO configuration, but the problem persists. If anyone has encountered this issue and found a workaround, your insights would be greatly appreciated. |
@boskowski The workaround I am using is to configure a profile using only the legacy non-refreshable configuration and use that for the command. I have two separate profiles configured, one using that legacy non-refreshable configuration structure which I use just for this command and another using the newer SSO token provider configuration which I use for pretty much everything else. |
It looks like another session-manager-plugin version was released (1.2.497.0): https://docs.aws.amazon.com/systems-manager/latest/userguide/plugin-version-history.html. If anyone is still encountering issues reported here after upgrading then I recommend creating an issue in this repo for further tracking: https://github.com/aws/session-manager-plugin/issues |
It works for me with the latest version session-manager-plugin --version |
Thanks @rwky3gtelecoms for letting us know! I'll go ahead and close this issue. |
|
Describe the bug
ecs execute-command
does not support SSO session based profiles. Attempting to use the command results in either a missing configuration error or a missing cache file error.Missing Configuration Error
SessionId: ecs-execute-command-0123456789 : ----------ERROR------- Encountered error while initiating handshake. KMSEncryption failed on client with status 2 error: Failed to process action KMSEncryption: error while creating new KMS service, Error creating new aws sdk session profile "my-sso-profile" is configured to use SSO but is missing required configuration: sso_region, sso_start_urlMissing Cache File Error
SessionId: ecs-execute-command-0123456789 : ----------ERROR------- Encountered error while initiating handshake. KMSEncryption failed on client with status 2 error: Failed to process action KMSEncryption: Error calling KMS GenerateDataKey API: SSOProviderInvalidToken: the SSO session has expired or is invalid caused by: open /Users/me/.aws/sso/cache/a00fce5cb007c23a469c136160398db65edcb180.json: no such file or directoryExpected Behavior
Running the
aws ecs execute-command
should behave like other CLI commands and work with non-legacy SSO profiles.Current Behavior
Many AWS CLI commands work just fine with the SSO session based profiles:
Attempting to use the same profile with
ecs execute-command
fails:If the listed missing configuration parameters are added, then the error changes to:
Switching to a previously configured legacy version of the profile allows
ecs execute-command
to run successfully:Reproduction Steps
Start with the following configuration:
Login to the non-legacy SSO profile. Then using that profile, list the available task ARNs, pick one and run
execute-command
:Manually edit the
~/.aws/config
file to add the reported missing configuration parameters:Sign out then sign back into the profile and re-run the same
ecs execute-command
:Possible Solution
No response
Additional Information/Context
It appears the cache files generated by the SSO session profile and the legacy profile are using different values to generate the cache key.
The SSO session profile generates the cache key from the session name while the legacy profile has the cache key generated from the URL:
The problematic
ecs execute-command
appears to ignore thesso_session
configuration in the SSO profile and is looking for justsso_url
; possibly why it complains about the missing configurations. When bothsso_session
andsso_url
are present, theaws sso login
gives higher precedence to thesso_session
and uses that for the cache key which appears to be why after adding the "missing configuration" theecs execute-command
still fails, but now with a missing cache error.CLI version used
aws-cli/2.11.20 Python/3.11.3 Darwin/22.4.0 source/arm64 prompt/off
Environment details (OS name and version, etc.)
macOS 13.3.1
The text was updated successfully, but these errors were encountered: