3 # monkeysphere-ssh-proxycommand: MonkeySphere ssh ProxyCommand hook
5 # The monkeysphere scripts are written by:
6 # Jameson Rollins <jrollins@fifthhorseman.net>
8 # They are Copyright 2008, and are all released under the GPL, version 3
11 # This is meant to be run as an ssh ProxyCommand to initiate a
12 # monkeysphere known_hosts update before an ssh connection to host is
13 # established. Can be added to ~/.ssh/config as follows:
14 # ProxyCommand monkeysphere-ssh-proxycommand %h %p
21 usage: ssh -o ProxyCommand="$(basename $0) %h %p" ...
29 if [ -z "$HOST" ] ; then
30 log "host must be specified."
34 if [ -z "$PORT" ] ; then
35 log "port must be specified."
40 # check for the host key in the known_hosts file
41 hostKey=$(ssh-keygen -F "$HOST")
43 # if the host key is not found in the known_hosts file,
45 if [ -z "$hostKey" ] ; then
46 CHECK_KEYSERVER="true"
49 # update the known_hosts file for the host
50 monkeysphere update-known-hosts "$HOST"
52 # exec a netcat passthrough to host for the ssh connection
53 exec nc "$HOST" "$PORT"