From b2bf2d17cd6eb5edcb69d51867b7d17e60751986 Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Sat, 31 Jan 2009 22:32:51 -0500 Subject: [PATCH] some more fixes and tweaks to get things working in the new setup --- src/monkeysphere | 7 +++--- src/monkeysphere-authentication | 18 ++++++++++---- src/monkeysphere-host | 35 ++++++++++++++++++--------- src/subcommands/m/ssh_proxycommand | 25 ++++--------------- src/subcommands/m/subkey_to_ssh_agent | 3 ++- 5 files changed, 47 insertions(+), 41 deletions(-) diff --git a/src/monkeysphere b/src/monkeysphere index bce0072..8b7bfee 100755 --- a/src/monkeysphere +++ b/src/monkeysphere @@ -167,12 +167,12 @@ case $COMMAND in ;; 'import-subkey'|'i') - source "${MSHAREDIR}/import-key" - import_key "$@" + source "${MSHAREDIR}/import_subkey" + import_subkey "$@" ;; 'gen-subkey'|'g') - source "${MSHAREDIR}/import_key" + source "${MSHAREDIR}/gen_subkey" gen_subkey "$@" ;; @@ -182,6 +182,7 @@ case $COMMAND in ;; 'subkey-to-ssh-agent'|'s') + source "${MSHAREDIR}/subkey_to_ssh_agent" subkey_to_ssh_agent "$@" ;; diff --git a/src/monkeysphere-authentication b/src/monkeysphere-authentication index 56a8877..a8f17f9 100755 --- a/src/monkeysphere-authentication +++ b/src/monkeysphere-authentication @@ -12,8 +12,6 @@ # version 3 or later. ######################################################################## -set -e - PGRM=$(basename $0) SYSSHAREDIR=${MONKEYSPHERE_SYSSHAREDIR:-"/usr/share/monkeysphere"} @@ -57,9 +55,8 @@ subcommands: remove-id-certifier (c-) KEYID remove a certification key list-id-certifiers (c) list certification keys - expert - diagnostics (d) monkeysphere authentication status - gpg-cmd CMD execute gpg command + expert run expert command + expert help expert command help version (v) show version number help (h,?) this help @@ -182,6 +179,17 @@ case $COMMAND in SUBCOMMAND="$1" shift case "$SUBCOMMAND" in + 'help'|'h'|'?') + cat < [options] [args] + +expert subcommands: + diagnostics (d) monkeysphere authentication status + gpg-cmd CMD execute gpg command + +EOF + ;; + 'diagnostics'|'d') source "${MASHAREDIR}/diagnostics" diagnostics diff --git a/src/monkeysphere-host b/src/monkeysphere-host index 32e2293..4c978c9 100755 --- a/src/monkeysphere-host +++ b/src/monkeysphere-host @@ -3,12 +3,13 @@ # monkeysphere-host: Monkeysphere host admin tool # # The monkeysphere scripts are written by: -# Jameson Rollins +# Jameson Rollins # Jamie McClelland # Daniel Kahn Gillmor +# Micah Anderson # -# They are Copyright 2008, and are all released under the GPL, version 3 -# or later. +# They are Copyright 2008-2009, and are all released under the GPL, +# version 3 or later. ######################################################################## PGRM=$(basename $0) @@ -50,14 +51,8 @@ subcommands: revoke-key (r) revoke host key publish-key (p) publish server host key to keyserver - expert - import-key (i) [NAME[:PORT]] import existing ssh key to gpg - --keyfile (-f) FILE key file to import - --expire (-e) EXPIRE date to expire - gen-key (g) [NAME[:PORT]] generate gpg key for the host - --length (-l) BITS key length in bits (2048) - --expire (-e) EXPIRE date to expire - diagnostics (d) monkeysphere host status + expert run expert command + expert help expert command help version (v) show version number help (h,?) this help @@ -146,7 +141,7 @@ unset KEYSERVER unset MONKEYSPHERE_USER # load configuration file -[ -e ${MONKEYSPHERE_HOST_CONFIG:="${SYSCONFIGDIR}/monkeysphere-host.conf"} ] && . "$MONKEYSPHERE_SERVER_CONFIG" +[ -e ${MONKEYSPHERE_HOST_CONFIG:="${SYSCONFIGDIR}/monkeysphere-host.conf"} ] && . "$MONKEYSPHERE_HOST_CONFIG" # set empty config variable with ones from the environment, or with # defaults @@ -220,6 +215,22 @@ case $COMMAND in SUBCOMMAND="$1" shift case "$SUBCOMMAND" in + 'help'|'h'|'?') + cat < [options] [args] + +expert subcommands: + import-key (i) [NAME[:PORT]] import existing ssh key to gpg + --keyfile (-f) FILE key file to import + --expire (-e) EXPIRE date to expire + gen-key (g) [NAME[:PORT]] generate gpg key for the host + --length (-l) BITS key length in bits (2048) + --expire (-e) EXPIRE date to expire + diagnostics (d) monkeysphere host status + +EOF + ;; + 'import-key'|'i') source "${MHSHAREDIR}/import_key" import_key "$@" diff --git a/src/subcommands/m/ssh_proxycommand b/src/subcommands/m/ssh_proxycommand index 56a266e..7239c7a 100644 --- a/src/subcommands/m/ssh_proxycommand +++ b/src/subcommands/m/ssh_proxycommand @@ -15,27 +15,10 @@ # established. Can be added to ~/.ssh/config as follows: # ProxyCommand monkeysphere-ssh-proxycommand %h %p -######################################################################## -PGRM=$(basename $0) - -SYSSHAREDIR=${MONKEYSPHERE_SYSSHAREDIR:-"/usr/share/monkeysphere"} -export SYSSHAREDIR -. "${SYSSHAREDIR}/common" || exit 1 - -######################################################################## -# FUNCTIONS -######################################################################## - -usage() { - cat <&2 -usage: ssh -o ProxyCommand="$(basename $0) %h %p" ... -EOF -} - -log() { - echo "$@" >&2 -} +ssh_proxycommand() { +# "marginal case" ouput in the case that there is not a full +# validation path to the host output_no_valid_key() { local sshKeyOffered local userID @@ -250,3 +233,5 @@ if [ -z "$NO_CONNECT" ] ; then exit 255 fi fi + +} diff --git a/src/subcommands/m/subkey_to_ssh_agent b/src/subcommands/m/subkey_to_ssh_agent index 9bedb5e..012c95f 100644 --- a/src/subcommands/m/subkey_to_ssh_agent +++ b/src/subcommands/m/subkey_to_ssh_agent @@ -44,7 +44,8 @@ For more details, see: failure "Could not connect to ssh-agent" fi - # get list of secret keys (to work around https://bugs.g10code.com/gnupg/issue945): + # get list of secret keys (to work around bug + # https://bugs.g10code.com/gnupg/issue945): secretkeys=$(gpg --list-secret-keys --with-colons --fixed-list-mode --fingerprint | \ grep '^fpr:' | cut -f10 -d: | awk '{ print "0x" $1 "!" }') -- 2.26.2