summaryrefslogtreecommitdiff
path: root/bin/samizdat-ssh-uid
diff options
context:
space:
mode:
Diffstat (limited to 'bin/samizdat-ssh-uid')
-rwxr-xr-xbin/samizdat-ssh-uid23
1 files changed, 17 insertions, 6 deletions
diff --git a/bin/samizdat-ssh-uid b/bin/samizdat-ssh-uid
index 94d8f8c..33cb2b4 100755
--- a/bin/samizdat-ssh-uid
+++ b/bin/samizdat-ssh-uid
@@ -19,12 +19,23 @@ SSH_CLIENT_FINGERPRINT=$(ssh-keygen -r . -f "${PEMFILE}" | sed -ne 's/^. IN SSHF
19SSH_CLIENT_FINGERPRINT_B32=$(b16_to_b32 "$SSH_CLIENT_FINGERPRINT") 19SSH_CLIENT_FINGERPRINT_B32=$(b16_to_b32 "$SSH_CLIENT_FINGERPRINT")
20 20
21read keytype keydata < "${PEMFILE}" || die "reading from PEMFILE=$PEMFILE" 21read keytype keydata < "${PEMFILE}" || die "reading from PEMFILE=$PEMFILE"
22case "$keytype" in 22
23 ssh-rsa|ssh-dss|ecdsa-sha2-nistp256|ssh-ed25519) 23ssh_keytag_to_path_fragment()
24 domain=$keytype.cryptonomic.net ;; 24{
25 *) 25 case "$1" in
26 die "Unsupported key type: $keytype" ;; 26 ssh-dss) echo dsa ;;
27esac 27 ecdsa-sha2-nistp256) echo ecdsa ;;
28 ssh-rsa|ssh-ed25519) echo ${1#ssh-} ;;
29 *) return 1 ;;
30 esac
31}
32
33if keyfrag=$(ssh_keytag_to_path_fragment "$keytype")
34then
35 domain=${keyfrag}.cryptonomic.net
36else
37 die "Unsupported key type: $keytype"
38fi
28 39
29if [ "$1" = '--copy-pem' -a "$2" ] 40if [ "$1" = '--copy-pem' -a "$2" ]
30then 41then