loft-sh / devpod

Codespaces but open-source, client-only and unopinionated: Works with any IDE and lets you use any cloud, kubernetes or just localhost docker.
https://devpod.sh
Mozilla Public License 2.0
8.5k stars 313 forks source link

ssh config readonly breaks application #405

Closed shyim closed 1 year ago

shyim commented 1 year ago

What happened?

My .ssh/config is readonly and devpod seems to try to write there

What did you expect to happen instead?

don't touch my ssh config :)

Local Environment:

DevPod Provider:

Anything else we need to know?

89luca89 commented 1 year ago

Hi @shyim

The ~/.ssh/config is used to add/remove snippets to easily ssh into your workspaces, for example:

# DevPod Start test1.devpod
Host test1.devpod
  ForwardAgent yes
  LogLevel error
  IdentityFile "/home/luca-linux/.devpod/keys/id_devpod_rsa"
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null
  IdentitiesOnly yes
  ProxyCommand /home/luca-linux/Projects/loft/devpod/devpod ssh --stdio --context default --user vscode test1
  User vscode

Those are cleaned when using devpod delete $workspace_name

shyim commented 1 year ago

That file is readonly in my system as I use home-manager.

Maybe create a folder in .ssh/devpods and create there your file and try to add a Include .ssh/devpods/* into main .ssh/config and refer to docs if it's not possible to adjust .ssh/config

shyim commented 1 year ago

I am thinking about to make a PR to address this. What is your preferred way:

execat commented 1 year ago

Agreed, another home-manager user here.

If the file is readonly, then the error message can dump the settings that need to be added with a failure saying "these settings have to be in ~/.ssh/config before being able to use DevPod".

@shyim Are you working on this? Need help?

Code for reference: https://github.com/loft-sh/devpod/blob/784c84b783c0d580068d9dd0009c120272c282d3/pkg/ssh/config.go#L134

shyim commented 1 year ago

I don't looked into it as nobody answered

89luca89 commented 1 year ago

Hi all, sorry for the late reply

This PR https://github.com/loft-sh/devpod/pull/449

Merged the possibility of either disabling the automatic ssh config, or changing the ssh config path:

devpod up --configure-ssh=false

or

devpod up --ssh-config=/path/to/custom/file

This should solve your issue

shyim commented 1 year ago

Can I configure this to a fixed location using config? 🤔