#!/bin/sh usage() { echo "$0 host:port (proxyHost:proxyPort)" } # Le serveur à tester, supprimer le protocol si présent DESTINATION="${1#*//}" [ -z "$DESTINATION" ] && usage && exit 1 # Le proxy éventuel, supprimer le protocol si présent PROXY="$2" if [ -n "$PROXY" ]; then PROXY_OPTS="-proxy ${PROXY#*//}" # Bug openssl https://github.com/openssl/openssl/issues/17232 SNI_OPTS="-servername ${DESTINATION%:*}" fi # Connection à la destination SERVERNAME="-servername" openssl s_client -showcerts $PROXY_OPTS $SNI_OPTS -connect $DESTINATION </dev/null