From: W. Trevor King Date: Wed, 22 Jun 2011 01:09:59 +0000 (-0400) Subject: Add gpg-agent post and scripts. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=37140de930c744f38b8c15e416483248befad74e;p=blog.git Add gpg-agent post and scripts. --- diff --git a/posts/gpg-agent.mdwn b/posts/gpg-agent.mdwn new file mode 100644 index 0000000..fca0c83 --- /dev/null +++ b/posts/gpg-agent.mdwn @@ -0,0 +1,28 @@ +The 2.X branch of [[GnuPG]] comes with [gpg-agent][] for caching +passphrases. The documentation is good, but here are my notes +outlining my usual usage. + +Add + + if [ -f "${HOME}/.gnupg/agent-info" ]; then + source "${HOME}/.gnupg/agent-info" + fi + +Start the agent with + + $ GPG_TTY=$(tty) + $ gpg-agent --daemon --write-env-file "${HOME}/.gnupg/agent-info" + $ echo "GPG_TTY='${GPG_TTY}'; export GPG_TTY" >> "${HOME}/.gnupg/agent-info" + $ source "${HOME}/.gnupg/agent-info" + +The `GPG_TTY` bit will spawn the `pinentry` call in the designated +TTY. This avoids troublesome issues like pinentry clobbering [[Mutt]] +if they are both using ncurses. + +When you are done with the agent, kill it with + + $ killall gpg-agent + $ rm -f "${HOME}/.gnupg/agent-info" + +[[!tag tags/linux]] +[[!tag tags/tools]] diff --git a/posts/gpg-agent/gpg-agent-kill.sh b/posts/gpg-agent/gpg-agent-kill.sh new file mode 100755 index 0000000..5ac9d3b --- /dev/null +++ b/posts/gpg-agent/gpg-agent-kill.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +FILE="${HOME}/.gnupg/agent-info" +killall gpg-agent +rm -f "${FILE}" diff --git a/posts/gpg-agent/gpg-agent-spawn.sh b/posts/gpg-agent/gpg-agent-spawn.sh new file mode 100755 index 0000000..432e69f --- /dev/null +++ b/posts/gpg-agent/gpg-agent-spawn.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# source me! + +FILE="${HOME}/.gnupg/agent-info" +GPG_TTY=$(tty) +#gpg-agent --daemon --enable-ssh-support --write-env-file "${FILE}" --pinentry-program "${HOME}/bin/pinentry" +gpg-agent --daemon --write-env-file "${FILE}" --pinentry-program "${HOME}/bin/pinentry" +echo "GPG_TTY='${GPG_TTY}'; export GPG_TTY" >> "${FILE}" +source "${FILE}"