enforce --no-armor when exporting to openpgp2ssh in case weird gpg.conf options ...
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Thu, 18 Feb 2010 17:11:47 +0000 (12:11 -0500)
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Thu, 18 Feb 2010 17:11:47 +0000 (12:11 -0500)
src/monkeysphere
src/monkeysphere-host
src/share/common
src/share/m/subkey_to_ssh_agent
tests/basic

index 648f5e9886a61ca95349d81953232612c91283fe..e268058f267fc7f1c030fe25127fdda2ea706ac1 100755 (executable)
@@ -74,7 +74,7 @@ gpg_ssh_fingerprint() {
     trap "rm -f $tmpfile" EXIT
 
     # use temporary file, since ssh-keygen won't accept keys on stdin
-    gpg_user --export "$keyid" | openpgp2ssh "$keyid" >"$tmpfile"
+    gpg_user --export "$keyid" --no-armor | openpgp2ssh "$keyid" >"$tmpfile"
     ssh-keygen -l -f "$tmpfile" | awk '{ print $1, $2, $4 }'
 
     # remove the tmp file
index 6145c30fb8227395fe4e0ca9bdafac71cea3a0cb..d89febb690ed92c1c84f1f27eaa0f446b63fce1b 100755 (executable)
@@ -302,7 +302,7 @@ show_key() {
 
     # create the ssh key
     tmpssh="$GNUPGHOME"/ssh_host_key_rsa_pub
-    gpg --export "$fingerprint" 2>/dev/null \
+    gpg --export --no-armor "$fingerprint" 2>/dev/null \
        | openpgp2ssh 2>/dev/null >"$tmpssh"
 
     # list the host key info
index e735319800f36930fa26c0d488d59534254f4811..37f5305a46022f59ea2ed2a1c7e1d2cb76ac4a38 100644 (file)
@@ -478,7 +478,7 @@ gpg2ssh() {
     
     keyID="$1"
 
-    gpg --export "$keyID" | openpgp2ssh "$keyID" 2>/dev/null
+    gpg --export --no-armor "$keyID" | openpgp2ssh "$keyID" 2>/dev/null
 }
 
 # output known_hosts line from ssh key
index edc177ba59da50744746a082b0c3a08987c53807..36eab4f751ce21cdc1baefef000a0d5cc0782da5 100644 (file)
@@ -98,14 +98,14 @@ You might want to run 'monkeysphere gen-subkey'."
 
        if [ "$1" = '-d' ]; then
            # we're removing the subkey:
-           gpg_user --export "0x${subkey}!" | openpgp2ssh "$subkey" > "$workingdir/$kname"
+           gpg_user --export --no-armor "0x${subkey}!" | openpgp2ssh "$subkey" > "$workingdir/$kname"
            (cd "$workingdir" && ssh-add -d "$kname") || keysuccess="$?"
        else
            # we're adding the subkey:
            mkfifo "$workingdir/$kname"
            gpg_user --passphrase-fd 3 3<"$workingdir/passphrase" \
                --export-options export-reset-subkey-passwd,export-minimal,no-export-attributes \
-               --export-secret-subkeys "0x${subkey}!" | openpgp2ssh "$subkey" > "$workingdir/$kname" &
+               --export-secret-subkeys --no-armor "0x${subkey}!" | openpgp2ssh "$subkey" > "$workingdir/$kname" &
            (cd "$workingdir" && DISPLAY=nosuchdisplay SSH_ASKPASS=/bin/false ssh-add "$@" "$kname" </dev/null )&
 
            passphrase_prompt "Enter passphrase for key $kname: " "$workingdir/passphrase"
index 4ceabd45047c1ea81ada68a5cf837e2bbccf52e0..9b9eb05cc578ec4ca92a8dabaa02e27095084df6 100755 (executable)
@@ -355,6 +355,14 @@ echo "##################################################"
 echo "### ssh connection test for success..."
 ssh_test
 
+# Make sure it works if there is "armor" written in gpg.conf
+# add other weirdnesses here as they come up.
+echo
+echo "##################################################"
+echo "### testing functionality in the face of unusual gpg.conf settings..."
+echo 'armor' >> "$GNUPGHOME"/gpg.conf
+ssh_test
+
 # remove the testuser's authorized_user_ids file, update, and make
 # sure that the ssh authentication FAILS
 echo