diablodale / pinentry-wsl-ps1

GUI for GPG within Windows WSL for passwords, pinentry, etc.
Mozilla Public License 2.0
98 stars 9 forks source link

fix WSL2 w/ systemd; fix new format gpg-agent key #18

Open diablodale opened 1 year ago

diablodale commented 1 year ago

pinentry did not work with WSL2 with systemd and gpg-agent running as a systemctl service. @andsens previously visited this subject area with PR #14.

This PR

andsens commented 1 year ago

Looks great @diablodale! Thanks for the shoutout :-)

Remember that the user session itself still runs rather weirdly under an old-style init process, and not directly as a systemd session, which gives some trouble when you want to interact with systemd components (e.g. no dbus user session, systemctl --user doesn't work). Doesn't look like this affects your changes, but it's just something to keep in mind :-)

image (Started with wsl zsh -l)

diablodale commented 1 year ago

Hmmm, something is different in our systems. My tree is very different image I generated that by installing zsh into Ubuntu, choosing option 2 during zsh install. Then closed wsl and run wsl zsh -l from the windows menu.

I recently upgraded in-place to Win 11 (Version 10.0.22621.1344). Everything else 😆 the same. Same Ubuntu 20.04.5 LTS. What unix do you use? I would like to try that and see if I get similar results as you.

A brittle part of my PR is this $(pstree -np -s -T -u | grep -E "Relay.+$USER" | grep -o -E '[0-9]+'); where I look for a socket owned by the user via Relay as a process parent. Since your pstree is so different...that may not be a good approach.

andsens commented 1 year ago

Also on the newest Win 11, but my wsl is from September. So that might explain the discrepancy.
I'm not using pinentry-wsl-ps1 anymore actually, instead I simply attach my YubiKey with "C:\Program Files\usbipd-win\usbipd.exe" wsl attach -i 1050:0407 and directly connect to it with gpg.