Skip to content

Instantly share code, notes, and snippets.

@kljensen
Last active April 18, 2020 11:57
Show Gist options
  • Save kljensen/4ac38b1f0b28dada82bd87d05745be18 to your computer and use it in GitHub Desktop.
Save kljensen/4ac38b1f0b28dada82bd87d05745be18 to your computer and use it in GitHub Desktop.
download google ip addresses in order to whitelist in your firewall, e.g. pf.
#!/bin/sh
dig TXT +short _spf.google.com | \
tr ' ' '\n'| \
grep 'include:' | \
sed 's/include://' | \
xargs -Ixxx dig TXT +short xxx | \
tr ' ' '\n' | \
grep '^ip[46]:' | \
cut -c5-
# Outputs something like
# 35.190.247.0/24
# 64.233.160.0/19
# 66.102.0.0/20
# 66.249.80.0/20
# 72.14.192.0/18
# 74.125.0.0/16
# 108.177.8.0/21
# 173.194.0.0/16
# 209.85.128.0/17
# 216.58.192.0/19
# 216.239.32.0/19
# 2001:4860:4000::/36
# 2404:6800:4000::/36
# 2607:f8b0:4000::/36
# 2800:3f0:4000::/36
# 2a00:1450:4000::/36
# 2c0f:fb50:4000::/36
# 172.217.0.0/19
# 172.217.32.0/20
# 172.217.128.0/19
# 172.217.160.0/20
# 172.217.192.0/19
# 172.253.56.0/21
# 172.253.112.0/20
# 108.177.96.0/19
# 35.191.0.0/16
# 130.211.0.0/22
@kljensen
Copy link
Author

unclear if that is just the mail related google ip addresses

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment