Skip to content

Instantly share code, notes, and snippets.

@MattMencel
Last active November 22, 2016 22:09
Show Gist options
  • Save MattMencel/3de8ed5de4d59c75a8acf6455ead9311 to your computer and use it in GitHub Desktop.
Save MattMencel/3de8ed5de4d59c75a8acf6455ead9311 to your computer and use it in GitHub Desktop.
Get SPF Info From Google
require 'spf/query'
# regular metadata stuff below
# postfix recipe
q = SPF::Query::Record.query('_spf.google.com')
nets = []
q.include.each do |inc|
ips = SPF::Query::Record.query(inc.value)
ips.ip4.each do |ip|
nets << ip.value.to_s
end
end
node.set['google_spf'] = nets
include_recipe 'postfix'
# other recipe stuff below
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment