-
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
aws ec2-instance connect ssh
fails on Windows
#9114
Comments
Hi @fabiomoratti, thanks for reaching out. I wasn't able to reproduce the behavior you've described on CLI version 2.17.35. Could you provide full debug logs? You can get debug logs by adding |
Hello @RyanFitzSimmonsAK I confirm that version 2.17.35 is working as expected so I tried all 2.17.x version to see where the bug emerged (that is 18 versions..., I hope the effort is appreciated...):
As requested find below the output of the My guess is that between version 2.17.51 and version 2.17.52 the code to generate the temp key has changed and somehow does not sets the correct permission of the newly created temp key file. I also tried to find the code where the log "Generated temporary key file:" (line 53 in the attached file) is printed to inspect the coded there but I failed, maybe I was looking in the wrong place. Thank you for the kind assistance. ec2-instance-connect-out--2.17.55 (success).txt |
hi, i have the same behavior with the temp pem file that is too open, im using 2.22.14. if i downgrade to 2.17.35 its working well. @ WARNING: UNPROTECTED PRIVATE KEY FILE! @ |
Hey, thanks for following up. I was able to reproduce this behavior. While we look into this, you can specify your private key as a workaround. In my testing, using |
indeed its what i use too. |
Thanks for raising this issue with us. The root cause is that the generated key file inherits permissions from the directory created by Python's |
Describe the bug
On Windows, the following command
fails because of the (temporary) key file permissions.
Regression Issue
Expected Behavior
Connect to the remote instance.
Current Behavior
The complete error (with the user and instance id anonymized) is:
Note that, after the command fails, the key file (
private-key
) and its folder (C:\Users\XXXX\AppData\Local\Temp\tmp3cja4v_s
) are missing, I presume they are created "on the fly" by the command and then removed, so there is no (easy) way to examine the file and its permission.Reproduction Steps
Possible Solution
I suspect that the temporary private key created for the connection does not have the correct permissions.
The solution is to downgrade to a previous version of the CLI that does not present the regression.
Additional Information/Context
This appears to be a regression, version up to 2.17.0 work as expected, while versions 2.17.65, 2.18.0, 2.20.0 and 2.22.0 fail with the above error.
I did not check all the minor 2.17 versions, but apparently the regression appeared between 2.17.0 and 2.17.65.
CLI version used
aws-cli/2.17.65 Python/3.12.6 Windows/11 exe/AMD64
Environment details (OS name and version, etc.)
Windows 11 Pro, version 23H2 - OS Build 22631.4460
The text was updated successfully, but these errors were encountered: