I am trying to use keychain on debian latest stable with some difficulty. Searching online I could not find a solution, but thought perhaps a different approach or a different tool might be better in this case.
I want to achieve something reasonably straight-forward:
- When logging in to the server as root after reboot, the user is prompted for a master passphrase once.
- This passphrase is loaded into memory and used to unlock both the
ssh private key(used for pulling code from a remote git repository, remote authentication etc) and agpg private key(used to decrypt some configuration parameters also coming from git).
This way, only having access to the root account or being able to dump memory would allow extracting the passphrase. As soon as the server is rebooted the passphrase is cleared. I don't have the budget/resources for an HSM or anything more elaborate. I want something simple and cheap and that works reliably and securely enough.
Keychain seems like a good candidate, but I can't get it to work properly to fulfill both requirements. Namely, it asks for the pasphrase twice, and also when trying to decrypt something with gpg it asks for it a 3rd time... Is there a way to achieve this securely with keychain or any other tool or shell script?
[p.s. not sure if this belongs on ServerFault or here]
gnome-keyring-daemon), and unlock that once per session; but you'd have to get a version that supports GPG (the one in Debian doesn't, AFAIK), and it's unwieldy without X.gnome-keyring-daemonitself doesn't require X, but I don't know if there's a way to feed it keys without X. However, it doesn't meet your security requirements, since it would store the keys in a keyring file. On the gripping hand, I don't see a difference security-wise between having several files stored on the same disk and protected by the same password (SSH key and GPG key) and one file protected by that password (Gnome keyring or passwordless keys on an encfs or truecrypt filesystem).