Skip to content

Instantly share code, notes, and snippets.

@alecdwm
Created March 12, 2018 03:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alecdwm/7f89077ebf096aa236fbbd0f4753a8b2 to your computer and use it in GitHub Desktop.
Save alecdwm/7f89077ebf096aa236fbbd0f4753a8b2 to your computer and use it in GitHub Desktop.
Fetch the sha256 fingerprint of a TCP server's TLS cert
#!/bin/bash
# Works for any TLS-enabled TCP server, but originally intended for
# fetching the sha256 fingerprint of an irc server's TLS cert
# when the server refuses to use certificates from a trusted CA.
#
# Example:
# $ get-sha256-fingerprint.sh irc.owls.io:6697
openssl s_client -connect "$1" < /dev/null 2>/dev/null | openssl x509 -fingerprint -sha256 -noout -in /dev/stdin | sed -e "s/://g"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment