diff options
author | Andrew Cady <d@jerkface.net> | 2020-10-14 12:57:06 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2020-10-14 12:57:06 -0400 |
commit | c228c4335198dbec2eebdc3d850e24b05928d58f (patch) | |
tree | 96e6cff9894e16fc32b023921d119f3edaec5d13 | |
parent | 6a02ec3617ec30c7b9e60f073df7af9432e38a0b (diff) |
behavior better
-rwxr-xr-x | bin/samizdat-ssh-uid | 20 |
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 | ||
46 | if [ ! "$SSH_USER_AUTH" ] | ||
47 | then | ||
48 | get_domain /etc/ssh/ssh_host_ed25519_key.pub || exit | ||
49 | printf '%s\n' "$domain" | ||
50 | exit | ||
51 | fi | ||
52 | |||
53 | [ -f "$SSH_USER_AUTH" ] || die "file does not exist: \$SSH_USER_AUTH=${SSH_USER_AUTH}" | ||
54 | |||
55 | dispose_of_temp_pem_files() | 46 | dispose_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 | |||
65 | if [ "$1" = self ] | ||
66 | then | ||
67 | get_domain /etc/ssh/ssh_host_ed25519_key.pub || exit | ||
68 | printf '%s\n' "$domain" | ||
69 | exit | ||
70 | fi | ||
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 | |||
73 | our_pem=$SSH_USER_AUTH.pem | 75 | our_pem=$SSH_USER_AUTH.pem |
74 | fixup_ssh_user_auth < "$SSH_USER_AUTH" > "$our_pem" || die "could not rewrite SSH_USER_AUTH file" | 76 | fixup_ssh_user_auth < "$SSH_USER_AUTH" > "$our_pem" || die "could not rewrite SSH_USER_AUTH file" |
75 | get_domain "$our_pem" | 77 | get_domain "$our_pem" |