Skip to content
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

"Remote - SSH" extension 0.66 doesn't respect RemoteCommand in SSH config #5814

Closed
likan999 opened this issue Nov 3, 2021 · 6 comments
Closed
Labels
info-needed Issue requires more information from poster ssh Issue in vscode-remote SSH

Comments

@likan999
Copy link

likan999 commented Nov 3, 2021

  • VSCode Version: 1.61.2
  • Local OS Version: OSX 12.0.1
  • Remote OS Version: Ubuntu 20.04.3
  • Remote Extension/Connection Type: SSH
  • Logs:

Steps to Reproduce:

  1. Add a host to .ssh/config with section RemoteCommand.
  2. Connect to the host using VSCode.
  3. One should expect RemoteCommand is used, but it wasn't. Before 0.66, it worked, but now it is not. This completely breaks my workflow.

Does this issue occur when you try this locally?: N/A - this is all about how SSH connection is made
Does this issue occur when you try this locally and all extensions are disabled?: N/A

@github-actions github-actions bot added the ssh Issue in vscode-remote SSH label Nov 3, 2021
@tanhakabir
Copy link

Hey @likan999 thanks for letting us know quickly. What does your config look like? And just as a sanity check are you able to connect to your host through terminal?

@tanhakabir tanhakabir added the info-needed Issue requires more information from poster label Nov 3, 2021
@likan999
Copy link
Author

likan999 commented Nov 7, 2021

My use case is to SSH into remote server and immediately enter toolbox, so the config is

Host xxx
  ....
  RemoteCommand toolbox run -T bash

By ssh to this host, it automatically enters the toolbox, which has all necessary development tools. In previous version 0.65.8, it works perfectly; now it ignores the RemoteCommand directive in ssh config.

I looked a little deeper into the cryptic extension.js of this extension (I don't think it is open source, isn't it?), all it is due to this piece of code:

i=await d.getConfigurationForHost(e),a=(null==n?void 0:n.quoteForShell)||!1;return["-T",...o,s,...w(i),...v(i),...await _(a,e,t),...S(e),y(e,a)].filter((e=>!!e))}function v(e){return e&&e.RemoteCommand?["-o","RemoteCommand=none"]:[]}

The logic here is if the configuration has RemoteCommand directive, it appends -o RemoteCommand=none to the ssh so force it ignore this directive.

In previous version this piece of code exists as well, but in my config, the RemoteCommand directive is in another config file, which is included using an Include directive, and my guess is in previous versions, it doesn't parse the included file, but in 0.66.0, it does, which causes -o RemoteCommand=none to be added and breaks my workflow.

This RemoteCommand is very useful, and I'm not the only one that needs it: see #4474. Please add it. I understand there is a concern RemoteCommand doesn't work in general, but there are cases it is needed, so why not add an option in preferences, namely "Allow RemoteCommand". By default it is false, which is the current behavior; when it is enabled, it will not append the -o RemoteCommand=none, and the description of the option could include a warning saying user needs to know what they are doing and things might break, users are on their own.

@tanhakabir
Copy link

Wow thank you for the detailed inspection! You're right that we are overriding RemoteCommand with none to force ssh to ignore it. The issue is if we allow RemoteCommand we won't be able run a script on your remote to install and start VS Code on your server.

For this reason we ignored RemoteCommand in #481 where we needed to silence. If you could upvote #4474 I can inspect this issue later this month.

Something I am confused about is how did RemoteCommand work for you before if we weren't including that host and you wouldn't have been able to connect to that host?

@tanhakabir
Copy link

Going to close this issue since it's a duplicate of #4474 by the way!

@mak3
Copy link

mak3 commented Dec 11, 2021

@tanhakabir Are you sure it's a duplicate?
OP said that problem started with 0.66. #4474 was opened in February, so long before 0.66

I didn't track extension version, but I configured RemoteCommand in April and I believe it was working a few months.

@tanhakabir
Copy link

@mak3 we overruled RemoteCommand to be none in this issue: #481 (comment)

I'm not sure when it was noticed or how often everyone keeps their extensions up to date so I can't say why it was only submitted in February but I'm confident this issue is a duplicate of that one.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster ssh Issue in vscode-remote SSH
Projects
None yet
Development

No branches or pull requests

3 participants