diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2016-03-28 00:42:52 +0300 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2016-03-28 00:45:52 +0300 |
commit | 67689b1deb57def7c2512b59ad911bc94ae78aa3 (patch) | |
tree | fe77e26ce588f16750cbddb7699169c162a1a964 /certs | |
parent | 20e56d8416683e25b4999a57579eb304c06be985 (diff) |
gencerts.sh: improve formatting.
Diffstat (limited to 'certs')
-rwxr-xr-x | certs/gencerts.sh | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/certs/gencerts.sh b/certs/gencerts.sh index 181767e..9c25f6c 100755 --- a/certs/gencerts.sh +++ b/certs/gencerts.sh @@ -19,11 +19,12 @@ usage() { x509fpr() { local msg="$1" host cert h spki - host="${msg%%,*}"; host="${msg%% *}" + host="${msg%%,*}"; host="${host%% *}"; host="${host#\`}" cert="$DIR/${host%%:*}.pem" spki=$(openssl x509 -noout -pubkey<"$cert" | openssl pkey -pubin -outform DER | openssl dgst -sha1 | sed -nr 's/^[^=]+=\s*//p') [ "$typ" = mdwn ] && printf '\n [[%s|https://crt.sh/?spkisha1=%s&iCAID=16418]]\n\n' "$msg" "$spki" \ - || printf ' %s\n X.509: https://crt.sh/?spkisha1=%s&iCAID=16418\n SPKI:\n' "$msg" "$spki" + || printf ' %s\n X.509: https://crt.sh/?spkisha1=%s&iCAID=16418\n SPKI:\n' \ + "$( echo "$msg" | tr -d '`' )" "$spki" for h in sha1 sha256; do [ "$typ" = mdwn ] || echo -n ' ' echo -n "$h" | tr '[a-z]' '[A-Z]' @@ -34,8 +35,8 @@ x509fpr() { sshfpr() { local msg="$1" host t h fpr - host="${msg%%,*}"; host="${msg%% *}"; host="${host#*@}" - [ "$typ" = mdwn ] && { echo; echo " $msg"; echo; } || echo " $msg" + host="${msg%%,*}"; host="${host%% *}"; host="${host#*@}"; host="${host#\`}"; host="${host%\`}" + [ "$typ" = mdwn ] && { echo; echo " $msg"; echo; } || { echo " $msg" | tr -d '`'; } [ "${host#*:}" != 22 ] || host="${host%%:*}" for h in MD5 SHA256; do ssh-keygen -E "$h" -f "$DIR/../ssh_known_hosts" -lF "${host#*@}" @@ -52,26 +53,26 @@ allfpr() { [ "$typ" = mdwn ] && indent=' ' || indent=' ' cat <<- EOF * IMAP server - $(x509fpr 'imap.fripost.org:993 (IMAP over SSL), sieve.fripost.org:4190 (ManageSieve, STARTTLS)') + $(x509fpr '`imap.fripost.org:993` (IMAP over SSL), `sieve.fripost.org:4190` (ManageSieve, `STARTTLS`)') - * SMTP servers (STARTTLS) - $(x509fpr 'smtp.fripost.org:587 (Mail Submission Agent)') + * SMTP servers + $(x509fpr '`smtp.fripost.org:587` (Mail Submission Agent, `STARTTLS`)') - $(x509fpr 'mx1.fripost.org:25 (1st Mail eXchange)') + $(x509fpr '`mx1.fripost.org:25` (1st Mail eXchange, `STARTTLS`)') - $(x509fpr 'mx2.fripost.org:25 (2nd Mail eXchange)') + $(x509fpr '`mx2.fripost.org:25` (2nd Mail eXchange, `STARTTLS`)') * Web servers - $(x509fpr 'fripost.org:443 (website), wiki.fripost.org:443 (wiki)') + $(x509fpr '`fripost.org:443` (website), `wiki.fripost.org:443` (wiki)') - $(x509fpr 'mail.fripost.org:443 (webmail)') + $(x509fpr '`mail.fripost.org:443` (webmail)') - $(x509fpr 'lists.fripost.org:443 (list manager)') + $(x509fpr '`lists.fripost.org:443` (list manager)') - $(x509fpr 'git.fripost.org:443 (git server and its web interface)') + $(x509fpr '`git.fripost.org:443` (git server and its web interface)') * SSH server - $(sshfpr 'gitolite@git.fripost.org:22') + $(sshfpr '`gitolite@git.fripost.org:22`') EOF } |