devpod icon indicating copy to clipboard operation
devpod copied to clipboard

ssh config readonly breaks application

Open shyim opened this issue 2 years ago • 3 comments

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 Version: v0.1.9
  • Operating System: linux
  • ARCH of the OS: ARM64

DevPod Provider:

  • Cloud Provider: google | aws | azure | digitalOcean
  • Kubernetes Provider: [use kubectl version]
  • Local/remote provider: docker | ssh
  • Custom provider: provide imported provider.yaml config file

Anything else we need to know?

shyim avatar Jun 21 '23 07:06 shyim

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

89luca89 avatar Jun 21 '23 10:06 89luca89

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 avatar Jun 21 '23 10:06 shyim

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

  • We add an config to change the file location
    • So the user could change to ~/.ssh/devpod and add an Include devpod in his main config
  • We write into ~/.ssh/devpod all entries and migrate from .ssh/config
    • We update only the ~/.ssh/config file when no Include devpod is in

shyim avatar Jun 22 '23 21:06 shyim

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

execat avatar Jul 19 '23 08:07 execat

I don't looked into it as nobody answered

shyim avatar Jul 19 '23 09:07 shyim

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

89luca89 avatar Jul 19 '23 09:07 89luca89

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

shyim avatar Jul 19 '23 09:07 shyim