Skip to content

QtPass does not honor $SSH_AUTH_SOCK env, requires running from terminal to sync via ssh/github #543

@Logicwax

Description

@Logicwax

QtPass needs to be ran from terminal in order to honor the $SSH_AUTH_SOCK env variable in order to work with my yubikey for repo syncing (SSH connection to github)

This issue is present on my Ubuntu 20.04 and macOS catalina machines. For context:

  1. I use GPG with a yubikey smartcard
  2. I keep my pass db on my github account
  3. I use my yubikey to auth all SSH sessions, such as to github (via gpg ssh auth socket)
  4. I'm running GNOME on wayland, if that matters.

The solution is to just run qtpass from terminal. When it's ran from the GUI in any way (from gnome start-up applications in ubuntu, or gnome app launcher, or from the dock in macOS) then QtPass doesn't get the correct environment variables. Which is most likely the $SSH_AUTH_SOCK and $GPG_TTY environment variables. QtPass should have better handling for this IMHO.

I've tried editing the /usr/share/applications/qtpass.desktop file to include these vars when executing qtpass, but nothing seems to work. Any SSH sessions, git syncing, or pass commands at terminal work fine, its only QtPass that has this issue.

I've also tried
pinentry-program /usr/bin/pinentry-tty
pinentry-program /usr/bin/pinentry-gnome3

~/.gnupg/gpg-agent.conf:

pinentry-program /usr/bin/pinentry-gnome3
enable-ssh-support
write-env-file
use-standard-socket
default-cache-ttl 300
max-cache-ttl 1200
allow-loopback-pinentry

my env:

SSH_AUTH_SOCK=/run/user/1000/gnupg/S.gpg-agent.ssh

my ~/.bashrc or ~/.zshrc file

envfile="$HOME/.gnupg/gpg-agent.env"
if ( [[ ! -e "$HOME/.gnupg/S.gpg-agent" ]] && \
     [[ ! -e "/var/run/user/$(id -u)/gnupg/S.gpg-agent" ]] );
then
  killall pinentry > /dev/null 2>&1
  killall pinentry-tty > /dev/null 2>&1  
  gpgconf --reload scdaemon > /dev/null 2>&1
  pkill -x -INT gpg-agent > /dev/null 2>&1
  gpg-agent --daemon --enable-ssh-support > $envfile
fi

# Wake up smartcard to avoid races
gpg --card-status > /dev/null 2>&1
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"

export GPG_TTY=$(tty)

Also I should note that decrypting/encrypting my passwords in QtPass works fine, makes my yubikey blink, and pops up the pin entry dialog. This is only for SSH repo syncing that QtPass has this problem. Also note, my yubikey is set to tap required mode (which is entirely the reason I even use pass/qtpass, as there is friction in decrypting my entire password store)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions