Monday 27 September 2004

A quick mini-howto on setting up gpg-agent and mutt

meta-listening: Jack Off Jill — Covet

There aren't many docs around for gpg-agent (due to it only being in the 1.9.x development version of gpg). I managed to get it set up today, so I thought I'd put up a mini-howto.

Installing gpg-agent. First download a 1.9.x version of the GPG sources from the gnupg ftp server . I used 1.9.10, your mileage may vary with other versions.

Install any dependencies. On my Debian Unstable box, all the dependancies were available from the unstable distribution, only gpg-1.9.x itself wasn't available.

The configure script with the 1.9.x distribution includes an option --enable-agent-only, to build the agent without building the other GPG 1.9.x components (i.e. no gpg2 or gpgsm). I did this for minimal impact on my system.

Once made and installed, add code similar to the following to your .xsession, .profile, .bash_profile files, etc.

if test -f $HOME/.gpg-agent-info && \
kill -0 `cut -d: -f2 $HOME/.gpg-agent-info` 2>/dev/null; then
GPG_AGENT_INFO=`cat $HOME/.gpg-agent-info`
export GPG_AGENT_INFO
else
eval `gpg-agent --daemon --pinentry /usr/bin/pinentry-gtk`
echo $GPG_AGENT_INFO >$HOME/.gpg-agent-info
fi
GPG_TTY=`tty`
export GPG_TTY

Update your ~/.gnupg/gpg.conf file to include the use-agent option.

Update your ~/.muttrc to include the following line:

set pgp_use_gpg_agent

And you should be good to go... That's what it took for me, your mileage may vary :)