Created
July 27, 2020 19:07
-
-
Save hbobenicio/ba1604e44e51767d64375bbd141dffd9 to your computer and use it in GitHub Desktop.
Download server certificates with openssl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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