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

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

diablodale
Copy link
Owner

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

  • Attempts best guess at WSL_INTEROP socket. I am using an approach that only looks at sockets owned by the same user.
  • Locates powershell
  • Add support for new layout of GPG keys seen in newer versions of gpg-agent

@diablodale diablodale self-assigned this Mar 9, 2023
@diablodale diablodale added the bug Something isn't working label Mar 9, 2023
@andsens
Copy link

andsens commented Mar 9, 2023

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
Copy link
Owner Author

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
Copy link

andsens commented Mar 9, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants