Skip to content

Instantly share code, notes, and snippets.

@henri
Last active June 9, 2021 02:04
Show Gist options
  • Save henri/4ba740660c6faeaedb9d4d281e5ad4e3 to your computer and use it in GitHub Desktop.
Save henri/4ba740660c6faeaedb9d4d281e5ad4e3 to your computer and use it in GitHub Desktop.
Ruby DNS Google Safe Search Rule Builder
#!/usr/bin/env ruby
# copyright 2021, henri shustak
# build google force safe search ruls for rubyDNS
google_domains = `curl https://www.google.com/supported_domains 2>> /dev/null | sed "s/^.//g"`.split("\n")
google_domains.each do | dom |
puts ""
puts "#match #{dom}"
puts "match(/^#{dom}$/, IN::A) do |transaction|"
puts " transaction.respond!(Name.create('forcesafesearch.google.com'), resource_class: IN::CNAME)"
puts "end"
puts "match(/^www.#{dom}$/, IN::A) do |transaction|"
puts " transaction.respond!(Name.create('forcesafesearch.google.com'), resource_class: IN::CNAME)"
puts "end"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment