WILDCARD="\*.example.com"
を適宜変更grep rrset /path/to/Routefile
の部分は以下の様な出力になれば他のものでも良い
dev.example.com
stg.example.com
qa.example.com
prod.example.com
#!/bin/bash | |
WILDCARD="\*.example.com" | |
ROUTEFILE=/path/to/routefile | |
for domain in $(grep rrset ${ROUTEFILE} | awk '{print $2}' | sed -e 's/[",]//g' | sed -e 's/[.]$//g' | sort | uniq); do | |
if echo $domain | grep ^\* -qs ; then | |
d=$(echo $domain | sed -e 's/\*/test/') | |
curl --connect-timeout 1 curl -s --head -v https://${d}/ 2>&1 | grep -qs "Server certificate: ${WILDCARD}" | |
else | |
curl --connect-timeout 1 curl -s --head -v https://${domain}/ 2>&1 | grep -qs "Server certificate: ${WILDCARD}" | |
fi | |
[ $? -eq 0 ] && echo $domain | |
done |