Skip to content

Instantly share code, notes, and snippets.

@mtholder
Created January 17, 2021 20:36
Show Gist options
  • Save mtholder/096907ee6607256b58014dbb5d94ed34 to your computer and use it in GitHub Desktop.
Save mtholder/096907ee6607256b58014dbb5d94ed34 to your computer and use it in GitHub Desktop.
fetches an opentreeoflife server SSL cert and compares it to a local copy from ot50 - used to assure that newly updated certs are being served.
#!/bin/bash
i="${1}"
if test -z $i ; then
echo "Number like 51 for ot51 needed as an arg"
exit 1
fi
echo "fetching cert from ot$i to compare to a local copy of a cert from ot50"
if echo | openssl s_client -servername ot${i}.opentreeoflife.org -connect ot${i}.opentreeoflife.org:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ot${i}-certificate.crt
diff ot50-certificate.crt ot${i}-certificate.crt ; then
echo "Success"
else
echo "Failed"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment