02/03/2024
Using KeeAgent with Cygwin OpenSSH
As I said in the previous post I’m in love with Cygwin… but I’m also in love with Keepass… and I also live with ssh… so how to make my life easier?
The answer is simple: KeeAgent
KeeAgent is a Keepass plugin that can work as a ssh agent, in this way:
- you can save you ssh private keys in a safe and encrypted Keepass database –> NO MORE PRIVATE KEYS ON FILESYSTEM
- you don’t have to deal with ssh private keys passphrases, because they’re stored in the Keepass entries where you’ll save private keys –> NO MORE UNENCRYPTED PRIVATE KEYS
- you can easily retrieve public keys to authorize hosts access without searching like a hound on your filesystem, in a couple of clicks KeeAgent will provide them
Apparently the setup of all this thing may seem complex, in reality it’s quite simple:
- download and install KeeAgent from https://github.com/dlech/KeeAgent/releases
- in KeeAgent options (Tools -> Options -> KeeAgent) put this string into “Cygwin/MSYS Integration” Path
%UserProfile%/.keeagent.sock
- restart Keepass and check if there’s the file .keeagent.sock in your home and it’s a socket file
file ~/.keeagent.sock
- export SSH_AUTH_SOCK variable and put it on your .bashrc file, the value of the variable should be the path of the socket file you set at the point number 2.
echo "export SSH_AUTH_SOCK=~/.keeagent.sock" >> ~/.bashrc
- make sure you have installed Cygwin OpenSSH and you’re not using Windows ssh
The setup is complete, now you only have to create key entries in your Keepass database, attach private key files, fill the password field and enable those entries to be loaded with KeeAgent.
For more details check the super clear KeeAgent documentation.