Skip to content

Instantly share code, notes, and snippets.

@fredjoseph
Created November 17, 2022 13:21
Show Gist options
  • Save fredjoseph/85bcafe20bc7bc27170d966697172659 to your computer and use it in GitHub Desktop.
Save fredjoseph/85bcafe20bc7bc27170d966697172659 to your computer and use it in GitHub Desktop.
Script for downloading a certificate
#!/bin/sh
#
# usage: retrieve-cert.sh remote.host.name [port]
#
REMHOST=$1
REMPORT=${2:-443}
echo |\
openssl s_client -connect ${REMHOST}:${REMPORT} 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