#!/bin/sh # monkeysphere: MonkeySphere client tool # # The monkeysphere scripts are written by: # Jameson Rollins # # They are Copyright 2008, and are all released under the GPL, version 3 # or later. ######################################################################## PGRM=$(basename $0) SHAREDIR=${SHAREDIR:-"/usr/share/monkeysphere"} export SHAREDIR . "${SHAREDIR}/common" GLOBAL_CONFIG=${GLOBAL_CONFIG:-"${ETC}"/monkeysphere.conf} [ -r "$GLOBAL_CONFIG" ] && . "$GLOBAL_CONFIG" # date in UTF format if needed DATE=$(date -u '+%FT%T') # unset some environment variables that could screw things up GREP_OPTIONS= ######################################################################## # FUNCTIONS ######################################################################## usage() { cat < [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) # set key parameters keyParameters=$(cat <