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

Asking for a little help please...

Where do I ran the script above? should it be in the /root folder or should in be in /opt/pihole folder?
In case I ran the script will the file /etc/dnsmasq.d/05-restrict.conf and the /tmp/safesearch.txt be created automatically?

do have to copy paste something on the /etc/pihole/reges.list and on the /etc/pihole/local.list?

do i have to change permissions on any of the files after running the script?

Thank you for this wonderful guide

1 Like

Thanks for reaching out! You can move the script into /usr/local/bin if you are on Debian/Ubuntu/Raspbian. Make sure that it has execute permissions chmod a+x <path to script>. It will create the file /tmp/safesearch.txt as well as /etc/dnsmasq.d/05-restrict.conf. To enable SafeSearch, use the command Pi-hole_SafeSearch.sh -e to enable, or whatever you renamed the file to. Hope that helps. If you have any further questions or need one on one help, please message me directly.

Thanks,

Jayke

Thank You very much Jayke, its working

You helped make browsing safe for kids again for one more home.

1 Like

That was my goal :slight_smile:

You're very welcome!

Thanks, I will test out those rgegexps.

Can i force youtube redirect to invidious with this ? How?? Please dont forget the embedded youtube videos. I need the same functionalities as with the firefox addon invidition:

Possible or not?

That's good! Haha, I do that too sometimes.

anyone that can help me with this please??

Can you direct message me? I will give you email help too...

Here's how you would get the script going:

wget https://raw.githubusercontent.com/jaykepeters/Scripts/Deployment/Pi-hole_SafeSearch.sh

mv ./Pi-hole_SafeSearch.sh /usr/local/bin/

chmod a+x /usr/local/bin/Pi-hole_SafeSearch.sh

Pi-hole_SafeSearch.sh -e OR Pi-hole_SafeSearch.sh --enable

Please check back here for updates as I may release a new version of the script.

My script basically does everything that the above threads here mentioned. All we are doing is editing the dnsmasq (pihole-FTL) configuration files. Many people have helped me out on this one so it is more of a community effort. Thanks for reaching out here though.

2 Likes

I get that I'm in the minority here, but can anyone describe how to do this with hassio (homeassistant)? I have pihole running as an add-on and I'm not entirely sure how to access the pihole's filesystem in particular.

1 Like

What is hassio?

1 Like

Thnx for all the hard and usefull work. It works really great but is it possible to add yahoo also? Or maybe it is and I do something wrong.

Sincerely,
Harald

Unfortunately, Yahoo does not yet have a DNS-level SafeSearch enforcement option. At the moment, the only way that Yahoo can be forced into SafeSearch mode is via an https proxy; the method currently in use by many schools and businesses, however there is a workaround to prevent inappropriate visuals from being displayed in search. All you would have to do is block the following domains: images.search.yahoo.com, video.search.yahoo.com. My script should already block these domains. If you are not comfortable with this workaround, then you could just block Yahoo entirely, if nobody on your network uses it. An example of an upstream DNS provider that blocks these domains is CleanBrowsing.org, when set to the Family Filter mode. I will be updating the script here soon to have the list of hosts pulled from github, and that way users can suggest new search providers to blocked or forced into SafeSearch mode.

Thnx for the respond and the explanation. Im gonna use the CleanBrowsing DNS with your script and get the most out of it.

Thank you very much,
Harald

1 Like

Sounds good! If you have any questions, please let me know.

2 posts were split to a new topic: FTL not running are YouTube restricted mode change

Hi jaykepeters. I have run the commands on my ubuntu server that is running Pi-Hole but it does not seem te work. Anything I am missing? When i run Pi-hole_SafeSearch.sh -enable I get the following

Removing /tmp/safesearch.txt
Retrieving List from Google
194 TLDs
388 Domain
ENABLING SAFESEARCH FOR PI-HOLE
BLOCKING OTHER BAD SITES

I changed the dns on a client but I think that I am still going to normal youtube. Not the restricted one.

Are you using the latest version of the script with sudo?

I got the same output when I ran the command on my machine:

I would have to investigate as to why the client is still going to normal youtube. If it is a desktop, or a mobile device, sometimes restarting the device or flushing the dns cache will solve the issue. If not, please reach out. I have experienced this before myself.