Skip to content

Instantly share code, notes, and snippets.

@hbobenicio
Created July 27, 2020 19:07
Show Gist options
  • Save hbobenicio/ba1604e44e51767d64375bbd141dffd9 to your computer and use it in GitHub Desktop.
Save hbobenicio/ba1604e44e51767d64375bbd141dffd9 to your computer and use it in GitHub Desktop.
Download server certificates with openssl
#!/bin/bash
set -eu -o pipefail
HOST="foo.bar"
PORT="443"
CERTS_FILE_PATH="certs.pem"
openssl s_client \
-showcerts \
-connect "${HOST}:${PORT}" < /dev/null 2> /dev/null \
| openssl x509 -outform PEM > "${CERTS_FILE_PATH}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment