diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2017-10-27 10:03:48 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2017-10-27 10:03:48 -0200 |
commit | 3c96156d9aa22a02b2771402b9b90c871bf675fc (patch) | |
tree | 3adcdeed15460ae8272826240940041104817520 | |
parent | 2ffe3f07bdab10abd2c2a6b98529c95ac18a8b6a (diff) | |
download | utils-ssh-3c96156d9aa22a02b2771402b9b90c871bf675fc.tar.gz utils-ssh-3c96156d9aa22a02b2771402b9b90c871bf675fc.tar.bz2 |
Setup keychain first and then check for monkeysphere
-rwxr-xr-x | ssh-agent-loadkeys | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/ssh-agent-loadkeys b/ssh-agent-loadkeys index 608f73b..e469ca0 100755 --- a/ssh-agent-loadkeys +++ b/ssh-agent-loadkeys @@ -4,28 +4,37 @@ # Uses monkeysphere and keychain # -if [ -x '/usr/bin/monkeysphere' ]; then - if ! ssh-add -l &> /dev/null; then - monkeysphere subkey-to-ssh-agent - fi -fi - +# Check for keychain if [ -x '/usr/bin/keychain' ]; then mkdir -p $HOME/.keychain - if [ -e "$HOME/.ssh/id_rsa" ]; then - /usr/bin/keychain -q $HOME/.ssh/id_rsa + # Setup keychain + /usr/bin/keychain -q --noask + + # Load ssh-agent info + if [ -e "$HOME/.keychain/$HOSTNAME-sh" ]; then + . $HOME/.keychain/$HOSTNAME-sh fi - if [ -e "$HOME/.ssh/id_ed25519" ]; then - /usr/bin/keychain -q $HOME/.ssh/id_ed25519 + # Load gpg-agent info + #if [ -e "$HOME/.keychain/$HOSTNAME-sh-gpg" ]; then + # . $HOME/.keychain/$HOSTNAME-sh-gpg + #fi + + # Check for monkeysphere + if [ -x '/usr/bin/monkeysphere' ]; then + if ! ssh-add -l &> /dev/null; then + monkeysphere subkey-to-ssh-agent + fi fi - if [ -e "$HOME/.keychain/$HOSTNAME-sh" ]; then - . $HOME/.keychain/$HOSTNAME-sh + # Check for RSA key + if [ -e "$HOME/.ssh/id_rsa" ]; then + /usr/bin/keychain -q $HOME/.ssh/id_rsa fi - if [ -e "$HOME/.keychain/$HOSTNAME-sh-gpg" ]; then - . $HOME/.keychain/$HOSTNAME-sh-gpg + # Check for ED25519 key + if [ -e "$HOME/.ssh/id_ed25519" ]; then + /usr/bin/keychain -q $HOME/.ssh/id_ed25519 fi fi |