How can I allow access to specific YouTube videos?


This article applies to:

  • WebMarshal 6.X and 7.X

Question:

  • How can I allow specific YouTube videos and block the rest?

Preferred Solution:

In WebMarshal 7.X, you can enter a URL with querystring parameters directly in a URL Category. It may be conceptually easier to allow or block videos using URL categories. However the procedure described below continues to work.


Alternate Solution:

You can use a TextCensor script and Content Analysis Rules to allow specific videos based on the unique code that YouTube uses to identify the video.
  • Note: As written this procedure blocks ALL YouTube pages except the videos you specify. For instance, the YouTube home page, channels, and login are not available.
  • The selected videos will be available both within YouTube and embedded in other sites.

You MUST enable HTTPS inspection for the YouTube URLs.

The specific instructions in this procedure are written for WebMarshal 6.10. The ideas can be used with any WebMarshal 6.X or 7.X version.

Create a TextCensor Script

  1. Navigate to M86 WebMarshal ->Policy Elements ->TextCensorScripts
  2. Create a new script that contains the following expression for each video you want to allow:

    Score: 10

    Expression: 253D<YouTube Video ID>

    • For example, if the video you want to allow is:
      https://www.youtube.com/watch?v=HEheh1BH34Q
      the Expression will be:
      253DHEheh1BH34Q

  3. Give the script a name, such as Allowed YouTube, and save it.

 

Create a URL Category for YouTube

  1. Navigate to M86 WebMarshal->Policy Elements ->URL Categories
  2. Create a new URL Category and add the URLs for YouTube including HTTP and HTTPS variants.
    • Note: HTTPS URLs will only be controlled if WebMarshal HTTPS inspection is enabled and YouTube URLS are inspected.
    • YouTube currently redirects all requests to HTTPS, so this procedure will not work if HTTPS inspection is not enforced for YouTube.

Create a Rule Container and Rules to apply the policy

  1. Navigate to M86 WebMarshal ->Access Policy->Content Analysis Rules
  2. Create a New Rule Container in the Global Policy section
    • You can choose to create this container in another section if you want the rule to apply to specific users.
  3. Choose Where the URL is a member of Category, and select the YouTube Base URLs category.
  4. Save the new Rule container.

  5. Within the container, create a rule to apply the TextCensor script created above, and skip further rules if it matches:
    • Choose Where the content matches all of TextCensor Script, and select the Allowed YouTube script.  
    • Choose the action Skip all remaining rules in this container.

  6. Within the container, create a rule to block all other requests.

  7. The rule container should now appear similar to the following:

    Content Analysis Rules

    [Allow Some YouTube Videos]
    When a web request is received
    For any users
    And where the URL is a member of YouTube Base URLs

    Process rules in this container


    Find Allowed Videos
    When a web request is received
    For any users
    And where addressed to any URL
    And where the content matches all of Allowed YouTube

    Skip any remaining rules in this container

    Block All Others
    When a web request is received
    For any users
    And where addressed to any URL

    Block the file and display Blocked page
          Or abort the download of this file and display FileAborted page
    And do not process any further content analysis rules
  8. Move the new rule container near the top of Content Analysis rules. Ensure it is the first rule to trigger for YouTube sites.
  9. Commit configuration to apply the change.

Notes:

  • To manage access to videos, edit the TextCensor script. Remember to commit changes after you add or remove items from the script.
  • This procedure has been verified at the time the article was reviewed.
  • The technical design of the YouTube site could change at any time, so you should re-verify the access control periodically.


    Last Modified 4/1/2020.
    https://support.trustwave.com/kb/KnowledgebaseArticle16142.aspx