Created
February 23, 2018 19:06
-
-
Save moozer/0d96a020a6d858da3bc7c4a6efda4cd0 to your computer and use it in GitHub Desktop.
bash script for mail related DNS lookups
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ "x" = "x$1" ]; then | |
echo "usage: $0 <domain>" | |
exit 1 | |
fi | |
DOMAIN=$1 | |
echo "Mail servers (MX)" | |
dig +short $DOMAIN MX | |
echo | |
echo "TXT records" | |
dig +short $DOMAIN TXT | |
echo | |
echo "Verifying DKIM" | |
for PREFIX in "google._domainkey" "smtpapi._domainkey"; do | |
RES=$(dig +short $PREFIX.$DOMAIN TXT) | |
echo "$PREFIX.$DOMAIN: $RES" | |
done | |
echo | |
echo "Verifying CNAME" | |
for PREFIX in "" "shop." "www." "members."; do | |
RES=$(dig +short ${PREFIX}${DOMAIN} CNAME) | |
echo "$PREFIX$DOMAIN: $RES" | |
done | |
echo | |
echo "Verifying DMARC" | |
RES=$(dig +short _dmarc.$DOMAIN TXT) | |
echo "_dmarc.$DOMAIN: $RES" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment