diff options
author | Matthew Goins <mjgoins@openflows.com> | 2009-05-10 18:09:26 -0400 |
---|---|---|
committer | Matthew Goins <mjgoins@openflows.com> | 2009-05-10 18:09:26 -0400 |
commit | 8e5e66add8fdaada67288464750bc86fdb633b40 (patch) | |
tree | 84795854f2faed02a64ed71183527f956e722e3c /src | |
parent | 0f427687c9a2458b55502c748d0c44994ff31be7 (diff) | |
parent | 4ea066ebeb9b01afe213db3455ad1a1ff69c39ea (diff) |
Merge commit 'jrollins/master'
Diffstat (limited to 'src')
-rwxr-xr-x | src/monkeysphere | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/monkeysphere b/src/monkeysphere index 147c179..6f43632 100755 --- a/src/monkeysphere +++ b/src/monkeysphere @@ -50,6 +50,7 @@ subcommands: ssh-proxycommand HOST [PORT] monkeysphere ssh ProxyCommand --no-connect do not make TCP connection to host subkey-to-ssh-agent (s) store authentication subkey in ssh-agent + sshfpr (f) KEYID output ssh fingerprint of gpg key version (v) show version number help (h,?) this help @@ -61,6 +62,23 @@ gpg_user() { gpg --no-greeting --quiet --no-tty "$@" } +# output the ssh fingerprint of a gpg key +gpg_ssh_fingerprint() { + keyid="$1" + local tmpfile=$(mktemp) + + # trap to remove tmp file if break + trap "rm -f $tmpfile" EXIT + + # use temporary file, since ssh-keygen won't accept keys on stdin + gpg_user --export "$keyid" | openpgp2ssh "$keyid" >"$tmpfile" + ssh-keygen -l -f "$tmpfile" | awk '{ print $1, $2, $4 }' + + # remove the tmp file + trap - EXIT + rm -rf "$tmpfile" +} + # take a secret key ID and check that only zero or one ID is provided, # and that it corresponds to only a single secret key ID check_gpg_sec_key_id() { @@ -243,6 +261,10 @@ case $COMMAND in subkey_to_ssh_agent "$@" ;; + 'sshfpr'|'f') + gpg_ssh_fingerprint "$@" + ;; + 'version'|'v') version ;; |