Skip to content

Instantly share code, notes, and snippets.

@SlootSantos
Last active May 22, 2022 21:53
Show Gist options
  • Save SlootSantos/331687043f94fbc6a77bebc9225faa8b to your computer and use it in GitHub Desktop.
Save SlootSantos/331687043f94fbc6a77bebc9225faa8b to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
# making sure we read the NAME_SERVER variable from the CDK CFN output as an array
IFS=' ' read -r -a NS_ARRAY <<< "$DELEGATED_NAME_SERVERS"
# storing the name servers from the dig request as an array too
DIG_RESULT=($(dig +short NS ${DELEGATED_DOMAIN_NAME}))
for nsEntry in ${DIG_RESULT[@]};
do
echo "checking: $nsEntry"
# checking if that name server exists in the configured name server list
if [[ " ${NS_ARRAY[*]} " =~ " ${nsEntry} " ]];
then echo "Success!";
else echo "Failure!" && exit 1;
fi;
done
echo "successfully verified all Name Servers and delegated subdomain reachability"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment