You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(ec2): avoid wiping authorized_keys files on each connection (#6197)
## Problem
Each EC2 remote vscode connection wipes the remote
`.ssh/authorized_keys` file as a preventative measure to leaving stale
keys there. However, we can do better by adding comments to the keys we
add to this file, then selectively removing those keys on subsequent
connections.
## Solution
- Whenever we send keys to the instance, use `sed` to wipe all of the
keys added by us.
- determine keys added by us using a hint comment
`#AWSToolkitForVSCode`.
---
- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
---------
Co-authored-by: Justin M. Keyes <[email protected]>
Copy file name to clipboardExpand all lines: docs/arch_features.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,9 +41,11 @@ For connecting a new VSCode _terminal_, remote connect works like this:
41
41
42
42
For EC2 specifically, there are a few additional steps:
43
43
44
+
1. Remote window connections are only supported for EC2 instances running a linux based OS such as Amazon Linux or Ubuntu. However, the terminal option is supported by all OS, and will open a Powershell-based terminal for Windows instances.
44
45
1. If connecting to EC2 instance via remote window, the toolkit generates temporary SSH keys (30 second lifetime), with the public key sent to the remote instance.
45
46
- Key type is ed25519 if supported, or RSA otherwise.
46
-
- This connection will overwrite the `.ssh/authorized_keys` file on the remote machine with each connection.
47
+
- Lines in `.ssh/authorized_keys` marked with the comment `#AWSToolkitForVSCode` will be removed by AWS Toolkit.
48
+
- Assumes `.sss/authorized_keys` can be found under `/home/ec2-user/` on Amazon Linux and `/home/ubuntu/` on Ubuntu.
47
49
1. If insufficient permissions are detected on the attached IAM role, toolkit will prompt to add an inline policy with the necessary actions.
48
50
1. If SSM sessions remain open after closing the window/terminal, the toolkit will terminate them on-shutdown, or when starting another session to the same instance.
0 commit comments