diff options
author | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2008-08-15 16:51:35 -0400 |
---|---|---|
committer | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2008-08-15 16:51:35 -0400 |
commit | 78fe687a40613136c72bf3fcf16939d4415d4a1c (patch) | |
tree | 68061c049337604e659b2f91f974775ef43caaf9 /src | |
parent | b0ea15c8e359a908583e08da0663d69e353c77dc (diff) |
fixing gen-subkey when no agent is present.
Diffstat (limited to 'src')
-rwxr-xr-x | src/monkeysphere | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/monkeysphere b/src/monkeysphere index 6d9e6c3..57597e2 100755 --- a/src/monkeysphere +++ b/src/monkeysphere @@ -48,7 +48,6 @@ 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." } |