Skip to content

Instantly share code, notes, and snippets.

@zunda
Last active January 25, 2023 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zunda/8efe9b184aceb8e930fd56f769084c97 to your computer and use it in GitHub Desktop.
Save zunda/8efe9b184aceb8e930fd56f769084c97 to your computer and use it in GitHub Desktop.
Run `openssl x509` on each of certificates obtained with `openssl s_client`
#
# Copyright 2022 zunda <zundan at gmail.com>
#
# Permission is granted for use, copying, modification, distribution,
# and distribution of modified versions of this work as long as the
# above copyright notice is included.
#
connectname=mastodon.zunda.ninja
servername=$connectname
IFS=@
for pem in `:| openssl s_client -showcerts -connect $connectname:443 -servername $servername 2>/dev/null |\
sed -n 's/-----END CERTIFICATE-----/&@/;/-----BEGIN CERTIFICATE-----/,/-----END CERTIFICATE-----/p'`; do
echo $pem | openssl x509 -inform pem -noout -text -certopt no_pubkey,no_sigdump
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment