summaryrefslogtreecommitdiff
path: root/src/monkeysphere-host
diff options
context:
space:
mode:
authorJameson Graef Rollins <jrollins@finestructure.net>2009-01-31 18:04:21 -0500
committerJameson Graef Rollins <jrollins@finestructure.net>2009-01-31 18:04:21 -0500
commita0747749cbc7445e0cadaf0fbf1c92a2e86d1369 (patch)
tree01458632e6e699507b6a0889f2557726208c320e /src/monkeysphere-host
parent968627c7003d059e63ae455d91e1ada4143c8810 (diff)
turn subcommands into subfunctions, that will need to be sourced and executed.
Diffstat (limited to 'src/monkeysphere-host')
-rwxr-xr-xsrc/monkeysphere-host29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/monkeysphere-host b/src/monkeysphere-host
index 5c97aa6..7ba0700 100755
--- a/src/monkeysphere-host
+++ b/src/monkeysphere-host
@@ -131,6 +131,35 @@ check_host_keyring() {
|| failure "You don't appear to have a Monkeysphere host key on this server. Please run 'monkeysphere-server gen-key' first."
}
+# show info about the host key
+show_key() {
+ local fingerprintPGP
+ local fingerprintSSH
+ local ret=0
+
+ # FIXME: you shouldn't have to be root to see the host key fingerprint
+ if is_root ; then
+ check_host_keyring
+ fingerprintPGP=$(fingerprint_server_key)
+ gpg_authentication "--fingerprint --list-key --list-options show-unusable-uids $fingerprintPGP" 2>/dev/null
+ echo "OpenPGP fingerprint: $fingerprintPGP"
+ else
+ log info "You must be root to see host OpenPGP fingerprint."
+ ret='1'
+ fi
+
+ if [ -f "${SYSDATADIR}/ssh_host_rsa_key.pub" ] ; then
+ fingerprintSSH=$(ssh-keygen -l -f "${SYSDATADIR}/ssh_host_rsa_key.pub" | \
+ awk '{ print $1, $2, $4 }')
+ echo "ssh fingerprint: $fingerprintSSH"
+ else
+ log info "SSH host key not found."
+ ret='1'
+ fi
+
+return $ret
+}
+
########################################################################
# MAIN
########################################################################