Skip to content

Instantly share code, notes, and snippets.

@danbeam
Created October 19, 2011 08:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danbeam/1297765 to your computer and use it in GitHub Desktop.
Save danbeam/1297765 to your computer and use it in GitHub Desktop.
One-liner to get gmail CIDRs (and add to ufw)
dig gmail.com txt | grep redirect= | cut -d'=' -f3- | cut -d'"' -f1 | xargs -I{} dig {} txt | egrep '^[^;].*TXT' | cut -d'"' -f2 | tr " " "\n" | grep ^ip4: | cut -d':' -f2- | xargs -I{} sudo ufw allow from {} to any proto tcp port 25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment