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
# 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
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
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"
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