<?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>Personal website of Dave Hope &#187; Squid</title>
	<atom:link href="http://davehope.co.uk/Blog/tag/squid/feed/" rel="self" type="application/rss+xml" />
	<link>http://davehope.co.uk</link>
	<description>Open source projects, sysadmin stuff and the home of Product Key Finder</description>
	<lastBuildDate>Wed, 29 Feb 2012 17:50:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Implementing PBR and Squid3 as a transparent proxy</title>
		<link>http://davehope.co.uk/Blog/implementing-pbr-and-squid3-as-a-transparent-proxy/</link>
		<comments>http://davehope.co.uk/Blog/implementing-pbr-and-squid3-as-a-transparent-proxy/#comments</comments>
		<pubDate>Wed, 22 Sep 2010 11:27:10 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Netscreen]]></category>
		<category><![CDATA[Squid]]></category>

		<guid isPermaLink="false">http://davehope.co.uk/?p=604</guid>
		<description><![CDATA[There are various methods of implementing URL filtering in an organisation, my preferred approach is to silently route traffic through a proxy server. This has a few distinct advantages: No end user configuration is required (via wpad.dat or Group Policy etc); If something breaks, it&#8217;s extremely simple to remove; Most people wouldn&#8217;t even know it [...]]]></description>
			<content:encoded><![CDATA[<p>There are various methods of implementing URL filtering in an organisation, my preferred approach is to silently route traffic through a proxy server. This has a few distinct advantages:</p>
<ul>
<li>No end user configuration is required (via wpad.dat or Group Policy etc);</li>
<li>If something breaks, it&#8217;s extremely simple to remove;</li>
<li>Most people wouldn&#8217;t even know it was in place;</li>
</ul>
<p>There are some downsides to this approach however:</p>
<ul>
<li>HTTPS traffic cannot be silently routed through the proxy server;</li>
<li>NTLM authentication cannot be used</li>
</ul>
<p><img class="aligncenter size-full wp-image-620" title="PBR" src="/wp-content/uploads/2010/09/PBR.png" alt="Policy Based Routing" width="586" height="211" /></p>
<p><span id="more-604"></span></p>
<p>The best place to start is by setting up a Linux server. This can be physical or virtual, running whichever distribution you prefer (I&#8217;d go with Ubuntu, but the choice is yours). If linux isn&#8217;t your bag, the following <a href="https://help.ubuntu.com/community/Installation">Ubuntu install documentation</a> will help.</p>
<p>This guide will use the following example configuration information:</p>
<table style="width:100%">
<tbody>
<tr>
<td>Corporate network</td>
<td>192.168.168.0 / 24</td>
</tr>
<tr>
<td>Corporate network gateway</td>
<td>192.168.168.254</td>
</tr>
<tr>
<td>Trust (Internal) interface on firewall</td>
<td>ethernet0/0</td>
</tr>
<tr>
<td>Untrust (External) interface on firewall</td>
<td>ethernet0/2</td>
</tr>
<tr>
<td>Proxy server address</td>
<td>192.168.168.253</td>
</tr>
</tbody>
</table>
<h2>Install and configure Squid</h2>
<p>Once your Linux system is up and running, you&#8217;ll want to install the latest (stable) version of <a href="http://www.squid-cache.org/">Squid</a>. If you went with Ubuntu this couldn&#8217;t be easier:</p>
<pre># aptitude install squid3</pre>
<p>We can accept a very basic configuration. The only change you need to make is to set the default squid port to be &#8220;transparent&#8221;. Change the following in <em>/etc/squid3/squid.conf</em></p>
<pre>http_port 3128 <span style="color:red">transparent</span></pre>
<h2>Configure iptables on the proxy server</h2>
<p>We also need to configure the Linux kernel firewall (iptables) to forward any traffic routed to it on port 80 to the port used by our proxy server. This can be done as follows:</p>
<pre># iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128</pre>
<p>Save our current iptables configuration using the iptables-save command:</p>
<pre># iptables-save &gt; /etc/iptables.rules</pre>
<p>We now need load the configuration whenever the network interface comes up, edit <em>/etc/network/interfaces</em> adding the following line to the relevant interface.</p>
<pre># The primary network interface
auto eth0
iface eth0 inet static
address 192.168.168.253
netmask 255.255.255.0
gateway 192.168.168.254
<span style="color: red;">pre-up iptables-restore < /etc/iptables.rules</span></pre>
<p>Finally, we&#8217;re onto the firewall configuration. This is going to vary depending on your device (Cisco PIX, Juniper Netscreen etc). My familiarity is with the ScreenOS product line so that&#8217;s what I&#8217;ll cover here.</p>
<p>Policy based routing (PBR) allows us to setup some pre-defined rules which determine how traffic is routed. In our scenario we want to route any outbound traffic from our corporate LAN destined for port 80 via a server on our network (or in a DMZ). The below instructions are for Juniper Netscreen firewalls running ScreenOS.</p>
<div class="Message"><img src="/Files/Warning.png" alt="[Warning]" />Policy Based Routing (PBR) requires ScreenOS 5.4 or later<span class="clear"> </span></div>
<h2>Extended ACLs</h2>
<p>An extended ACL is the criteria for matching certain traffic; each ACL can contain multiple matching rules. You may wish to match all traffic on port 80 destined for a few subnets, in which case you’d create an Extended ACL with multiple entries.</p>
<p>Create an ACL matching traffic from the corporate network for outbound HTTP traffic:</p>
<pre>set access-list extended 10 src-ip 192.168.168.0/24 dst-port 80-80 protocol tcp entry 10</pre>
<p>We also need to create an ACL so that our proxy server trafffic doesn&#8217;t get routed back to itself:</p>
<pre>set access-list extended 20 src-ip 192.168.168.253/32 dst-port 80-80 protocol tcp entry 20</pre>
<h2>Match Groups</h2>
<p>A match groups is a collection of one or more <em>Extended ACL</em>&#8216;s, with a human-readable name. Create a match group named &#8220;Proxy&#8221; with an ID of 10 containing our extended ACL.</p>
<pre>set match-group name Proxy
set match-group Proxy ext-acl 10 match-entry 10</pre>
<p>We need to create another match group so that we can exclude systems from being routed through the proxy</p>
<pre>set match-group name DirectHTTP
set match-group DirectHTTP ext-acl 20 match-entry 20</pre>
<h2>Action Groups</h2>
<p>A group of one or more actions to perform, when multiple actions are available the first action is used. Create an action group which routes traffic to the proxy server on our internal network.</p>
<pre>set action-group name Proxy
set action-group Proxy next-interface ethernet0/0 next-hop 192.168.168.253 action-entry 10</pre>
<p>We now need to create another action group that routes traffic as it would do normally:</p>
<pre>set action-group name DirectHTTP
set action-group DirectHTTP next-interface ethernet0/2 action-entry 10</pre>
<h2>Policy</h2>
<p>A policy combines what we&#8217;ve created so far. When no policy is matched the normal routing tables are used.  Create a new policy named &#8220;Proxy&#8221; with two entries. The first ensures that non-proxy traffic gets routed normally, the second routes traffic through the proxy.</p>
<pre>set pbr policy name Proxy
set pbr policy Proxy match-group DirectHTTP action-group DirectHTTP 10
set pbr policy Proxy match-group Proxy action-group Proxy 20
exit</pre>
<h2>Policy Binding</h2>
<p>The final step is to apply (or, &#8216;Bind&#8217;) the policy so that it takes effect. We have a few choices as to where we can bind the policy:</p>
<ul>
<li>A virtual router</li>
<li>A zone</li>
<li>An interface</li>
</ul>
<p>We can apply multiple bindings, in which case the most specific binding takes effect. In our configuration we&#8217;ll bind the policy we&#8217;ve created to traffic passing out of our &#8220;Trust&#8221; interface:</p>
<pre>set interface ethernet0/0 pbr Proxy</pre>
<p>And there you have it, your outbound HTTP traffic is now being silently routed through a proxy server.</p>
]]></content:encoded>
			<wfw:commentRss>http://davehope.co.uk/Blog/implementing-pbr-and-squid3-as-a-transparent-proxy/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Microsoft break support.microsoft.com for Squid users</title>
		<link>http://davehope.co.uk/Blog/microsoft-break-supportmicrosoftcom-for-squid-users/</link>
		<comments>http://davehope.co.uk/Blog/microsoft-break-supportmicrosoftcom-for-squid-users/#comments</comments>
		<pubDate>Tue, 29 Apr 2008 07:35:59 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Squid]]></category>

		<guid isPermaLink="false">http://davehope.co.uk/?p=62</guid>
		<description><![CDATA[It seems that Microsoft have managed to break their support site for anyone behind a Squid proxy server. Danny has posted a fix for this on his website, though for newer version of squid a slightly different approach is required. ## # Fix support.microsoft.com ## acl fixSupportMicrosoft dstdomain support.microsoft.com reply_header_access Accept-Encoding deny fixSupportMicrosoft request_header_access Accept-Encoding [...]]]></description>
			<content:encoded><![CDATA[<p>It seems that Microsoft have managed to break their support site for anyone behind a Squid proxy server. <a href="http://thedaneshproject.com/posts/supportmicrosoftcom-not-working-behind-squid/">Danny has posted a fix for this on his website</a>, though for newer version of squid a slightly different approach is required.</p>
<pre>##
# Fix support.microsoft.com
##
acl fixSupportMicrosoft dstdomain support.microsoft.com
reply_header_access Accept-Encoding deny fixSupportMicrosoft
request_header_access Accept-Encoding deny fixSupportMicrosoft</pre>
<p>What you&#8217;re doing there is preventing the Microsoft support site from gzip&#8217;ing their content.</p>
]]></content:encoded>
			<wfw:commentRss>http://davehope.co.uk/Blog/microsoft-break-supportmicrosoftcom-for-squid-users/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Squid top-site report generator updated</title>
		<link>http://davehope.co.uk/Blog/squid-top-site-report-generator-updated/</link>
		<comments>http://davehope.co.uk/Blog/squid-top-site-report-generator-updated/#comments</comments>
		<pubDate>Tue, 22 Apr 2008 12:26:12 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Squid]]></category>

		<guid isPermaLink="false">http://davehope.co.uk/?p=61</guid>
		<description><![CDATA[I got an e-mail from Marco Stefanini asking if the Perl script could sort sites by the data transfer rather than the frequency of the visits. Not wanting to disappoint I added the functionality last night and tested when I got into work today. So, without further ado go checkout my Squid Top Site Report [...]]]></description>
			<content:encoded><![CDATA[<p>I got an e-mail from Marco Stefanini asking if the Perl script could sort sites by the data transfer rather than the frequency of the visits. Not wanting to disappoint I added the functionality last night and tested when I got into work today.</p>
<p>So, without further ado go checkout my <a href="http://davehope.co.uk/projects/perl-squid-reporting/">Squid Top Site Report Generator</a> and get yourself some reporting goodness.</p>
]]></content:encoded>
			<wfw:commentRss>http://davehope.co.uk/Blog/squid-top-site-report-generator-updated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Squid Reporting</title>
		<link>http://davehope.co.uk/Blog/squid-reporting/</link>
		<comments>http://davehope.co.uk/Blog/squid-reporting/#comments</comments>
		<pubDate>Wed, 10 Oct 2007 17:23:59 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Proxy]]></category>
		<category><![CDATA[Squid]]></category>

		<guid isPermaLink="false">http://davehope.co.uk/Blog/squid-reporting/</guid>
		<description><![CDATA[A month or so I ditched ISA 2006 in favor of Squid 2.5 running on a Debian Linux box. I&#8217;ve looked around at various reporting tools and now use SARG to produce per user/address reports. However, I wanted to produce a report visible to anyone who wanted to view the previous days statistics so modified [...]]]></description>
			<content:encoded><![CDATA[<p>A month or so I ditched ISA 2006 in favor of Squid 2.5 running on a Debian Linux box. I&#8217;ve looked around at various reporting tools and now use SARG to produce per user/address reports.</p>
<p>However, I wanted to produce a report visible to anyone who wanted to view the previous days statistics so modified a Perl script written by someone in 2003,since in all likelihood I&#8217;ll be updating it from time to time you can <a href="http://davehope.co.uk/projects/perl-squid-reporting/">download yourself a copy here</a>. I&#8217;ll try and get a demo up tomorrow as an example of its output.</p>
]]></content:encoded>
			<wfw:commentRss>http://davehope.co.uk/Blog/squid-reporting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

