Skip to content

Commit 7d1bb0f

Browse files
committed
Fix add to known hosts script
1 parent 7932bc0 commit 7d1bb0f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cmd/cli/add_to_known_hosts.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,11 @@ if [ $1 = "-h" ]; then
88
exit 0;
99
fi
1010

11-
pubkey=`curl -s $1/pubkey`
12-
ssh-keyscan -H "$2" 2>/dev/null | grep "${pubkey}"
11+
pubkeys=`curl -s $1/pubkey`
12+
host_keys=`ssh-keyscan -H "$2" 2>/dev/null; ssh-keyscan -H -p 10022 "$2" 2>/dev/null`
13+
14+
echo "$pubkeys" | while IFS= read -r pubkey; do
15+
if [ -n "$pubkey" ]; then
16+
echo "$host_keys" | grep "${pubkey}"
17+
fi
18+
done

0 commit comments

Comments
 (0)