tl;dr: Is there a way to either disable the persistent import functionality of gpg-agent or work around that to allow using different sources for SSH keys?
Situation
I use GnuPG 2 keys (on a YubiKey) for SSH authentication through gpg-agent's enable-ssh-support. This works fine.
I do have other keys available (filesystem and KeePassXC). When using ssh-add or KeePassXC to add those, they are imported by gpg-agent and stored in ~/.gnupg/private-keys-v1.d/. I need to provide an additional password for encrypting those.
The problem
This works as advertised, but defeats the purpose of having keys stored elsewhere:
- I want KeePassXC to temporarily add keys to the current
ssh-agentwhen it unlocks the password database. The keys shouldn't be permanently available afterwards. - Similar for
ssh-adding key files from the shell: I do not want to import and persist those while having to provide even more passwords.
How do I avoid the import while allowing all sources of keys to be used? One idea that I was having was to set up multiple agents on the same machine, possibly gpg-agent forwarding to a local ssh-agent, but this sounds like it may be overly complicated.
A similar problem is part of this KeePassXC issue, but no solution was suggested.