Add gpg-agent post and scripts.
authorW. Trevor King <wking@drexel.edu>
Wed, 22 Jun 2011 01:09:59 +0000 (21:09 -0400)
committerW. Trevor King <wking@drexel.edu>
Wed, 22 Jun 2011 01:09:59 +0000 (21:09 -0400)
posts/gpg-agent.mdwn [new file with mode: 0644]
posts/gpg-agent/gpg-agent-kill.sh [new file with mode: 0755]
posts/gpg-agent/gpg-agent-spawn.sh [new file with mode: 0755]

diff --git a/posts/gpg-agent.mdwn b/posts/gpg-agent.mdwn
new file mode 100644 (file)
index 0000000..fca0c83
--- /dev/null
@@ -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 (executable)
index 0000000..5ac9d3b
--- /dev/null
@@ -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 (executable)
index 0000000..432e69f
--- /dev/null
@@ -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}"