#!/usr/bin/env sh
for host in $@; do
openssl s_client -connect $host:443 < /dev/null | \
openssl x509 -noout -text | \
perl -ne 'if (/DNS/) {
s/^ +|DNS://g;
s/, /\n/g;
print;
}'
done