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

Access denied for SSH_AUTH_SOCK #1449

Open
hellt opened this issue Dec 5, 2024 · 2 comments
Open

Access denied for SSH_AUTH_SOCK #1449

hellt opened this issue Dec 5, 2024 · 2 comments
Labels

Comments

@hellt
Copy link

hellt commented Dec 5, 2024

What happened?

I am using devpod on macOS where docker is provided by OrbStack. When I launch my devpod with using local VSCode as an IDE, the application that I run in my container reports that it does not have permission to dial the SSH_AUTH_SOCK socket.

WARN[0000] failed to open SSH_AUTH_SOCK: dial unix /tmp/vscode-ssh-auth-sock-386236167: connect: permission denied 

My app runs as root.

The socket is correctly mapped to a path available to a sudo user:

❯ file /tmp/vscode-ssh-auth-sock-386236167                                       
/tmp/vscode-ssh-auth-sock-386236167: symbolic link to /tmp/auth-agent1151507429/listener.sock

❯ ls -la /tmp/vscode-ssh-auth-sock-386236167                                   
lrwxrwxrwx 1 vscode vscode 39 Dec  5 14:25 /tmp/vscode-ssh-auth-sock-386236167 -> /tmp/auth-agent1151507429/listener.sock

❯ ls -la /tmp/auth-agent1151507429/listener.sock                                   
srwxr-xr-x 1 vscode vscode 0 Dec  5 14:25 /tmp/auth-agent1151507429/listener.sock

❯ file /tmp/auth-agent1151507429/listener.sock                                   
/tmp/auth-agent1151507429/listener.sock: socket

I can not quite figure out why my app can not access to the SSH_AUTH_SOCK unix socket... Everything works fine when I run the devcontainer from VSCode direcly (without devpo)

Another demonstration of this socket not being accesible to a root user is:

❯ whoami
vscode

❯ ssh-add -l
4096 SHA256:abc somekey (RSA)

❯ sudo su
root ➜ .../default/workspaces/srl-acl-lab/content (main) $ ssh-add -l
Error connecting to agent: Permission denied

What did you expect to happen instead?

The SSH_AUTH_SOCK is accessible.

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

My devcontainer.json:

{
    "image": "ghcr.io/srl-labs/containerlab/devcontainer-dood-slim:0.60.0-rc1",
    "runArgs": [
        "--network=host",
        "--pid=host",
        "--privileged"
    ],
    "mounts": [
        "type=bind,src=/run/docker/netns,dst=/run/docker/netns",
        "type=bind,src=/var/lib/docker,dst=/var/lib/docker",
        "type=bind,src=/lib/modules,dst=/lib/modules"
    ],
    "workspaceFolder": "${localWorkspaceFolder}",
    "workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind"
}

Local Environment:

  • DevPod Version: 0.6.3
  • Operating System: mac
  • ARCH of the OS: ARM64

DevPod Provider:

  • Local/remote provider: docker via orbstack
@pascalbreuninger
Copy link
Member

Hey @hellt, it looks like VSCodes setting remote.SSH.enableAgentForwarding conflicts with DevPods agent fowrarding.
I'll keep this issue open to investigate further but the short term fix is to disable the VSCode setting

@hellt
Copy link
Author

hellt commented Dec 17, 2024

Hey @hellt, it looks like VSCodes setting remote.SSH.enableAgentForwarding conflicts with DevPods agent fowrarding.

I'll keep this issue open to investigate further but the short term fix is to disable the VSCode setting

Noted, thanks Pascal. Unfortunately to apply the workaround I will have to create a separate devcontainer json as I don't want to lose the ssh forwarding config when the devcontainer is launched as a native vscode devcontainer.

Would be great to solve this in a streamlined way

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

No branches or pull requests

2 participants