How do I Allow a Specific YouTube Channel?

Article #:

Product

Castle

KB-86

Guardian

All

Summary

This article describes what steps to take in order to configure your Smoothwall to allow access to a specific YouTube channel or user whilst leaving the rest of YouTube blocked.

Problem

You would like your users to be able to view YouTube videos from a specific YouTube channel or YouTube user whilst continuing to restrict access to the rest of YouTube.

Before continuing with this article you should be aware that these instructions require enabling and using advanced features - and there are several steps to take before this will work. You should read the article in full before attempting to apply these changes.

Solution

Warning: This article requires enabling advanced functionality and should only be attempted by experienced users.

Limitations and Restrictions

  • In order for this solution to work correctly you must have an HTTPS Decrypt and Inspect policy set up to cover the YouTube category as a bare minimum.
  • These instructions will not work on mobile apps such as Android/iOS but will work through the browser on any device.

Step 1 - Enabling Advanced functionality

The first step we must take is to enable some hidden Advanced functionality on your Smoothwall which will provide us with some additional configuration options later on. To enable the Advanced functionality:

  1. SSH onto your Smoothwall.
  2. Execute the following commands separately:
echo 1 > /modules/guardian3/settings/ui/blocklist/advanced
echo 1 > /modules/guardian3/settings/ui/blocklist/group_advanced

Step 2 - Obtaining a YouTube channel ID or User ID

Next we must obtain the unique YouTube channel ID or user ID which we want to allow access to. All channels and users have a unique ID, however it is sometimes hidden from view.

To find a YouTube user ID:

  1. Visit the YouTube users home page, for example, youtube.com/user/SmoothWallTV
  2. View the page source (right-click and select View page source)
  3. Press CTRL + F on your keyboard and search for:

meta itemprop=”channelID”

You should see something similar to the following:

<meta itemprop="channelId" content="UCAZJt3Tv4qkyNBTEGEdzbYQ">

where UCAZJt3Tv4qkyNBTEGEdzbYQ is the channel ID, in this case, the ID for Smoothwall TV.

To find a YouTube channel ID:

Visit the YouTube channel you want to allow access to, for example,

https://www.youtube.com/channel/UCSGURayonindsMn_EYXx8Xg

Take note of the last section of the URL after "channel", in this case, UCSGURayonindsMn_EYXx8Xg.

Step 3 - Setting up a custom category

The custom category is used to identify and allow YouTube videos from the specified YouTube channel or user.

  1. Go to Guardian > Policy objects > Categories.
  2. Enter a suitable Name, for example, YouTube allowed channels.
  3. Under Domain/URL filtering enter:

youtube.com/get_video_info

  1. Click Advanced.
  2. Under URL patterns enter:

^https?://[^/]*\.google(?:apis|syndication|usercontent|video)?\.com/videoplayback[^/]+?source=youtube

Note: The above is a single string, no spaces, though may be displayed differently according to your browser settings.

  1. Under Content filtering enter:

[meta itemprop="channelID" content="<your_channel_ID>"][100]

where your_channel_ID is the ID noted in Step 2 - Obtaining a YouTube channel ID or User ID.

Step 4 - Setting up custom category groups

Set up two custom category groups; the first will contain only YouTube domains and URLs:

  1. Go to Guardian > Policy objects > Category groups.
  2. Click advanced view (below the category list)
  3. Enter the Name as YouTube Domains/URLs.
  4. Within Content categories, expand Multimedia > YouTube and select Domains/URL filtering.
  5. Click Save.

And the second will contain only regular expressions and content:

  1. Go to Guardian > Policy objects > Category groups.
  2. Click advanced view (below the category list)
  3. Enter the Name as YouTube Regex/Content.
  4. Within Content categories, expand Multimedia > YouTube and select Content filtering and URL patterns.
  5. Click Save.

Step 5 - Setting up the policy table

  1. Go to Guardian > Web filter > Policy wizard, and create the following policies:
Policy 1:

Who: Everyone *

What: YouTube allowed channels (Category set up in step 3)

Where: Everywhere *

When: Always

Action: Allow

Policy 2:

Who: Everyone *

What: YouTube Regex/Content

Where: Everywhere*

When: Always

Action: Block

Policy 3:

Who: Everyone *

What: YouTube Domains/URLs (Category group set up in step 4)

Where: Everywhere*

When: Always

Action: Allow

* Change as appropriate

  1. Go to Guardian > Web filter > Manage policies.
  2. Move your 3 new policies to the top of the Web filter policies table, but ensure they remain in the order listed above.

Attribution:

Last updated:

Author:

Contributions by:

28 February 2017

Christopher Smith

SN

 

 

Copyright © 2000-2016 Smoothwall All rights reserved.