Openssl - Affichage de la chaîne de certificat
The snippet can be accessed without any authentication.
Authored by
erwan.salmon
Commande SSL permettant de lister la chaîne de certificat transmise par un serveur web.
Usage :
- Sans proxy
- sslchain-check.sh host:port
- Exemple : sslchain-check.sh www.w3.org:443
- Avec proxy
- sslchain-check.sh host:port proxyHost:proxyPort
- Exemple : sslchain-check.sh www.w3.org:443 mon-proxy:3128
#!/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
Please register or sign in to comment