Open uhthomas opened 2 years ago
This is great, thanks a lot.
Is anyone aware of a solution that would work on MacOS too?
hello @uhthomas - if you'd like to report a bug kindly use https://bugs.funtoo.org/
you can also reach us on Discord - for more info check https://www.funtoo.org/Welcome
At the time of writing, keychain has seen no activity in over four years. It might be helpful to suggest alternatives given there is no desire to maintain the project.
I've found that gpg-agent and systemd have not only proven to be a suitable replacement, but also have improved quality of life by reducing shell startup times by 64ms~ (130ms~ at the extreme). There is an excellent article on the Arch Linux wiki which explains how to setup and configure gpg-agent. Most importantly, gpg-agent can emulate ssh-agent.
keychain performance
One of the main reasons for seeking alternatives is the poor performance and consequential large impact keychain imposed on shell startup times.
gpg-agent systemd user unit
Rather than reading the Arch Linux wiki, this should work as a quick-start and tl;dr.
The gpg-agent systemd user units are enabled by default (at least on Arch Linux).
Emulate ssh-agent:
/etc/security/pam_env.conf
Cache passphrases for a really long time:
~/.gnupg/gpg-agent.conf
Restart the gpg-agent systemd user unit to apply changes.
Assuming keys have already been added to gpg-agent, everything should work as expected. This approach doesn't ask for all passphrases upfront, at shell login, but I'm sure it's possible to write something to do this if desired. Personally, I don't want that functionality as it is incompatible with some terminal configurations (i.e zsh4humans).
I hope this is helpful!