# You can place this into '.bash_profile' to make it more accessible. # sslstatus google.com:443 sslstatus() { echo a=(${1//:/ }) PORT=443 if [ "${#a[@]}" -ne 2 ]; then if [ "${#1}" -lt 1 ] || [[ "$1" =~ ":" ]]; then echo "usage: ${0} HOST[:PORT]" echo echo "Note: If PORT was not provied, ${PORT} will be used by default." return; fi else PORT=(${a[1]}) fi HOST=(${a[0]}) echo "Checking SSL Cert on host \"${HOST}\" for port ${PORT}..." echo echo | openssl s_client -servername "${HOST}" -connect "${HOST}:${PORT}" 2>/dev/null | openssl x509 -noout -issuer -subject -email -dates -pubkey -fingerprint }