projects
/
monkeysphere.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d6a9bf7
)
fix show_key function to handle user ID input (needed for import_key)
author
Jameson Rollins
<jrollins@finestructure.net>
Mon, 18 Jan 2010 16:42:30 +0000
(11:42 -0500)
committer
Jameson Rollins
<jrollins@finestructure.net>
Mon, 18 Jan 2010 16:42:30 +0000
(11:42 -0500)
src/monkeysphere-host
patch
|
blob
|
history
diff --git
a/src/monkeysphere-host
b/src/monkeysphere-host
index 8452e6c082dfddba52ace4638677da8c4e0b869d..eadd74bcedb1e4d1abdd896c199b7ebf4b18e63a 100755
(executable)
--- a/
src/monkeysphere-host
+++ b/
src/monkeysphere-host
@@
-189,8
+189,8
@@
multi_key() {
show_key() {
local id="$1"
local GNUPGHOME
show_key() {
local id="$1"
local GNUPGHOME
- local TMPSSH
local fingerprint
local fingerprint
+ local tmpssh
local revokers
# tmp gpghome dir
local revokers
# tmp gpghome dir
@@
-202,27
+202,29
@@
show_key() {
# import the host key into the tmp dir
gpg --quiet --import <"$HOST_KEY_FILE"
# import the host key into the tmp dir
gpg --quiet --import <"$HOST_KEY_FILE"
- # create the ssh key
- TMPSSH="$GNUPGHOME"/ssh_host_key_rsa_pub
- if ! gpg --export "$id" 2>/dev/null \
- | openpgp2ssh 2>/dev/null >"$TMPSSH" ; then
- failure "Key '$id' not found."
- fi
-
# get the gpg fingerprint
# get the gpg fingerprint
-
fingerprint=$(
gpg --quiet --list-keys \
+
if
gpg --quiet --list-keys \
--with-colons --with-fingerprint "$id" \
--with-colons --with-fingerprint "$id" \
- | grep '^fpr:' | cut -d: -f10 )
+ | grep '^fpr:' | cut -d: -f10 > "$GNUPGHOME"/fingerprint ; then
+ fingerprint=$(cat "$GNUPGHOME"/fingerprint)
+ else
+ failure "ID '$id' not found."
+ fi
+
+ # create the ssh key
+ tmpssh="$GNUPGHOME"/ssh_host_key_rsa_pub
+ gpg --export "$fingerprint" 2>/dev/null \
+ | openpgp2ssh 2>/dev/null >"$tmpssh"
# list the host key info
# FIXME: make no-show-keyring work so we don't have to do the grep'ing
# FIXME: can we show uid validity somehow?
# list the host key info
# FIXME: make no-show-keyring work so we don't have to do the grep'ing
# FIXME: can we show uid validity somehow?
- gpg --list-keys --list-options show-unusable-uids "$
id
" 2>/dev/null \
+ gpg --list-keys --list-options show-unusable-uids "$
fingerprint
" 2>/dev/null \
| grep -v "^${GNUPGHOME}/pubring.gpg$" \
| egrep -v '^-+$'
# list revokers, if there are any
| grep -v "^${GNUPGHOME}/pubring.gpg$" \
| egrep -v '^-+$'
# list revokers, if there are any
- revokers=$(gpg --list-keys --with-colons --fixed-list-mode "$
id
" \
+ revokers=$(gpg --list-keys --with-colons --fixed-list-mode "$
fingerprint
" \
| awk -F: '/^rvk:/{ print $10 }' )
if [ "$revokers" ] ; then
echo "The following keys are allowed to revoke this host key:"
| awk -F: '/^rvk:/{ print $10 }' )
if [ "$revokers" ] ; then
echo "The following keys are allowed to revoke this host key:"
@@
-237,7
+239,7
@@
show_key() {
# list the ssh fingerprint
echo -n "ssh fingerprint: "
# list the ssh fingerprint
echo -n "ssh fingerprint: "
- ssh-keygen -l -f "$
TMPSSH
" | awk '{ print $1, $2, $4 }'
+ ssh-keygen -l -f "$
tmpssh
" | awk '{ print $1, $2, $4 }'
# remove the tmp file
trap - EXIT
# remove the tmp file
trap - EXIT