<?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; Netscreen</title>
	<atom:link href="http://davehope.co.uk/Blog/tag/netscreen/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>Automatic backup of Netscreen configuration</title>
		<link>http://davehope.co.uk/Blog/automate-backups-of-netscreen-configuration/</link>
		<comments>http://davehope.co.uk/Blog/automate-backups-of-netscreen-configuration/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 13:39:07 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Disaster Recovery]]></category>
		<category><![CDATA[Netscreen]]></category>

		<guid isPermaLink="false">http://davehope.co.uk/?p=500</guid>
		<description><![CDATA[I spent some time earlier automating the backups of our appliance configuration to a restricted network share and thought I&#8217;d share a simple batch script to backup the configuration from multiple Juniper Netscreen (ScreenOS) firewalls. @echo off REM ================================================================ REM CONFIGURATION INFO REM ================================================================ set USERNAME=backupAccount set PASSWORD=superSecretPassword set CFGFILE=BackupList.txt set DESTDIR=C:\Backups\ REM ================================================================ REM [...]]]></description>
			<content:encoded><![CDATA[<p>I spent some time earlier automating the backups of our appliance configuration to a restricted network share and thought I&#8217;d share a simple batch script to backup the configuration from multiple Juniper Netscreen (ScreenOS) firewalls.</p>
<pre>@echo off
REM ================================================================
REM CONFIGURATION INFO
REM ================================================================
set USERNAME=backupAccount
set PASSWORD=superSecretPassword
set CFGFILE=BackupList.txt
set DESTDIR=C:\Backups\

REM ================================================================
REM STOP CHANGING HERE OR YOU'LL BREAK SOMETHING
REM ================================================================
SET TIMESTAMP=%date:~-4,4%.%date:~-7,2%.%date:~-10,2%
for /F "tokens=1,2 delims=," %%A in (%CFGFILE%) do (
	IF NOT EXIST "%DESTDIR%%TIMESTAMP%" mkdir "%DESTDIR%%TIMESTAMP%"
	pscp -q -scp -pw %PASSWORD% %USERNAME%@%%B:ns_sys_config "%DESTDIR%%TIMESTAMP%\%%A.cfg"
)</pre>
<p>The above will read the details of the firewalls from a CSV file (BackupList.txt) in <em>hostname,ip address</em> format. PSCP is then used to SCP the configuration from the firewall to the location specified in <em>DESTDIR</em>.</p>
<p>You&#8217;ll need to make sure SSH + SCP is enabled on your firewalls and that pscp is in the same directory as the script. You can find <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/">the latest version of Putty and PSCP here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://davehope.co.uk/Blog/automate-backups-of-netscreen-configuration/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Juniper SSG140 PPTP Routing</title>
		<link>http://davehope.co.uk/Blog/juniper-ssg140-pptp-routing/</link>
		<comments>http://davehope.co.uk/Blog/juniper-ssg140-pptp-routing/#comments</comments>
		<pubDate>Wed, 30 Jul 2008 07:05:00 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Netscreen]]></category>
		<category><![CDATA[PPTP]]></category>
		<category><![CDATA[Routing]]></category>
		<category><![CDATA[SSG140]]></category>

		<guid isPermaLink="false">http://davehope.co.uk/?p=77</guid>
		<description><![CDATA[At work I&#8217;ve just replaced a custom Linux box I&#8217;ve been running as our firewall and proxy with a Juniper Netscreen SSG140. I had a few problems forwarding PPTP traffic so thought I&#8217;d document the problems I came across and the solutions. PPTP Forwarding Firstly, I was having problems even forwarding the PPTP traffic. I&#8217;d [...]]]></description>
			<content:encoded><![CDATA[<p>At work I&#8217;ve just replaced a custom Linux box I&#8217;ve been running as our firewall and proxy with a Juniper Netscreen SSG140. I had a few problems forwarding PPTP traffic so thought I&#8217;d document the problems I came across and the solutions.</p>
<h3>PPTP Forwarding</h3>
<p>Firstly, I was having problems even forwarding the PPTP traffic. I&#8217;d initially setup a VIP on the external interface forwarding a custom PPTP service :</p>
<pre>IP (47) src port: 2048-2048, dst port: 2048-2048
TCP src port: 0-65535, dst port: 1723-1723</pre>
<p>I&#8217;d then setup a Policy to allow the relevant traffic through. Alas, no such luck. Ditching the VIP and having a fixed IP for VPN traffic seemed to work. To put it simply, use MIP rather than VIP.</p>
<h3>Routing PPTP traffic for site to site links</h3>
<p>The second problem was a little weird. At the moment we use MS-RAS for site to site links, I&#8217;d created a route on the Netscreen which was working, but connections would drop after a very short period of time (say 20 seconds). The routing was as follows (outbound shown in green, reutn shown in red).</p>
<p><img class="size-full wp-image-79" title="PPTP routing on SSG140" src="http://davehope.co.uk/wp-content/uploads/2008/07/pptp1.png" alt="Routing problem on SSG140" width="489" height="290" /></p>
<p>Thankfully the solution wasn&#8217;t too messy. Since the Netscreen was missing the return traffic it was dropping the connections. The solution is to log into the Netscreen via telnet and issue the following command:</p>
<pre>unset flow tcp-syn-check</pre>
<p>As if by magic, everything now works.</p>
]]></content:encoded>
			<wfw:commentRss>http://davehope.co.uk/Blog/juniper-ssg140-pptp-routing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

