Skip to content

Instantly share code, notes, and snippets.

@ghazlewood
Created September 5, 2017 15:58
Show Gist options
  • Save ghazlewood/56ad8c641b260b25431059e39fe4e440 to your computer and use it in GitHub Desktop.
Save ghazlewood/56ad8c641b260b25431059e39fe4e440 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# check the bare domain IP against the current CDN hostnames
#
# edit me!
DOMAINS=array( 'hiscoxbroker.co.uk' 'hiscox.de' 'hiscox.ie' )
for DOMAIN in "${DOMAINS[@]};" do
echo "checking $DOMAIN"
# gather details
BAREIP=`dig a $DOMAIN +short`
CDN=`dig $DOMAIN.cdn.cloudflare.net +short`
# compare
if [[ $CDN != *$BAREIP* ]]; then
echo "boop boop, bare domain for $DOMAIN is not a CDN load balancer IP!"
# else
# echo "do nothing"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment