summaryrefslogtreecommitdiffstats
path: root/certs
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2016-07-12 15:59:01 +0200
committerGuilhem Moulin <guilhem@fripost.org>2016-07-12 15:59:01 +0200
commit47d951836afe2bd668b68e1754091a2fca69b89b (patch)
treec6efeb4c33f11df9627bde6306b3e4b5724452f1 /certs
parent00f942860717cf492c6bd8c8fc32652991683b20 (diff)
gencerts: make the SSHFPR output match the X509 ones.
Diffstat (limited to 'certs')
-rwxr-xr-xcerts/gencerts.sh10
1 files changed, 6 insertions, 4 deletions
diff --git a/certs/gencerts.sh b/certs/gencerts.sh
index 080257f..590fcfa 100755
--- a/certs/gencerts.sh
+++ b/certs/gencerts.sh
@@ -52,15 +52,17 @@ x509fpr2() {
}
sshfpr() {
- local msg="$1" host t h fpr
+ local msg="$1" host h fpr str
host="${msg%%,*}"; host="${host%% *}"; host="${host#*@}"; host="${host#\`}"; host="${host%\`}"
[ "$typ" = mdwn ] && { echo; echo " $msg"; echo; } || { echo " $msg" | tr -d '`'; }
[ "${host#*:}" != 22 ] || host="${host%%:*}"
+ [ "$typ" = mdwn ] && str= || str=' '
for h in MD5 SHA256; do
ssh-keygen -E "$h" -f "$DIR/../ssh_known_hosts" -lF "${host#*@}"
- done | sed -nr 's/^[^ #]+\s+//p' | sed -r 's/^(\S+)\s+(MD5|SHA256):/\1 \2 /' |
- while read t h fpr; do
- printf '%s %6s:%s\n' "$indent$t" "$h" "$fpr"
+ done | sed -nr 's/^[^ #]+\s+//p' | sed -r 's/^\S+\s+([^:]+):/\1 /' |
+ while read h fpr; do
+ str2="$str$(printf '%-6s' "$h" | tr '[a-z]' '[A-Z]')"
+ printf '%s %s\n' "$indent$str2" "$fpr"
done
}