X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=src%2Fshare%2Fm%2Fssh_proxycommand;h=33bd8a12c773c28648f9c3251a91e98b43c1c53d;hb=c600e3474acfee2e4eff1f000a1131c0f5905d08;hp=74b0f85cd9d685b5702f26eecc61ec2719a20fde;hpb=c0724b8e7aefd9ced1740a970941928f5b168b2b;p=monkeysphere.git diff --git a/src/share/m/ssh_proxycommand b/src/share/m/ssh_proxycommand index 74b0f85..33bd8a1 100644 --- a/src/share/m/ssh_proxycommand +++ b/src/share/m/ssh_proxycommand @@ -15,6 +15,55 @@ # established. Can be added to ~/.ssh/config as follows: # ProxyCommand monkeysphere ssh-proxycommand %h %p +# output the key info, including the RSA fingerprint +show_key_info() { + local keyid="$1" + local sshKeyGPGFile + local sshFingerprint + local gpgSigOut + local otherUids + + # get the ssh key of the gpg key + sshKeyGPGFile=$(msmktempfile) + gpg2ssh "$keyid" >"$sshKeyGPGFile" + sshFingerprint=$(ssh-keygen -l -f "$sshKeyGPGFile" | \ + awk '{ print $2 }') + rm -f "$sshKeyGPGFile" + + # get the sigs for the matching key + gpgSigOut=$(gpg_user --check-sigs \ + --list-options show-uid-validity \ + "$keyid") + + echo | log info + + # output the sigs, but only those on the user ID + # we are looking for + echo "$gpgSigOut" | awk ' +{ +if (match($0,"^pub")) { print; } +if (match($0,"^uid")) { ok=0; } +if (match($0,"^uid.*'$userID'$")) { ok=1; print; } +if (ok) { if (match($0,"^sig")) { print; } } +} +' + + # output ssh fingerprint + cat <"$sshKeyGPGFile" - sshFingerprint=$(ssh-keygen -l -f "$sshKeyGPGFile" | \ - awk '{ print $2 }') - rm -f "$sshKeyGPGFile" - - # get the sigs for the matching key - gpgSigOut=$(gpg_user --check-sigs \ - --list-options show-uid-validity \ - "$keyid") - - # output the sigs, but only those on the user ID - # we are looking for - echo "$gpgSigOut" | awk ' -{ -if (match($0,"^pub")) { print; } -if (match($0,"^uid")) { ok=0; } -if (match($0,"^uid.*'$userID'$")) { ok=1; print; } -if (ok) { if (match($0,"^sig")) { print; } } -} -' | log info - echo | log info - - # output the other user IDs for reference - if (echo "$gpgSigOut" | grep "^uid" | grep -v -q "$userID") ; then - log info < 0)) ; then + log info <