X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=src%2Fmonkeysphere;h=303dc8d758d2262bb5faf3de3e39e78893154f9b;hb=6ac379bdd75617cfab19c3b175a2e10257444de3;hp=6d9e6c3a28469880895525d2a51e64667cb8de7c;hpb=22476961b7915076e6ae7f353b563516f9931a04;p=monkeysphere.git diff --git a/src/monkeysphere b/src/monkeysphere index 6d9e6c3..303dc8d 100755 --- a/src/monkeysphere +++ b/src/monkeysphere @@ -37,18 +37,17 @@ 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 - gen-subkey (g) KEYID generate an 'a' capable subkey - -l|--length BITS key length in bits (2048) - -e|--expire EXPIRE date to expire - help (h,?) this help + update-known_hosts (k) [HOST]... update known_hosts file + update-authorized_keys (a) update authorized_keys file + gen-subkey (g) [KEYID] generate an authentication subkey + --length (-l) BITS key length in bits (2048) + --expire (-e) EXPIRE date to expire + help (h,?) this help EOF } # generate a subkey with the 'a' usage flags set -# FIXME: this needs some tweaking to clean it up gen_subkey(){ local keyLength local keyExpire @@ -163,7 +162,18 @@ EOF ) log "generating subkey..." - echo "$editCommands" | gpg --expert --command-fd 0 --edit-key "$keyID" + fifoDir=$(mktemp -d) + (umask 077 && mkfifo "$fifoDir/pass") + echo "$editCommands" | gpg --passphrase-fd 3 3< "$fifoDir/pass" --expert --command-fd 0 --edit-key "$keyID" & + + if [ "$DISPLAY" ] && which ssh-askpass >/dev/null; then + ssh-askpass "Please enter your passphrase for $keyID: " > "$fifoDir/pass" + else + read -s -p "Please enter your passphrase for $keyID: " PASS + echo "$PASS" > "$fifoDir/pass" + fi + rm -rf "$fifoDir" + wait log "done." } @@ -278,7 +288,7 @@ case $COMMAND in gen_subkey "$@" ;; - 'help'|'h'|'?') + '--help'|'help'|'-h'|'h'|'?') usage ;;