Skip to content

fix(service/gpg-agent): ensure SSH_AUTH_SOCK is set on Darwin #7117

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

squat
Copy link

@squat squat commented May 23, 2025

This commit addresses #5997
At the root, the gpg-agent SSH integration is not working on Darwin
because shells are started with SSH_AUTH_SOCK already set to something
like /private/tmp/com.apple.launchd.ozLmoURHDC/Listeners, which
prevents the hook from setting the variable to the gpg-agent's socket.

This commit fixes the issue using a different mechanism to detect if the
current shell has already had the SSH_AUTH_SOCK variable set to the
gpg-agent's socket, namely by checking for gnupg_SSH_AUTH_SOCK_by as
documented in
https://www.gnupg.org/documentation/manuals/gnupg/Agent-Examples.html#Agent-Examples.

This is essentially a simplified version of
#5901 that does not
attempt to migrate gpg-agent over to launchd.

Signed-off-by: squat [email protected]

This commit addresses nix-community#5997
At the root, the gpg-agent SSH integration is not working on Darwin
because shells are started with `SSH_AUTH_SOCK` already set to something
like `/private/tmp/com.apple.launchd.ozLmoURHDC/Listeners`, which
prevents the hook from setting the variable to the gpg-agent's socket.

This commit fixes the issue using a different mechanism to detect if the
current shell has already had the `SSH_AUTH_SOCK` variable set to the
gpg-agent's socket, namely by checking for `gnupg_SSH_AUTH_SOCK_by` as
documented in
https://www.gnupg.org/documentation/manuals/gnupg/Agent-Examples.html#Agent-Examples.

This is essentially a simplified version of
nix-community#5901 that does not
attempt to migrate gpg-agent over to launchd.

Signed-off-by: squat <[email protected]>
@squat
Copy link
Author

squat commented Jun 1, 2025

cc @rycee since you're listed as a maintainer for this module. PTAL if you can <3

@squat
Copy link
Author

squat commented Jun 9, 2025

cc @cmacrae @folliehiyuki since you reviewed #5901

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant