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

Workspace entries in SSH client config file inserted in incorrect location WITHIN an existing SSH host entry #1635

Open
zombiemaker opened this issue Feb 10, 2025 · 2 comments

Comments

@zombiemaker
Copy link

What happened?
When creating a new DevPod workspace (using Kubernetes provider), a new record is added to the $HOME/.ssh/config file for the workspace connection. However, the new record is inserted in the middle of the first pre-existing SSH config record. This breaks the configuration of the pre-existing record. Example:

PRE-CHANGE STATE

Match Host a-sshd-hostname User ssh-username
  Hostname a-sshd-hostname
  User ssh-username
  ....

POST-CHANGE STATE

Match Host a-sshd-hostname User ssh-username
# DevPod Start test-8.devpod
Host test-8.devpod
  ForwardAgent yes
  LogLevel error
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null
  HostKeyAlgorithms rsa-sha2-256,rsa-sha2-512,ssh-rsa
  ProxyCommand "C:\Program Files\DevPod\devpod-cli.exe" ssh --stdio --context default --user root test-8
  User root
# DevPod End test-8.devpod
  Hostname a-sshd-hostname
  User ssh-username
  ....

What did you expect to happen instead?
Insert the new SSH connection configuration record either before or after all existing entries:

# DevPod Start test-8.devpod
Host test-8.devpod
  ForwardAgent yes
  LogLevel error
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null
  HostKeyAlgorithms rsa-sha2-256,rsa-sha2-512,ssh-rsa
  ProxyCommand "C:\Program Files\DevPod\devpod-cli.exe" ssh --stdio --context default --user root test-8
  User root
# DevPod End test-8.devpod
Match Host a-sshd-hostname User ssh-username
  Hostname a-sshd-hostname
  User ssh-username
  ....

OR

Match Host a-sshd-hostname User ssh-username
  Hostname a-sshd-hostname
  User ssh-username
  ....
# DevPod Start test-8.devpod
Host test-8.devpod
  ForwardAgent yes
  LogLevel error
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null
  HostKeyAlgorithms rsa-sha2-256,rsa-sha2-512,ssh-rsa
  ProxyCommand "C:\Program Files\DevPod\devpod-cli.exe" ssh --stdio --context default --user root test-8
  User root
# DevPod End test-8.devpod

How can we reproduce the bug? (as minimally and precisely as possible)

My devcontainer.json:

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/rust
{
	"name": "Rust",
	// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
	"image": "mcr.microsoft.com/devcontainers/rust:1-1-bullseye",

	// Features to add to the dev container. More info: https://containers.dev/features.
	// "features": {},

	// Configure tool-specific properties.
	"customizations": {
		// Configure properties specific to VS Code.
		"vscode": {
			"settings": {},
			"extensions": [
				"streetsidesoftware.code-spell-checker"
			]
		}
	}

	// Use 'forwardPorts' to make a list of ports inside the container available locally.
	// "forwardPorts": [],

	// Use 'postCreateCommand' to run commands after the container is created.
	// "postCreateCommand": "rustc --version",

	// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
	// "remoteUser": "root"
}

Local Environment:

  • DevPod Version: v0.6.11
  • Operating System: windows
  • ARCH of the OS: AMD64

DevPod Provider:

  • Kubernetes Provider: Client Version = v1.32.1; Kustomize Version = v5.5.0; Server Version: v1.32.1

Anything else we need to know?

@pascalbreuninger
Copy link
Member

Hey @zombiemaker, thanks for reporting this issue - we're going to take a look

@zombiemaker
Copy link
Author

zombiemaker commented Feb 11, 2025 via email

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

No branches or pull requests

2 participants