Use DNS to force youtube into restricted mode - and Pi-Hole

Unfortunately, this doesn't help. pihole handles DNS entries and isn't capable of adding/modifying stuff to URL's, at least not that I know of.

The idea is to provide safe search without any local user interaction, local installation on the target machine(s), or possibility to tamper with the result.

Hey folks, I have made a script to make this much easier!
https://raw.githubusercontent.com/jaykepeters/Scripts/Deployment/Pi-hole_SafeSearch.sh

4 Likes

Thanks for the feedback, @anon55913113! I will work to implement this into the next version within an hour or so. I am not 100% sure if DuckDuckGo can be forced into SafeSearch all the time, but for now we will just add it to the CNAME's in "/etc/dnsmasq.d/05-restrict.conf" and safe.duckduckgo.com will be added to the hosts file, per your request. You are more than welcome to collaborate with me on this on GitHub as well.

I think your idea works!
And when I try to turn safesearch off, it stays on! DuckDuckGo must have recently added this functionality as it did not work earlier this year (May/June)

You will never see it using forcesafesearch.google.com or safe.duckduckgo.com in the web browser, DNS does that behind the scenes. That is because it is a CNAME record. I may have mislead you, I attempted to to it in May/June but it did not work. Now it does work. This has been an open feature request with duckduckgo for some time now.

As you can see below, it is working for me:
image

How do the last lines of /etc/dnsmasq.d/05-restrict.conf and /etc/hosts look?

I have tried this with two pi-holes and I can confirm it is working. Is your devices' DNS cache cleared and is it using Pi-hole as it's ONLY dns server? This would cause conflict.

Try my main Public Pi-hole at 35.188.83.81, and only use 35.239.60.156 if that does not respond.... They should have Safesearch enabled...

Thanks for checking it out! I will work on that tomorrow... So can you really eliminate the hosts entries now? How about google since there are 300+ domains...

And where would this be added?

Use this: http://35.188.83.81/UniPi.php?q=ss
Do you see how google has 300+ top level domains. Each of them needs a CNAME DNS record to enforce SafeSearch. The question I was asking was: Would I just need 1 host record for Google SafeSearch forcesafesearch.google.com so I don't have to put it in the hosts file? I don't understand what your regex is for either. Is it to block other websites that may expose adult content?

Ok, I see. You have IPV4 and IPv6 records. Could I put multiple IPV4 addresses to point to a host and dnsmasq would do it round robin? Or should I radnomly select an IP?

Happy New Year!

I am working on making a python command line tool to acomplish this very task. This is turning into more of a project and I don't think bash will do the trick anymore. I will have it done by the end of the week.

1 Like

Hi, you could do a script to go back this function? or a button to activate o deactivate? Thanks

1 Like

Yes, this is a very useful and important feature

1 Like

Sure thing! I was initially planning that, just wouldn't get to it until this week. Do you want the controls to be granular, for say enable and disable Youtube, Duckduckgo, Google SafeSearch, etc? Or do you just want all of those together in the script?

Please let me know,

Thanks,

Jayke

Thanks, I see. You can add multiple host-records and when you use the dig command, multiple IP addresses will be returned.

host-record=www.example.com,1.1.1.1
host-record=www.example.com,1.1.1.2
host-record=www.example.com,1.1.1.3
1 Like

I think it should be a feature included from the installation and the best would be if you could choose which domains to activate this function (YouTube, Duckduckgo, Google SafeSearch, etc), thank you for your time and consideration on the subject .. but it is certainly helpful for families who have small children

3 Likes

Yes, I agree. As of now, the Enable and Disable functions have been added.

1 Like

As you can read here, It's a feature in AdGuard Home.

1 Like

Perfect! need development for web interface feature! :slight_smile:

If this is a desired feature, please submit a feature request.

okok a do it now