From 03b903de311946827e690f4db8b082c0ab32dc47 Mon Sep 17 00:00:00 2001 From: sev Date: Tue, 13 Oct 2020 23:26:29 -0500 Subject: [PATCH] more gpg stuff revert pointless gpg-agent.conf comments update pinentry config to point to user-local bin add pinentry script to auto-pick pinentry like Debian, but portable add sshcontrol --- bin/pinentry | 19 +++++++++++++++++++ gpg/gpg-agent.conf | 4 +--- gpg/sshcontrol | 1 + 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100755 bin/pinentry create mode 100644 gpg/sshcontrol diff --git a/bin/pinentry b/bin/pinentry new file mode 100755 index 0000000..7b83ff5 --- /dev/null +++ b/bin/pinentry @@ -0,0 +1,19 @@ +#!/bin/sh +# https://kevinlocke.name/bits/2019/07/31/prefer-terminal-for-gpg-pinentry + +set -Ce +graphics="gtk-2 gtk qt x11 gnome" +tty="curses tty" +case "${PINENTRY_USER_DATA-}" in + *USE_TTY=1*) list="$tty $graphics";; + *) list="$graphics $tty";; +esac + +for x in $list; do + p=which "pinentry-$x" 2>/dev/null + if [ $? = 0 ]; then + exec "$p" "$@" + fi +done + +echo "No pinentry program found" >&2 diff --git a/gpg/gpg-agent.conf b/gpg/gpg-agent.conf index 513e54c..8075100 100644 --- a/gpg/gpg-agent.conf +++ b/gpg/gpg-agent.conf @@ -1,4 +1,2 @@ -# support ssh with gpg-agent enable-ssh-support -# try to use X11 pinentry if possible -pinentry-program /usr/bin/pinentry-x11 +pinentry-program ~/bin/pinentry diff --git a/gpg/sshcontrol b/gpg/sshcontrol new file mode 100644 index 0000000..0da20a5 --- /dev/null +++ b/gpg/sshcontrol @@ -0,0 +1 @@ +0C19EB483691C8F2F85E0F00A2DA56C990E448DE -- 2.47.0