summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2020-10-14 12:57:06 -0400
committerAndrew Cady <d@jerkface.net>2020-10-14 12:57:06 -0400
commitc228c4335198dbec2eebdc3d850e24b05928d58f (patch)
tree96e6cff9894e16fc32b023921d119f3edaec5d13
parent6a02ec3617ec30c7b9e60f073df7af9432e38a0b (diff)
behavior better
-rwxr-xr-xbin/samizdat-ssh-uid20
1 files changed, 11 insertions, 9 deletions
diff --git a/bin/samizdat-ssh-uid b/bin/samizdat-ssh-uid
index de81a46..2612bdc 100755
--- a/bin/samizdat-ssh-uid
+++ b/bin/samizdat-ssh-uid
@@ -43,15 +43,6 @@ ssh_keytag_to_path_fragment()
43 esac 43 esac
44} 44}
45 45
46if [ ! "$SSH_USER_AUTH" ]
47then
48 get_domain /etc/ssh/ssh_host_ed25519_key.pub || exit
49 printf '%s\n' "$domain"
50 exit
51fi
52
53[ -f "$SSH_USER_AUTH" ] || die "file does not exist: \$SSH_USER_AUTH=${SSH_USER_AUTH}"
54
55dispose_of_temp_pem_files() 46dispose_of_temp_pem_files()
56{ 47{
57 if [ "$1" = '--copy-pem' -a "$2" ] 48 if [ "$1" = '--copy-pem' -a "$2" ]
@@ -70,6 +61,17 @@ fixup_ssh_user_auth()
70 sed -ne 's/^publickey //p' 61 sed -ne 's/^publickey //p'
71} 62}
72 63
64
65if [ "$1" = self ]
66then
67 get_domain /etc/ssh/ssh_host_ed25519_key.pub || exit
68 printf '%s\n' "$domain"
69 exit
70fi
71
72[ "$SSH_USER_AUTH" ] || die "empty \$SSH_USER_AUTH; try ExposeAuthInfo=yes"
73[ -f "$SSH_USER_AUTH" ] || die "file does not exist: \$SSH_USER_AUTH=${SSH_USER_AUTH}"
74
73our_pem=$SSH_USER_AUTH.pem 75our_pem=$SSH_USER_AUTH.pem
74fixup_ssh_user_auth < "$SSH_USER_AUTH" > "$our_pem" || die "could not rewrite SSH_USER_AUTH file" 76fixup_ssh_user_auth < "$SSH_USER_AUTH" > "$our_pem" || die "could not rewrite SSH_USER_AUTH file"
75get_domain "$our_pem" 77get_domain "$our_pem"