microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.55k stars 263 forks source link

Remote-SSH Not Working with PowerShell ProxyCommand #5919

Closed jtele2 closed 1 year ago

jtele2 commented 2 years ago

[10:07:02.219] Running script with connection command: ssh -T -D 54200 "i-*****.us-east-2" bash [10:07:02.222] Terminal shell path: C:\WINDOWS\System32\cmd.exe [10:07:02.554] > ]0;C:\WINDOWS\System32\cmd.exe [10:07:02.554] Got some output, clearing connection timeout [10:07:03.160] > kex_exchange_identification: Connection closed by remote host [10:07:03.182] > The process tried to write to a nonexistent pipe.


Steps to Reproduce:

1. Setup AWS SSM, connect via PowerShell. Here is the .ssh/config

Host i-.us-east-2 HostName i-.us-east-2
User ubuntu
ProxyCommand C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe "aws ssm start-session --target i-** --region us-east-2 --document-name AWS-StartSSHSession --parameters portNumber=%p"
IdentityFile "C:\Users\
.*\.pem"


2. Here's what lets me in (PowerShell): `ssh i-*****.us-east-2`
3. I try the same thing on VS Code Remote-SSH and I get the above error logs. 
tanhakabir commented 2 years ago

Unfortunately this is by design since we form ssh -T -D 54200 "i-*****.us-east-2" bash command with our install script to set up the connection.

To verify you need C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe "aws ssm start-session --target i-***** --region us-east-2 --document-name AWS-StartSSHSession --parameters portNumber=%p" to be run to connect to your remote?

jtele2 commented 2 years ago

@tanhakabir Yes that is correct. I'm connecting to an EC2 instance via the AWS Session Manager. The exact command works if I make a batch file to run Windows Subsystem for Linux, but not all our users can do that easily. Is there any way to run this ProxyCommand via PowerShell in VS Code?

Can the code after bash be run via PowerShell?

jtele2 commented 2 years ago

Essentially, I'm just trying to run the proxy command "aws ssm start-session --target i-***** --region us-east-2 --document-name AWS-StartSSHSession --parameters portNumber=%p" with Remote-SSH on Windows.

References: https://github.com/aws/aws-toolkit-vscode/issues/941 https://github.com/microsoft/vscode-remote-release/issues/937

VSCodeTriageBot commented 1 year ago

This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. More details here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding and happy coding!