Skip to content

Feature: coder config-ssh to add "Include coder/config" to ~/.ssh/config #12390

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

Open
michaelbrewer opened this issue Mar 2, 2024 · 4 comments
Labels
cli Area: CLI

Comments

@michaelbrewer
Copy link
Contributor

michaelbrewer commented Mar 2, 2024

By default coder config-ssh writes to ~/.ssh/config, the problem is that many other tools also writes there and ends up being quite messy.

Ideally it should edit a separate file like ~/.ssh/coder/config and then have an "Include" to point to

## START CODER INTEGRATION
Include "coder/config"
## END CODER INTEGRATION

Alternatives

Currently you can use --ssh-config-file

coder config-ssh --ssh-config-file ~/.ssh/coder-config

But then you can use this config file or update ~/.ssh/config

ssh -F ~/.ssh/coder/config coder.test

So having a convenience command line option to add the missing "Include" to ~/.ssh/config

@coder-labeler coder-labeler bot added cli Area: CLI feature labels Mar 2, 2024
@kylecarbs
Copy link
Member

Good idea! It's a nice idea to be able to ssh -F, and that way it could be excluded from the global scope if desired.

@michaelbrewer
Copy link
Contributor Author

Right less things to debug when your local config just polluted by conflicting settings.

@stirby
Copy link
Collaborator

stirby commented May 31, 2024

I'm slotting this in next sprint, related to Coder config storage in the CLI so linking #13325.

@mafredri
Copy link
Member

mafredri commented Jul 9, 2024

We went down the path of using Include at one point which caused issues with certain tools. For the best compatibility, we should retain the current behavior IMO.

Personally I use something along the lines of this:

# ~/.ssh/config
Include coder-*

# ~/.zshrc
coder_deployment() {
    deployment=$1
    export CODER_CONFIG_DIR="$HOME/Library/Application Support/coderv2-${deployment}"
    export CODER_SSH_CONFIG_FILE="$HOME/.ssh/coder-${deployment}"
}

An important detail is also the placement of the Include, most likely it needs to be at the top of the file, and also moveable by the user. I'm not entirely opposed to adding an option to automatically add the Include, though, but it adds a bit of additional complexity we need to handle (granted, in a similar manner we already handle the config).

@matifali matifali removed the feature label Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Area: CLI
Projects
None yet
Development

No branches or pull requests

5 participants