SSH Key manager, powered by fabric
When controlling access to various servers for various people, it can become quite difficult/tedious to manage, for some people its acceptable to pass around one common keyfile, but this presents the problem that if any user ever leaves, the keyfile will need replacing, and re-distributing to all users.
A way to get around this problem, and be generally more secure, is to use
individual public keys, if a user needs access to one or more servers, they
give you their public key, and you put it into the authorized_keys
file on
the user account/server they need access to.
Doing this manually, e.g:
ssh user@host
echo "ssh-rsa KEY_HASH user@host" >> ~/.authorized_keys
Can become tedious to manage, so I wrote a manager that allows you to manage keys on multiple servers very easily, it uses the already amazing fabric library.
pip install git+git://github.com/farridav/keymanager.git
* Will be on pypi soon, see Issue 2
git clone git@github.com:farridav/keymanager.git
cd keymanager
pip install -r test-requirements.txt
nosetests
keymanager
keymanager -d <task_name>
keymanager list --hosts user@host,otheruser@otherhost
keymanager add --hosts user@host
keymanager add:~/.ssh/id_rsa.pub --hosts user@host
keymanager add:ssh-rsa KEY_HASH user@host --hosts user@host
keymanager add_batch:~/.ssh/keys_list.txt --hosts user@host
keymanager add_batch:~/.ssh/keys_list.txt,replace=True --hosts user@host
keymanager add_batch:~/.ssh/keys_list.txt,replace=True,force=True --hosts user@host
keymanager delete --hosts user@host
keymanager delete:user@host --hosts user@host
keymanager delete_batch:~/.ssh/keys_list.txt --hosts user@host
keymanager delete_batch:~/.ssh/keys_list.txt,force=True --hosts user@host