Win11 + 1Password8 -> VSCode -> WSL -> devContainer

bjoern.busch
bjoern.busch
Community Member

I'm trying to set up SSH Key Management in 1Password and use the ss-agent functionality.

  • I have it properly working on the host Win11 system, I can properly log on to a git server, as well as sign commits and retrieve available keys via ssh-add.exe
  • I'm using VSCode in combination with WSL. Also for this level of inception, I have this properly working now. The ssh-agent is forwarded into WSL and I can properly log on to a git server, as well as sign commits and retrieve available keys via ssh-add.exe.
  • Now inside WSL, docker is running and I'm trying to work with devcontainers. Here I'm struggling to get things to work. ssh-add -L is not returning anything and ssh-add.exe is not available, since the host file system is not at this level, only on WSL.

Is there a manual somewhere how to get this to work?

Thanks in advance


1Password Version: 8.10.22
Extension Version: Not Provided
OS Version: Win11
Browser: Not Provided

Comments

  • bjoern.busch
    bjoern.busch
    Community Member

    So I found this as a solution: https://gist.github.com/WillianTomaz/a972f544cc201d3fbc8cd1f6aeccef51

    Instead of using the interop feature of WSL, I'm using the named pipes now.

    Is this THE solution or can I somehow forward the interop feature into the devcontainer?

  • nbaileyMA
    nbaileyMA
    Community Member

    I had previously set it up the way it was described in that link, but I undid all of that after the latest release.

    1Password for Windows 8.10.22 (81022040)

    I followed the instructions here, which it sounds like you already did. https://developer.1password.com/docs/ssh/integrations/wsl/

    But with that, everything worked for me in the dev containers. Running ssh-add -l within my dev container lists my keys from Windows. Are you launching right into the dev container? Or do you open the workspace in WSL first?

    My environment specifically is:

    • Windows 11 (23H2)
    • WSL2 (Ubuntu 22.04)
    • VSCode

    When I open WSL, I take the following steps:

    • cd to directory of my repo
    • code .
    • When VS Code opens it prompts me to authorize 1Password via Windows Hello
    • Once that's done, then I Reopen in Container from VSCode's command window (Ctrl-Shift-P)
    • When I run ssh-add -l
  • Speedbird186
    Speedbird186
    Community Member

    @nbaileyMA Seems like I am having a similar issue. My setup seems to mirror what you do, except that I don't use SSH to sign into the remote git repo. This means that when I open VS Code in WSL2, I don't get prompted by 1Password.

    On the Windows 11 host and in WSL2, I can sign my commits with the key in 1Password. However, in any devcontainer, I can't. The error is:

    fatal: cannot exec '/mnt/c/Users/svaelter/AppData/Local/1Password/app/8/op-ssh-sign-wsl': No such file or directory

    Indeed, in the devcontainer /mnt/c/... does not exist (and I don't really expect it to exist). I am not sure what configuration I need to provide in the devcontainer to tell it which sign tool to use.

    Yet, like you, ssh-add -l in the container shows the same keys as on the Windows 11 host.

    Thanks for any help!