blob: 13a77e4f35c9b4862e1e27b1177012853f8e716a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#!/bin/bash
#
# Load keys into the ssh-agent
# Uses monkeysphere and keychain
#
# Check for keychain
if [ -x '/usr/bin/keychain' ]; then
mkdir -p $HOME/.keychain
# Setup keychain
/usr/bin/keychain -q --noask
# Load ssh-agent info
if [ -e "$HOME/.keychain/$HOSTNAME-sh" ]; then
. $HOME/.keychain/$HOSTNAME-sh
fi
# 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 && [ "`gpg --list-secret-keys | wc -l`" != "0" ]; then
monkeysphere subkey-to-ssh-agent
fi
fi
# Check for RSA key
if [ -e "$HOME/.ssh/id_rsa" ]; then
/usr/bin/keychain -q $HOME/.ssh/id_rsa
fi
# Check for ED25519 key
if [ -e "$HOME/.ssh/id_ed25519" ]; then
/usr/bin/keychain -q $HOME/.ssh/id_ed25519
fi
# Autoload remaining keys
if [ -d "$HOME/.ssh/autoload" ]; then
for key in `ls $HOME/.ssh/autoload`; do
/usr/bin/keychain -q $HOME/.ssh/autoload/$key
done
fi
fi
|