Created
October 2, 2023 22:48
-
-
Save mtik00/fe1e5a580dff23b3c3f110908efd665d to your computer and use it in GitHub Desktop.
SSL/TLS cert check using 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
#!/usr/bin/env bash | |
set -euo pipefail | |
SERVERNAME=${1:-""} | |
PORT=${2:-443} | |
if [[ -z "${SERVERNAME}" ]]; then | |
printf "Usage:\n" | |
printf " sslcheck <servername>\n" | |
printf " sslcheck <servername> <port>\n" | |
exit -1 | |
fi | |
printf "host ${SERVERNAME}\n" | |
host "${SERVERNAME}" | |
printf "\n\n" | |
printf "echo QUIT | openssl s_client -connect ${SERVERNAME}:${PORT} -servername ${SERVERNAME} 2> /dev/null | openssl x509 -noout -dates -subject -issuer\n\n" | |
echo QUIT | openssl s_client -connect ${SERVERNAME}:${PORT} -servername ${SERVERNAME} 2> /dev/null | openssl x509 -noout -dates -subject -issuer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment