Last active
December 17, 2017 07:44
-
-
Save kousu/fa097f7205921793d8d598da2e6837e6 to your computer and use it in GitHub Desktop.
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 | |
# extract Google's published list of outbound-going smtp servers, for purposes of whitelisting them | |
# from https://support.google.com/a/answer/60764?hl=en | |
# the results come back in CIDR notation, so be sure to handle that | |
# subtlety: i="" on the first iteration, because there is (currently) no _netblocks1, there's just _netblocks | |
(for i in "" `jot 3 1 3`; do | |
dig TXT _netblocks$i.google.com @8.8.8.8 +short; | |
done) | | |
awk -F ":" -v RS=" " '/^ip4:/ { print $2 }' | |
# NB: if you're on linux replace `jot 3 1 3` with `seq 1 3` | |
# See also | |
# https://marc.info/?l=openbsd-misc&m=150679676125582&w=2 | |
# http://web.britvault.co.uk/products/ungrey-robins/ | |
# https://mail.live.com/mail/ipspace.aspx -> for hotmail | |
# https://answers.yahoo.com/question/index?qid=20100317121021AAog2Vp -> for yahoo, though with an unsatisfying result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment