[WSL] 1Password-SSH-agent stuk

Pagina: 1
Acties:

Vraag


Acties:
  • 0 Henk 'm!

  • Rickets
  • Registratie: Augustus 2001
  • Niet online

Rickets

Finger and a shift

Topicstarter
Ik gebruik Windows WSL2 op mijn Surface Laptop 5, en gebruik al een hele tijd 1Password om mijn SSH-keys, die ik nodig hebt voor git, te beheren.

Gisteren zijn er een Windowsupdates geïnstalleerd, en vandaag werkt de connectie met remote gitrepositories niet meer en krijg ik geen 1Passwordpopup meer om het SSH-verzoek goed te keuren:
~/projects/x$ git up
git@url: Permission denied (publickey,keyboard-interactive).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Ook het opvragen welke SSH-keys er zijn lukt niet meer:
@SurfaceLaptop5:~/projects/x$ ssh-add -l
error fetching identities: communication with agent failed
De SSH-agent is dus stuk.



Deze constructie werkt door de standaard Windows SSH-agent uit te zetten, en met named pipes SSH-commands naar de 1Password-SSH-agent te forwarden. De instructies daarvoor staan onder andere hier: https://gist.github.com/W...4cc201d3fbc8cd1f6aeccef51

Ik heb dus in mijn .bashrc dit staan:

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Configure ssh forwarding
export SSH_AUTH_SOCK=$HOME/.ssh/agent.sock
# need `ps -ww` to get non-truncated command for matching
# use square brackets to generate a regex match for the process we want but that doesn't match the grep command running it!
ALREADY_RUNNING=$(ps -auxww | grep -q "[n]piperelay.exe -ei -s //./pipe/openssh-ssh-agent"; echo $?)
if [[ $ALREADY_RUNNING != "0" ]]; then
    if [[ -S $SSH_AUTH_SOCK ]]; then
        # not expecting the socket to exist as the forwarding command isn't running (http://www.tldp.org/LDP/abs/html/fto.html)
        echo "removing previous socket..."
        rm $SSH_AUTH_SOCK
    fi
    echo "Starting SSH-Agent relay..."
    # setsid to force new session to keep running
    # set socat to listen on $SSH_AUTH_SOCK and forward to npiperelay which then forwards to openssh-ssh-agent on windows
    (setsid socat UNIX-LISTEN:$SSH_AUTH_SOCK,fork EXEC:"npiperelay.exe -ei -s //./pipe/openssh-ssh-agent",nofork &) >/dev/null 2>&1
fi


Het benodigde npiperelay.exe staat in C:\Program Files (x86)\npiperelay en is toegevoegd aan de $PATH. (Anders had het voor vandaag ook niet gewerkt.)

De gisteren geïnstalleerde updates zijn:Ik heb gekeken in de lijst met wijzigingen in de updates, maar ik kon zo snel niet ontdekken wat de eventuele boosdoener zou kunnen zijn.

Heeft iemand enig idee hoe dit te fixen?

If some cunt can fuck something up, that cunt will pick the worst possible time to fucking fuck it up, because that cunt’s a cunt.

Alle reacties


Acties:
  • +1 Henk 'm!

  • Rickets
  • Registratie: Augustus 2001
  • Niet online

Rickets

Finger and a shift

Topicstarter
Gefixt.

Ik wilde VS Code starten vanuit WSL, en dat werkte ook niet:

code:
1
2
@SurfaceLaptop5:~/projects/x$ code .
/mnt/c/Users/AppData/Local/Programs/Microsoft VS Code/bin/code: 61: /mnt/c/Users/AppData/Local/Programs/Microsoft VS Code/Code.exe: Exec format error

Dus het ligt aan het kunnen runnen van .exe's in WSL. (De setup met 1Password gebruikt npiperelay.exe.) Het komt door ruzie tussen binmft en systemd tijdens de init van WSL: https://github.com/microsoft/WSL/issues/8843

Dit draaien was de oplossing:

code:
1
sudo sh -c 'echo :WSLInterop:M::MZ::/init:PF > /usr/lib/binfmt.d/WSLInterop.conf'

If some cunt can fuck something up, that cunt will pick the worst possible time to fucking fuck it up, because that cunt’s a cunt.