Open
Conversation
Author
|
Sorted those soft-tabs :) |
ioquatix
reviewed
Jun 10, 2021
|
|
||
| # 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") |
Member
There was a problem hiding this comment.
This can be improved.
require 'async'
require 'async/http/internet'
google_domains = Sync do
internet = Async::HTTP::Internet.new
response = internet.get("https://www.google.com/supported_domains")
response.read.split(/\n/)
ensure
response&.close
end
ioquatix
reviewed
Jun 10, 2021
| IN = Resolv::DNS::Resource::IN | ||
|
|
||
| # Start the RubyDNS server | ||
| RubyDNS::run_server(INTERFACES) do |
Member
There was a problem hiding this comment.
domains = Regexp.union(google_domains)
# Start the RubyDNS server
RubyDNS::run_server(INTERFACES) do
@logger.debug!
match(domains, IN::A) do |transaction|
transaction.respond!(Name.create('forcesafesearch.google.com'), resource_class: IN::CNAME)
end
otherwise do |transaction|
transaction.passthrough!(UPSTREAM)
end
end
Member
There was a problem hiding this comment.
Might need to tweak domains but this should avoid having to generate a script/server.
Member
There was a problem hiding this comment.
domains = /#{Regexp.union(google_domains)}\z/maybe sufficient.
henri
commented
Jun 11, 2021
| @logger.debug! | ||
|
|
||
| #match google.com | ||
| match(/^google.com$/, IN::A) do |transaction| |
Author
There was a problem hiding this comment.
In order to preserve sub-domains such as admin.google.com, docs.google.com etc.
It may be necessary to do an exact match. Maybe Google handles this? Probably better to only override the specific top level domains for the force safe search?
Author
There was a problem hiding this comment.
I do like the idea you suggested if that can work. Even if it is just matching the exact domains within an array.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Example added for forced Google safe search using DNS.