summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJameson Graef Rollins <jrollins@phys.columbia.edu>2008-06-16 14:07:33 -0400
committerJameson Graef Rollins <jrollins@phys.columbia.edu>2008-06-16 14:07:33 -0400
commitbb17921883afe6edfeaa029d2113baebf10b7b92 (patch)
tree66001851d946043db2cac2c8f2149bc19e938a9f /src
parent785736d891f6c61eb5d7f4f10687ef9a0d920c3b (diff)
Allow for specification of whether to check keyserver.
Update proxy command to check keyserver if host not found in known_hosts.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/monkeysphere-ssh-proxycommand30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/monkeysphere-ssh-proxycommand b/src/monkeysphere-ssh-proxycommand
index 417d013..ec162ab 100755
--- a/src/monkeysphere-ssh-proxycommand
+++ b/src/monkeysphere-ssh-proxycommand
@@ -16,6 +16,36 @@
HOST="$1"
PORT="$2"
+usage() {
+cat <<EOF >&2
+usage: ssh -o ProxyCommand="$(basename $0) %h %p" ...
+EOF
+}
+
+log() {
+ echo "$@" >&2
+}
+
+if [ -z "$HOST" ] ; then
+ log "host must be specified."
+ usage
+ exit 1
+fi
+if [ -z "$PORT" ] ; then
+ log "port must be specified."
+ usage
+ exit 1
+fi
+
+# check for the host key in the known_hosts file
+hostKey=$(ssh-keygen -F "$HOST")
+
+# if the host key is not found in the known_hosts file,
+# check the keyserver
+if [ -z "$hostKey" ] ; then
+ CHECK_KEYSERVER="true"
+fi
+
# update the known_hosts file for the host
monkeysphere update-known-hosts "$HOST"