I have been using gpg
for encryption for a while. Someone suggested that I should use gpg2
instead. When I went to use gpg2
, I could do almost nothing; it would complain that access to private keys was required, but I could not seem to get it to use the private keys without gpg-agent
running.
It turns out that I intentionally disabled gpg-agent
(by using chmod -x /usr/bin/gpg-agent
); this caused gpg2
to have very limited functionality and complain to stderr.
The reasons I disabled gpg-agent
was following a chain of events.
First, I would SSH into a remote machine and "an agent" would open a popup asking for me to unlock my SSH keys. I did not like this because:
- A pop-up on my screen interrupts my workflow
- A pop-up on my screen is unlikely to be noticed, so it would appear instead that the connection is stalling instead of querying to unlock an encryption key
- The agent appeared to cache my password when I absolutely do not want my password cached (much like
sudo
's annoying use of password caching, I can disable that in its config); I will always want to enter the passphrase for my encryption keys every time they are used for whatever program is using them. - The pop-up appeared to be owned by a separate process, while I want the specific process using the key to query for the passphrase (even if it's a library that does the actual querying); since I spend most of my activities using command-line tools, that means a GUI application isn't ideal because not everything I do will have access to X11
- Automatically starting a separate process in the background removes the concept of "one command, one process", especially if that backgrounded process then lingers after the original command has exited
It turned out to be GNOME's key agent and that I could not uninstall the agent without uninstalling GNOME. So I simply disabled it by chmod -x /usr/bin/gnome-keyring*
. I then found that SSH would fall back to another agent so I disabled that too using the same method chmod -x /usr/bin/ssh-agent*
When I started using gpg
, I found it had a similar agent, the same one I am asking about. I disabled it immediately for the same reasons; I want software to always ask me for passphrases in order to use a private key. I do not want the passphrase to be cached for any reason whatsoever.
So with gpg2
appearing to require gpg-agent
, I would like to ask:
- Am I being overly paranoid about the use of passphrase caching? I would be curious to see or be pointed to a discussion of it.
- Is there a best practice that enables a better way to avoid even accidentally enabling the use of a cached passphrase?
- Is there a way to use
gpg2
withoutgpg-agent
ever running? - Given that agents are daemons which are expected to be able to answer queries, what prevents another user or service running on the local machine from being able to access my cached or stored credentials?
gpg
instead ofgpg2
where I can. – Unrealizable