#What's the proper way of using SSH agent forwarding (on windows)?

1 messages · Page 1 of 1 (latest)

fossil venture
#

Is it possible to make ssh forwarding work on windows (with git bash)? I've followed this post https://stackoverflow.com/questions/18404272/running-ssh-agent-when-starting-git-bash-on-windows to start ssh-agent.

I'm passing the socket to the dagger function like so --ssh-sock=$SSH_AUTH_SOCK

In the function:

@function
def base(
    self,
    ssh_sock: dagger.Socket | None,
) -> dagger.Container:
  ...
  if ssh_sock:
      ctr = ctr.with_unix_socket("/tmp/ssh.sock", ssh_sock).with_env_variable(
          "SSH_AUTH_SOCK", "/tmp/ssh.sock"
      )
  ...

This is currently failing with :

Stderr:
╭─ Error ──────────────────────────────────────────────────────────────────────╮
│ Function execution error: resolve: InvalidArgument: InvalidArgument: rpc     │
│ error: code = InvalidArgument desc = not a socket:                           │
│ /Users/home/AppData/Local/Temp/ssh-6rlotH3uqLgZ/agent.5346                   │
│ Stdout:                                                                      │

Is it possible ? or is there a workaround ?

still juniper
#

Mmmm I am not a Windows expert, so I can't answer the Windows-specific part of the question. But what you're doing seems correct on the Dagger side.

fossil venture
#

ok, now trying to use WSL to remove the windows part. Now, my socket somehow does not get created into the container.

root@buildkitsandbox:/src# echo $SSH_AUTH_SOCK
/tmp/ssh.sock
root@buildkitsandbox:/src# ls -l  $SSH_AUTH_SOCK
ls: cannot access '/tmp/ssh.sock': No such file or directory

code used is here
https://github.com/mxdev88/daggerverse/blob/main/scrapyd/src/main/__init__.py#L36

any idea what I'm doing wrong?

proven marten
#

by any chance could you share a Dagger Cloud trace to investigate further?

fossil venture
#

would local trace work too? (I've setup my Dagger Cloud account with my google account but docker login seems to only accept github login and fails with the Cloud Account Linking process with error "There could be a misconfiguration in the system or a service outage." I now get "500 Error retrieving user data" while trying to access my Dagger Cloud).

fossil venture
#

I've solved my ssh issue in WSL. (Posting my steps here in case in helps someone else).

I had to :

  1. restart a new shell
  2. restart the agent with eval $(ssh-agent -s)
  3. add the private key to the agent with ssh-add ~/.ssh/my-key
  4. disable known_hosts for Git SSH by adding GIT_SSH_COMMAND='ssh -o StrictHostKeyChecking=no' (no sure if there is a better way)

will test further if able to make it work from a standard windows shell.

proven marten
#

thx for reporting this back. I'm checking what's happening with your Dagger Cloud account.

proven marten
#

🙏

proven marten
#

@fossil venture could you try logging out from Dagger Cloud and running dagger login again?

#

dagger login should now supporto the Google sign-in

fossil venture
fossil venture
#

I re-tried the same commands under a Git bash shell and it is not working. i get : "failed to start service: new container: InvalidArgument: InvalidArgument: rpc error: code = InvalidArgument desc = not a socket"
trace=8702f9ccfa91d15deae842a788d940e9

proven marten
#

cc @frozen quartz