Skip to content

Instantly share code, notes, and snippets.

@kckrinke
Created October 24, 2016 18:00
Show Gist options
  • Save kckrinke/9f96847b7a15438bcc162db907b4dd6f to your computer and use it in GitHub Desktop.
Save kckrinke/9f96847b7a15438bcc162db907b4dd6f to your computer and use it in GitHub Desktop.
Retrieve SSL (public) certificate from a remote host
#!/bin/bash
if [ -z "$1" ]
then
echo "usage: $(basename $0) <server:port>"
exit 1
fi
echo | openssl s_client -connect "$1" 2>&1 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment