X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=src%2Fmonkeysphere;h=da5f406165469e942654c5865a99f66ea80cc3d6;hb=3e9fd04d34bed8a8c6b43bf111a8b8bbbbe8663f;hp=aaeda117a0efd54d6a8ae7dcf4089fa7fe37fed8;hpb=f049fa104308997359dcd4eb7fd68cabe06a43ba;p=monkeysphere.git diff --git a/src/monkeysphere b/src/monkeysphere index aaeda11..da5f406 100755 --- a/src/monkeysphere +++ b/src/monkeysphere @@ -1,201 +1,203 @@ -#!/bin/sh +#!/usr/bin/env bash -# monkeysphere: MonkeySphere client tool +# monkeysphere: Monkeysphere client tool # # The monkeysphere scripts are written by: # Jameson Rollins +# Jamie McClelland +# Daniel Kahn Gillmor +# Micah Anderson # -# They are Copyright 2008, and are all released under the GPL, version 3 +# They are Copyright 2008-2009, and are all released under the GPL, version 3 # or later. ######################################################################## PGRM=$(basename $0) -SHAREDIR=${SHAREDIR:-"/usr/share/monkeysphere"} -export SHAREDIR -. "${SHAREDIR}/common" +SYSSHAREDIR=${MONKEYSPHERE_SYSSHAREDIR:-"/usr/share/monkeysphere"} +export SYSSHAREDIR +. "${SYSSHAREDIR}/common" || exit 1 -GLOBAL_CONFIG=${GLOBAL_CONFIG:-"${ETC}"/monkeysphere.conf} -[ -r "$GLOBAL_CONFIG" ] && . "$GLOBAL_CONFIG" +# sharedir for host functions +MSHAREDIR="${SYSSHAREDIR}/m" -# date in UTF format if needed +# UTC date in ISO 8601 format if needed DATE=$(date -u '+%FT%T') # unset some environment variables that could screw things up -GREP_OPTIONS= +unset GREP_OPTIONS + +# default return code +RETURN=0 + +# set the file creation mask to be only owner rw +umask 077 ######################################################################## # FUNCTIONS ######################################################################## usage() { -cat < [args] + cat <&2 +usage: $PGRM [options] [args] Monkeysphere client tool. subcommands: - update-known_hosts (k) [HOST]... update known_hosts file - update-authorized_keys (a) update authorized_keys file - update-userids (u) [USERID]... add/update userid - gen-ae-subkey (g) KEYID generate an 'ae' capable subkey - help (h,?) this help - -EOF -} - -# generate a subkey with the 'a' and 'e' usage flags set -gen_ae_subkey(){ - local keyID - local gpgOut - local userID - - log "warning: this function is still not working." - - keyID="$1" - - # set subkey defaults - SUBKEY_TYPE=${KEY_TYPE:-"RSA"} - SUBKEY_LENGTH=${KEY_LENGTH:-"1024"} - SUBKEY_USAGE=${KEY_USAGE:-"encrypt,auth"} - - gpgOut=$(gpg --fixed-list-mode --list-keys --with-colons \ - "$keyID" 2> /dev/null) - - # return 1 if there only "tru" lines are output from gpg - if [ -z "$(echo "$gpgOut" | grep -v '^tru:')" ] ; then - loge " key not found." - return 1 - fi - - userID=$(echo "$gpgOut" | grep "^uid:" | cut -d: -f10) + update-known_hosts (k) [HOST]... update known_hosts file + update-authorized_keys (a) update authorized_keys file + import-subkey (i) import existing ssh key as gpg subkey + --keyfile (-f) FILE key file to import + --expire (-e) EXPIRE date to expire + gen-subkey (g) [KEYID] generate an authentication subkey + --length (-l) BITS key length in bits (2048) + --expire (-e) EXPIRE date to expire + ssh-proxycommand monkeysphere ssh ProxyCommand + subkey-to-ssh-agent (s) store authentication subkey in ssh-agent + version (v) show version number + help (h,?) this help - # set key parameters - keyParameters=$(cat <