<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Praetorian Prefect &#187; CPL</title>
	<atom:link href="http://praetorianprefect.com/archives/tag/cpl/feed/" rel="self" type="application/rss+xml" />
	<link>http://praetorianprefect.com</link>
	<description>Information security, a little slower...a little deeper</description>
	<lastBuildDate>Thu, 29 Jul 2010 16:38:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>RickRoll Everyone with BlueCoat</title>
		<link>http://praetorianprefect.com/archives/2009/04/rickroll-everyone-with-bluecoat/</link>
		<comments>http://praetorianprefect.com/archives/2009/04/rickroll-everyone-with-bluecoat/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 14:51:03 +0000</pubDate>
		<dc:creator>JD McCloud</dc:creator>
				<category><![CDATA[Content Filtering]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[BlueCoat]]></category>
		<category><![CDATA[CPL]]></category>
		<category><![CDATA[Proxy]]></category>
		<category><![CDATA[SGOS]]></category>
		<category><![CDATA[youtube]]></category>

		<guid isPermaLink="false">https://praetorianprefect.com/blog/?p=5</guid>
		<description><![CDATA[The <a href="http://www.bluecoat.com/products/sg">Bluecoat SGOS</a> can do a fair amount of stuff just like any web-proxy should, but my favorite is to <a href="http://en.wikipedia.org/wiki/Rickrolling">RickRoll</a> the whole company.  ( <em>People spend to much time on youtube as is</em> ).]]></description>
			<content:encoded><![CDATA[<h3>BlueCoat Proxy</h3>

<p>The <a href="http://www.bluecoat.com/products/sg">Bluecoat SGOS</a> can do a fair amount of stuff just like any web-proxy should, but my favorite is to <a href="http://en.wikipedia.org/wiki/Rickrolling">RickRoll</a> the whole company.  ( <em>People spend to much time on youtube as is</em> ).</p>

<p>In this example users are authenticated with NTML back ended by Windows Active Directory.  See the docs from Bluecoat on how to set this up.</p>

<h4>Definitions Conditions</h4>

<p>Conditions allow you to control when things should happen.  They do nothing by themselves, but get put together later to preform some real fun.</p>

<p>The first definition here matches only member of the group <code>DOMAINpxy_rickrolld</code>.  You could make this users or just about that think you would like.  I choice the group method to make it simple to add and remove effected users.</p>

<pre><code>define condition group_to_be_rickrolled
    realm=active_directory group=DOMAIN\pxy_rickrolld 
end
</code></pre>

<p>The second definition just matches does a REGEX to match the domain &#8220;<code>youtube</code>&#8221; and looks for the string &#8220;<code>watch</code>&#8221; in the url path.  The use of REGEX really is not the best way to do this, but I figured showing both methods of matching was worth the slight performance hit.</p>

<pre><code>define condition match_url_to_rickroll
    url.host.regex="youtube" url.path.substring=watch 
end
</code></pre>

<h4>Definitions Actions</h4>

<p>Actions are define something to do with a request.  In this case we are going to rewrite the request and change the video to the &#8220;<code>oHg5SJYRHA0</code>&#8220;.</p>

<pre><code>define action youtube_change_to_rickroll
  rewrite( url, "(http://.*/watch?v=)([^&amp;]+)(.*)", "$(1)oHg5SJYRHA0$(3)" )
end
</code></pre>

<p>Given the initial url of &#8220;<code>http://www.youtube.com/watch?v=OBghD0XBN5M&amp;feature=related</code>&#8220;.</p>

<p>The rewrite functions second argument is a REGEX that stores the following:</p>

<ul>
<li>&#8220;<code>http://www.youtube.com/watch?v=</code>&#8221; in variable &#8220;<code>$(1)</code>&#8220;.</li>
<li>&#8220;<code>&amp;feature=related</code>&#8221; in variable &#8220;<code>$(3)</code>&#8220;.  </li>
</ul>

<p>The third argument is the Newly created url that simply puts the data back together with our selected Video ID.</p>

<h4>Proxy Section</h4>

<p>Now that you have everything defined you need to put it all to use.</p>

<pre><code>&lt;Proxy&gt; 
    condition=match_url_to_rickroll condition=group_to_be_rickrolled 
action.youtube_change_to_rickroll(yes) 
</code></pre>

<p>This will pull all the define from above to select when to preform the rewrite function.  Putting this in place is fun, but it really does make people mad for some reason.</p>

<h3>Completed Fun</h3>

<pre><code>define condition group_to_be_rickrolled
    realm=active_directory group=DOMAIN\pxy_rickrolld 
end
define condition match_url_to_rickroll
    url.host.regex="youtube" url.path.substring=watch 
end 
define action youtube_change_to_rickroll
  rewrite( url, "(http://.*/watch?v=)([^&amp;]+)(.*)", "$(1)oHg5SJYRHA0$(3)" )
end

&lt;Proxy&gt; 
    condition=match_url_to_rickroll condition=group_to_be_rickrolled 
action.youtube_change_to_rickroll(yes) 
</code></pre>

<h3>Results</h3>

<p>Well of course it had to be done.</p>

<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/oHg5SJYRHA0&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/oHg5SJYRHA0&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>

<p><strong>Related Posts:</strong></p>
<ul>
<li><a href="http://praetorianprefect.com/archives/2009/11/ossec-agentless-its-good-but-not-good-enough/">OSSEC: Agentless&#8230;It&#8217;s good, but not good enough</a></li>
<li><a href="http://praetorianprefect.com/archives/2009/11/ossec-agentless-scripts/">OSSEC: Agentless scripts</a></li>
<li><a href="http://praetorianprefect.com/archives/2009/11/ossec-agentless-to-save-the-day/">OSSEC: Agentless to save the day</a></li>
<li><a href="http://praetorianprefect.com/archives/2009/10/borderless-networks-yeah-but-wheres-my-border/">Are Borderless Networks Possible?</a></li>
<li><a href="http://praetorianprefect.com/archives/2009/10/server-2008-r2-active-directory-functional-levels/">Server 2008 R2: Active Directory Functional Levels</a></li>
</ul><br />
]]></content:encoded>
			<wfw:commentRss>http://praetorianprefect.com/archives/2009/04/rickroll-everyone-with-bluecoat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
