Skip to content

Host * blocks overwritten in SSH config files, leading to disconnects #210

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

Closed
ericpaulsen opened this issue Feb 9, 2024 · 1 comment
Closed

Comments

@ericpaulsen
Copy link
Member

ericpaulsen commented Feb 9, 2024

a large customer identified an issue where our VS Code extension overwrites Host * entries in SSH configs, instead of respecting them (coder config-ssh does this here).

There's a Host * block in our default SSH config and the VSCode plugin was putting it's blocks after those. It seemed as those even after moving the blocks around, the plugin would remove the blocks and place them at the end of the file.

We have a sample config file that includes empty comment markers for coder's config-ssh and VS Code blocks above a Host *. config-ssh obeys the placement but VS Code does not.

this line of code is where the Host * block is appended to the end of the config file: https://github.com/coder/vscode-coder/blob/main/src/sshConfig.ts#L188

the customer confirmed that commenting out the Host * block did resolve the issue.

First we tried just moving the Host * to the end of the file, but that got moved right back on the next connection. Eventually I just told them to comment out that block, which isn't ideal

@ericpaulsen ericpaulsen added the bug label Feb 9, 2024
@ericpaulsen
Copy link
Member Author

to compare, OpenSSH searches the file from top to bottom and uses the parameter from the first block that matches, so if there's a block earlier in the file that has a parameter that's also in the VSCode block, it'll use the earlier block's parameter:

Host *
  foo star

Host vscode
  foo vscode
  bar vscode

this shakes out to be {foo: star, bar: vscode}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants