How To Enforce YouTube Safety Mode To Block Objectionable Content With SafeSquid Content Filtering Proxy

Want to support HowtoForge? Become a subscriber!
 
Submitted by Sean (Contact Author) (Forums) on Tue, 2010-02-23 11:26. :: Security

How To Enforce YouTube Safety Mode To Block Objectionable Content With SafeSquid Content Filtering Proxy

Google recently announced 'Safety Mode' for YouTube. When you opt in to Safety Mode, videos containing mature content, objectionable material, or age restrictions will be filtered out of the site's search results. If a user inputs a direct link to a mature video, Safety Mode blocks viewing. You also have the option of 'locking' Safety Mode. When you see the 'Safety Mode' option at the bottom of any YouTube video page, you can choose to opt in to the service and lock that preference with your YouTube account password (you have to be logged in). That setting will be locked until the password is input to change it. It can not be unlocked by any other YouTube account.

YouTube Safety Mode has a few problems. Safety Mode is browser based. This means that it will be enabled only on the browser that you used to enable it. If a user accesses YouTube from the same machine, but another browser, Safety Mode will not be applied. It is also not very difficult to bypass Safety Mode. It is cookie based, so all a user needs to do, is delete cookies from YouTube, or all cookies, and it gets disabled.

You can 'enforce' Youtube Safety Mode at the Internet Gateway with SafeSquid. Once enforced, it will be applied, irrespective of a users preference settings, or browser used. The procedure to enforce Youtube Safety Mode is quite simple. All you need to do is import the rule snippet to enforce Youtube Safety Mode, available at SafeSquid Downloads website, into your config file, as explained below. 

 

Importing Youtube Safety Mode rule snippet into your config file

To import the Youtube Safety Mode rule snippet into your config file -

  1. Click on Load settings from the Top Menu of the interface
  2. Specify the URL of the rule snippet - http://downloads.safesquid.net/contrib/sample_rules/youtube_safety_mode.xml
  3. Set Overwrite to No (important)
  4. Click on the Submit button

You should get a message - 'File loaded'. Click on Save settings in the Top Menu and save the changes to your config.xml to make it permanent.

 

Testing Youtube Safety Mode

Once you have imported the rule snippet into your config file and saved settings, open any browser configured to use SafeSquid as proxy, and access youtube.com. Notice that 'Safety Mode is on' is displayed next to the search box. When you try to search for objectionable content, you will see a message in red saying 'The word "porn" has been filtered from the search because Safety Mode is enabled". You do get results, but objectionable content is 'almost' filtered out. 


YouTube Safety Mode Enabled

You can try disabling Safety Mode by clicking on the 'Safety Mode is on' option at the bottom of the page. You will find that disabling Safety Mode does not have any effect, and it remains enabled.


Option to enable or disable Safety Mode on YouTube 

 

How it works

When you import the rule snippet for enforcing Safety Mode, the following rules are imported into your config file:


Rules imported to the Profiles section 


Rule imported to the Rewrite Document Section 

The first rule in Profiles section identifies requests made for youtube.com, and adds them a profile UNSAFE_YOUTUBE.

The second rule analyzes the 'Request Header Pattern' of the client, to check if a string - PREF= f28000000 exists in cookie being sent to the host. This string will be found, only if the client has opted for Safety Mode. If the string is found, this rule removes the profile UNSAFE_YOUTUBE from the request, and adds a profile SAFE_YOUTUBE to it, and the request is forwarded to the host. If the string is not found, the request still carries the UNSAFE_YOUTUBE profile. The rule under Rewrite document section acts upon such requests, and inserts the string in the cookie section of the client request headers, and forwards the request to the host. So effectively, all requests that are sent to the host, i.e. youtube.com, carry the 'Safety Mode Enabled' preference string. This makes youtube serve only filtered results to the client.

Download: You can download SafeSquid free editions from here.

Also see: Other tutorials for SafeSquid 


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Sean (registered user) on Fri, 2010-02-26 14:28.

Hi,

You can watch a video on this tutorial at - http://bit.ly/cAP8r3

Regards.