1

On Windows apparently this can be achieved for google searches by creating a new CNAME record on your local DNS server for your local Google domain(s) pointing to forcesafesearch.google.com (although its unconfirmed as to whether this method works or is any better than simply editing your hosts file, which is also present on windows and works the same) But I would like to know if its possible to enforce safe search across all search engines using Ubuntu Desktop 18.04 LTS?

2 Answers2

1

I have answered this myself, since the only answer I received didn't work, but it got me thinking and after hours of research and testing I managed to get it working for Google Bing, Duckduckgo and Youtube, however I couldn't find a Yahoo equivalent and in any case I have blocked Yahoo completely since it doesn't (atow) play ball when it comes to privacy.

To lock safe search across the above search engines. Its simply a matter of remapping all of the domains for each search provider to their safe search IP addresses, here's how:

  1. In Ubuntu press CTR+ALT+T to open a terminal.
  2. In the terminal enter the following command and press enter, you'll be asked for your password:

sudo gedit /etc/hosts

  1. In the hosts file in the editor, cut and paste all of the lines as shown leaving any existing entries in your host file as they were. Also I had to dos2unix my /etc/hosts file as somehow I had introduced some invisible and incompatible symbols and consequently some URL to IP mappings weren't working and it took me some hours to realise:

216.239.38.120 www.google.com
216.239.38.120 www.google.co.uk
204.79.197.220 www.bing.com bing.com
204.79.197.220 www2.bing.com
204.79.197.220 www.bing.co.uk
204.79.197.220 www3.bing.com
46.137.218.113 duckduckgo.com
216.239.38.120 www.youtube.com
216.239.38.120 m.youtube.com
216.239.38.120 youtubei.googleapis.com
216.239.38.120 youtube.googleapis.com
216.239.38.120 www.youtube-nocookie.com

  1. Close and relaunch your web browser.

  2. Test safe search is locked for each search engine. For google after a search in the top right corner of the google page it should say SafeSearch on. Using Bing in the drop-down menu at the top right, it should say SafeSearch= Strict, for DuckDuckGo the Safesearch option is no longer displayed under the search box, although if you go into settings its there and allows you to turn SafeSearch Off, however it doesn't actually save the change despite the fact you can click Save. With Youtube you get the following message after a search which indicates SafeSearch is on and you will see that in Settings, Restricted Mode is locked ON:

Some results have been removed because Restricted Mode has been enabled by your network administrator.

0

You can modify /etc/dhcp/dhclient.conf as specified in this StackExchange answer.

Here's a list of DNS records required for various popular search engines:

  • Google: google.com. CNAME forcesafesearch
  • DuckDuckGo: duckduckgo.com. CNAME safe
  • Bing: bing.com. CNAME strict
  • YouTube: youtube.com. CNAME restrict
  • Yahoo: As far as I can tell there's no equivalent

Additionally you'll want to set up aliases for localized versions such as google.fi, google.nl etc. You may want to experiment with a record like google.*. CNAME forcesafesearch to see if dhclient.conf accepts wildcards like that.