Skip to content

Instantly share code, notes, and snippets.

@petRUShka
Created January 25, 2017 17:48
Show Gist options
  • Save petRUShka/af96ae25ce8280729b9ea049b929f31d to your computer and use it in GitHub Desktop.
Save petRUShka/af96ae25ce8280729b9ea049b929f31d to your computer and use it in GitHub Desktop.
get certificates
#!/bin/sh
SERVER=${1:-my.server.com}
PORT=${2:-993}
CERT_FOLDER=${3:-~/certs}
openssl s_client -connect ${SERVER}:${PORT} -showcerts 2>&1 < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'| sed -ne '1,/-END CERTIFICATE-/p' > ${CERT_FOLDER}/${SERVER}.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment