<?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>Ubuntu Tutorials : Dapper - Hardy - Intrepid - Jaunty &#187; Security</title>
	<atom:link href="http://ubuntu-tutorials.com/category/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://ubuntu-tutorials.com</link>
	<description>How to do almost anything on your Ubuntu desktop, laptop or server.  Regular tips on installing, configuring and making your Ubuntu system as effective as you need it to be.</description>
	<lastBuildDate>Sun, 28 Jun 2009 02:46:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Firewall Builder: Using The Policy Importer</title>
		<link>http://ubuntu-tutorials.com/2009/06/12/firewall-builder-using-the-policy-importer/</link>
		<comments>http://ubuntu-tutorials.com/2009/06/12/firewall-builder-using-the-policy-importer/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 10:01:15 +0000</pubDate>
		<dc:creator>Christer Edwards</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[import]]></category>
		<category><![CDATA[iptables]]></category>

		<guid isPermaLink="false">http://ubuntu-tutorials.com/?p=1148</guid>
		<description><![CDATA[


 This article is part of a series regarding firewalling and network security using the Firewall Builder tool on Ubuntu. This is user-contributed content. If you would like to contribute an article, please see the About page for contact information.
Using Built-in Policy Importer in Firewall Builder




Author: vadim@fwbuilder.org
http://www.fwbuilder.org



This article continues the series of articles on Fireall [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-2967906068469254";
/* ubuntu-tutorials, wide-banner */
google_ad_slot = "5123233227";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></-> <p><em>This article is part of a series regarding firewalling and network security using the <strong>Firewall Builder</strong> tool on Ubuntu. This is user-contributed content. If you would like to contribute an article, please see the About page for contact information.</em></p>
<p><strong>Using Built-in Policy Importer in Firewall Builder</strong></p>
<table border="0">
<tbody>
<tr>
<td><img src="http://www.fwbuilder.org/images/icon_128x128.png" alt="" width="128" height="128" /></td>
<td>Author: vadim@fwbuilder.org</p>
<p><a href="http://www.fwbuilder.org">http://www.fwbuilder.org</a></td>
</tr>
</tbody>
</table>
<p>This article continues the series of articles on Fireall Builder, a graphical firewall configuration and management tool that supports many Open Source firewall platforms as well as Cisco IOS access lists and Cisco ASA (PIX).  Firewall Builder was introduced on this site earlier with articles <a href="http://ubuntu-tutorials.com/2009/06/03/getting-started-with-firewall-builder/"><br />
Getting Started With Firewall Builder</a>.</p>
<p>More information on Firewall Builder, pre-built binary packages and source code, documentation and <strong>Firewall Builder Cookbook</strong> can be found on the project web site at <a href="http://www.fwbuilder.org">www.fwbuilder.org</a>. Watch <a href="http://blog.fwbuilder.org">Project Blog</a> for announcements and articles on all aspects of using Firewall Builder.</p>
<p>This article demonstrates how you can import existing iptables or Cisco router configuration into Firewall Builder.</p>
<p>There are two ways to activate the feature: Main menu <strong><em>&#8220;File/Import Policy&#8221;</em></strong> or <strong><em>&#8220;Tools/Discovery Druid&#8221;</em></strong> and then choose option <strong><em>&#8220;Import configuration of a<br />
firewall or a router&#8221;</em></strong>.  Only import of iptables and Cisco IOS access lists is possible in the current version.</p>
<p><strong>Importing existing iptables configuration</strong></p>
<p>iptables config that the program can import is in the format of iptables-save. Script <strong>&#8220;iptables-save&#8221;</strong> is part of the standard iptables install and should be present on all Linux distribution. Usually this script is installed in <strong>/sbin/</strong> . When you run this script, it dumps current iptables configuration to stdout. It reads iptables rules directly form the kernel rather than from some file, so what it dumps is what is really working right now. To import this into fwbuilder run the script to save configuration to a file:</p>
<blockquote><p><code>iptables-save &gt; iptables_config.conf</code></p></blockquote>
<p>Then launch fwbuilder, activate <strong>&#8220;Import Policy&#8221;</strong> function and use &#8220;Browse&#8221; button in the dialog to find file iptables_config.conf. You also need to choose <strong>&#8220;iptables&#8221;</strong> in the drop-down menu <strong>&#8220;Platform&#8221;</strong>.</p>
<p><span id="more-1148"></span></p>
<p>If you do not choose iptables in the <strong>&#8220;Platform&#8221;</strong>, the program will try to interpret the file using different parser and will fail. The program does not make any assumptions about the file name or extension and can not predict automatically what platform is the configuration being imported is for.</p>
<p><img class="alignnone size-full wp-image-1153" title="importer_1" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/importer_1.png" alt="importer_1" width="525" height="557" /></p>
<p><strong>Importing iptables configuration created in FireStarter</strong></p>
<p>The following example demonstrates import of iptables policy generated by <strong>Firestarter</strong>, another popular iptables configuration management program.</p>
<p>After the platform is selected and file name entered, click &#8220;Next&#8221; to start the process.</p>
<p><img class="alignnone size-full wp-image-1154" title="importer_2" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/importer_2.png" alt="importer_2" width="569" height="699" /></p>
<p>The program tries to interpret configuration file rule-by-rule and recreates its equivalent in fwbuilder. The progress window displays errors, if any, as well as some diagnostics that shows network and service objects created in the process. Note that user-defined iptables chains found in the configuration file will be re-created in fwbuilder as policy rule sets. The screenshot shows rulesets &#8220;LSI&#8221;, &#8220;LSO&#8221;, &#8220;OUTBOUND&#8221; being created. There were more but they did not fit in the output window. Address objects &#8220;h-10.3.14.10&#8243;, &#8220;h-10.3.14.255&#8243; and few others have been created as well. Service objects &#8220;tcp fsra/s&#8221;, &#8220;udp 0-0:0-0&#8243;, &#8220;icmp -1/-1&#8243; and few others have also been created.</p>
<p>Note that the new firewall object created in the process has generic name &#8220;New Firewall&#8221;. This is because iptables configuration file used for import does not have information about firewall machine name. It also does not have information about its interfaces, their names and addresses. The program can infer their names when it encounters &#8220;-i &lt;interface&gt;&#8221; or &#8220;-o &lt;interface&gt;&#8221; clause in the iptables configuration lines. It can not reliably detect their addresses though. You need to rename firewall object and add ip addresses to interfaces after the import manually.</p>
<p>Note also that only ipv4 part of the iptables configuration was imported. Currently, import of ipv6 iptables configuration is not supported.</p>
<p><img class="alignnone size-full wp-image-1155" title="importer_3" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/importer_3.png" alt="importer_3" width="271" height="318" /></p>
<p>Screenshot above demonstrates rule sets that the program created from the configuration it imported. Rule sets &#8220;INBOUND&#8221;, &#8220;LOG_FILTER&#8221;, &#8220;LSI&#8221;, &#8220;LSO&#8221;, &#8220;OUTBOUND&#8221;, &#8220;Policy&#8221; are all of the type &#8220;Policy&#8221; and contain filtering rules. There were no NAT rules in the original configuration so the rule set &#8220;NAT&#8221; is created but is empty. Names of all policy rule sets match names of the iptables chains in the original configuration.</p>
<p><img class="alignnone size-full wp-image-1156" title="importer_7" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/importer_7.png" alt="importer_7" width="550" height="204" /><br />
<img class="alignnone size-full wp-image-1157" title="importer_8" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/importer_8.png" alt="importer_8" width="550" height="196" /><br />
<img class="alignnone size-full wp-image-1158" title="importer_9" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/importer_9.png" alt="importer_9" width="550" height="197" /></p>
<p>screenshots above demonstrate address and service objects created by the program. It writes a comment in each object to remind that it was created automatically on import. Names of these objects are chosen automatically, you can rename objects to give them more meaningful names. Some of the objects created during import have the same properties as existing service and address objects from the Standard objects library. Currently the program does not cross-match them and just creates new objects, however in the future it may use standard objects instead.</p>
<p>Some rules in the original iptables config used &#8220;&#8211;tcp-flags&#8221; parameter to match only certain combinations of tcp flags. Here is an example:</p>
<blockquote><p><code>-A INPUT -s 10.3.14.10 -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -j ACCEPT</code></p></blockquote>
<p>In order to be able to reproduce this rule, fwbuilder created special TCP service object with given combination of tcp mask and flags:</p>
<p><img class="alignnone size-full wp-image-1159" title="importer_10" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/importer_10.png" alt="importer_10" width="550" height="223" /></p>
<p>The follwoing screenshot demonstrates rules created in the main Policy rule set. These are the top iptables rules, some of them branch off to the other Policy rule sets. Some of the rules in the original policy did not match state (did not have clause &#8220;-m state &#8211;state NEW&#8221; or similar), these rules were created with the flag &#8220;stateless&#8221; turned on. In fwbuilder, this makes policy compiler generate iptables commands without &#8220;-m state &#8211;state NEW&#8221; clause which matches the original.  These rules are marked with an icon that represents non-default rule options in the column &#8220;Options&#8221;.</p>
<p><img class="alignnone size-full wp-image-1160" title="importer_14" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/importer_14.png" alt="importer_14" width="550" height="354" /></p>
<p>Lets inspect one group of rules little closer. The original iptables file contained the following commands:</p>
<blockquote><p><code><br />
-A INPUT -i eth0 -j INBOUND<br />
-A INBOUND -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT<br />
-A INBOUND -p udp -m state --state RELATED,ESTABLISHED -j ACCEPT<br />
-A INBOUND -s 10.3.14.0/255.255.255.0 -j ACCEPT<br />
-A INBOUND -s 10.3.14.0/255.255.255.0 -p tcp -m tcp --dport 22 -j ACCEPT<br />
-A INBOUND -s 10.3.14.0/255.255.255.0 -p udp -m udp --dport 22 -j ACCEPT<br />
-A INBOUND -j LSI<br />
</code></p></blockquote>
<p>The first rule is in chain INPUT and was recreated as rule #11 in the Policy rule set (rule colored green). Since it was in INPUT, the destination object in the rule #11 is the firewall itself. The &#8220;-i eth0&#8243; clause translated into interface object &#8220;eth0&#8243; in the &#8220;Interface&#8221; rule element and direction &#8220;Inbound&#8221;. The action of the rule #11 is &#8220;Branch&#8221;, pointing to the rule set &#8220;INBOUND&#8221;. This is direct recreation of the original rule in itpables config.</p>
<p><img class="alignnone size-full wp-image-1161" title="importer_15" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/importer_15.png" alt="importer_15" width="550" height="165" /></p>
<p>This screenshot demonstrates rules created in the rule set &#8220;INBOUND&#8221;. Rule #0 matches CustomService object &#8220;custo-0-tcp&#8221; that was created to match combination of protocol &#8220;tcp&#8221; and state &#8220;RELATED,ESTABLISHED&#8221;. This object is shown in the following screenshot:</p>
<p><img class="alignnone size-full wp-image-1162" title="importer_11" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/importer_11.png" alt="importer_11" width="550" height="202" /></p>
<p>Fwbuilder automatically adds a rule on top of generated iptables script to match packets in states &#8220;ESTABLISHED, RELATED&#8221;. With that rule, it is not necessary to have a rule like #0 in INBOUND, but since original script had it, fwbuilder reproduced it.</p>
<p>rule #1 in INBOUND matches protocol udp and state &#8220;ESTABLISHED,RELATED&#8221;. Other rules in INBOUND reproduce original rules from the chain INBOUND and match packets coming from the local net heading for the firewall machine. It is easy to see that the original policy was redundant: rules #2-4 match the same source and destination addresses but different services, but rule #2 matches any service which means rules #3 and 4 will never match any packets. Fwbuilder will detect this problem automatically if you try to compile this policy (this is called &#8220;Rule shadowing&#8221;).</p>
<p>All packets not matched by any rule in INBOUND will match last rule in this rule set which branches to the rule set LSI. Rule set LSI logs various packets and drops them:</p>
<p><img class="alignnone size-full wp-image-1163" title="importer_16" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/importer_16.png" alt="importer_16" width="550" height="227" /></p>
<p>The first thing about rules in this rule set that catches the eye is why do we have all these rules with action &#8220;Continue&#8221;.</p>
<p>When a rule is marked as &#8220;logging&#8221; in fwbuilder, it gets an icon in the column &#8220;Options&#8221; that represents log, this icon appears either by itself or next to the icon that represents non-default rule options. However, iptables does not allow for an action &#8220;Accept&#8221; or &#8220;Deny&#8221; to be used in combination with logging, in iptables logging is separate target just like &#8220;ACCEPT&#8221; or &#8220;DROP&#8221;. Because of that, fwbuilder splits a rule that has action &#8220;Accept&#8221; or &#8220;Deny&#8221; or any other with logging turned on. One such rule becomes two or more iptables rules in the generated script. Unfortunately when iptables script is imported back, the program can not merge such rules and logging rules appear in the rule set as separate rules with logging icon in the &#8220;Options&#8221; column and action &#8220;Continue&#8221;. This is a valid configuration in fwbuilder, it just means that the rule generates log record but does not make any decision whether the packet should be accepted or denied and the firewall should continue its inspection.</p>
<p>Here is the fragment of the original iptables rules in the chain LSI:</p>
<blockquote><p><code>-A LSI -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN \<br />
-m limit --limit 1/sec -j LOG --log-prefix "Inbound " --log-level 6<br />
-A LSI -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j DROP</code></p></blockquote>
<p>These rules become rules #1 and 2 in rule set LSI in fwbuilder. The first rule, the one that does logging, becomes a separate rule because this is how it is done in iptables. If this policy was created in fwbuilder, rules #1 and 2 would be just one rule in the GUI.  Double-clicking in the column &#8220;Options&#8221; in rule #1 opens dialog where you can inspect and edit its options. Tab &#8220;Limit&#8221; of this dialog controls parameters iptables &#8220;limit&#8221; module which was used in the original rule. Screenshot below demonstrates how policy importer recognized these parameters and reproduced them in the rule options:</p>
<p><img class="alignnone size-full wp-image-1164" title="importer_17" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/importer_17.png" alt="importer_17" width="550" height="434" /></p>
<p><strong>Limitations</strong></p>
<p>iptables policy importer in fwbuilder has its limitations. Main limitation is that it can only parse certain set of iptables modules and targets. There are too many modules and associated targets out there and supporting all of them is next to impossible. However, it supports the core functionality and most popular modules. Even though importer tries to be as close to the original configuration as possible, you should always review rules and objects it creates and edit resultant rules. Most of the time rules can be simplified, such as with logging rules as was explained above. Often you can merge multiple rules by putting several objects in source or destination or service. Using object and service groups is another good way to simplify rules.</p>
<p><strong>Importing Cisco IOS access lists configuration</strong></p>
<p>Importing IOS access lists configuration is more straightforward because branching is not possible there. To import configuration, first you need to save it using &#8220;show run&#8221; command. IOS has literary hundreds of different commands and configuration clauses, but fwbuilder can only parse those related to the access lists configuration. Other commands will be ignored. There is no need to edit configuration prior to importing it into fwbuilder (except for the &#8220;banner&#8221; command, see below). Saved IOS configuration has information about router name and its interfaces, this information will be used to recreate objects in fwbuilder. Parser will not only create interface objects with proper names, it will also attach address objects to them to describe their ip addresses.</p>
<p><img class="alignnone size-full wp-image-1165" title="importer_20" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/importer_20.png" alt="importer_20" width="569" height="256" /></p>
<p>Just like with iptables, we start with main menu <strong>&#8220;File/Import Policy&#8221;</strong> and enter file name in the dialog. The <strong>&#8220;Platform&#8221;</strong> drop-down list should be set to <strong>&#8220;Cisco IOS&#8221;</strong>. Click &#8220;Next&#8221; to start import process.</p>
<p><img class="alignnone size-full wp-image-1166" title="importer_21" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/importer_21.png" alt="importer_21" width="569" height="699" /></p>
<p>The program recognized router name &#8220;c3620&#8243; and its interfaces, created interface objects with their ip addresses and then created some address and service objects. My test router config contains the following lines (this is just a fragment, there are more interfaces and more ACLs):</p>
<blockquote><p><code>interface FastEthernet0/0<br />
ip address 192.168.100.100 255.255.255.0 secondary<br />
ip address 10.3.14.201 255.255.255.0<br />
ip access-group fe0_0_acl_in in<br />
ip access-group fe0_0_acl_out out<br />
no ip mroute-cache<br />
duplex auto<br />
speed auto<br />
!<br />
interface Ethernet1/0<br />
description Test [test] {test} (and one more test) /weird:characters#$%^&amp;*/<br />
ip address 192.168.171.2 255.255.255.0<br />
ip access-group e1_0_acl_in in<br />
ip access-group e1_0_acl_out out<br />
no ip mroute-cache<br />
ip ospf cost 65000<br />
half-duplex<br />
crypto map real<br />
!################################################################<br />
ip access-list extended e1_0_acl_in<br />
deny   ip any any fragments<br />
permit tcp host 10.3.14.40 host 192.168.171.2 eq 22 log<br />
permit tcp host 10.3.14.40 host 10.3.14.201 eq 22 log<br />
permit ip any 10.3.14.0 0.0.0.255 log<br />
deny   ip any any log<br />
!################################################################<br />
ip access-list extended e1_0_acl_out<br />
permit ip 10.3.14.0 0.0.0.255 any log<br />
deny   ip any any log</code></p></blockquote>
<p>Parser recognizes comments and skips them, but text from interface descriptions goes into comments in the Interface objects.</p>
<p><img class="alignnone size-full wp-image-1167" title="importer_22" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/importer_22.png" alt="importer_22" width="335" height="378" /></p>
<p>Firewall Builder recognizes both named and regular extended access lists. Each separate access list is recreated in fwbuilder in the same main Policy rule set. The program recognizes &#8220;ip access-group&#8221; commands and puts corresponding interface object in the &#8220;Interface&#8221; rule element of the rules it creates.</p>
<p><img class="alignnone size-full wp-image-1168" title="importer_30" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/importer_30.png" alt="importer_30" width="550" height="329" /></p>
<p>The original configuration used the same access list &#8220;133&#8243; with two interfaces:</p>
<blockquote><p><code>interface Ethernet1/1<br />
ip address 10.10.10.10 255.255.255.0<br />
no ip mroute-cache<br />
!<br />
!  Note - the same access list applied both in and out<br />
ip access-group 133 in<br />
ip access-group 133 out<br />
no shutdown<br />
half-duplex<br />
!<br />
interface Ethernet1/2<br />
ip address 10.10.20.20 255.255.255.0<br />
no ip mroute-cache<br />
!<br />
!  Note - the same access list applied both in and out<br />
!  the same list is applied to eth 1/1 and eth 1/2<br />
ip access-group 133 in<br />
ip access-group 133 out<br />
no shutdown<br />
half-duplex<br />
!</code></p></blockquote>
<p>The program recognizes this and creates object group &#8220;intf-acl_133&#8243; with these two interfaces as members:</p>
<p><img class="alignnone size-full wp-image-1169" title="importer_31" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/importer_31.png" alt="importer_31" width="550" height="202" /></p>
<p>It then uses this group in the &#8220;Interface&#8221; element of rules #0, 1 and 2 to reproduce rules from the access list &#8220;133&#8243;.</p>
<p>Interface configuration commands visible in the config snippets above, such as &#8220;half-duplex&#8221;, &#8220;duplex auto&#8221;, &#8220;speed auto&#8221;, various protocol configuration commands and other commands supported by IOS inside &#8220;interface&#8221; block are ignored.</p>
<p><strong>Limitations</strong></p>
<p>One IOS configuration construct that fwbuilder can not import is &#8220;banner&#8221; command. This command is special in that it allows the user to set arbitrary terminator character and then it allows any text up to this character. This creates a problem for fwbuilder parser because the terminator character can be arbitrary. You need to edit and remove banner from the saved configuration file before importing it.<br />
<h3>Other Points of Interest</h3>
<ul class="related_post">
<li>May 4, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/05/04/why-ufw-does-not-need-a-gui/" title="Why ufw Does Not Need A GUI">Why ufw Does Not Need A GUI (14)</a></li>
<li>June 3, 2009 &#8212; <a href="http://ubuntu-tutorials.com/2009/06/03/getting-started-with-firewall-builder/" title="Getting Started with Firewall Builder">Getting Started with Firewall Builder (4)</a></li>
<li>February 28, 2009 &#8212; <a href="http://ubuntu-tutorials.com/2009/02/28/standard-process-for-restoring-iptables-at-boot/" title="Standard Process for Restoring IPtables at Boot?">Standard Process for Restoring IPtables at Boot? (11)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ubuntu-tutorials.com/2009/06/12/firewall-builder-using-the-policy-importer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Started with Firewall Builder</title>
		<link>http://ubuntu-tutorials.com/2009/06/03/getting-started-with-firewall-builder/</link>
		<comments>http://ubuntu-tutorials.com/2009/06/03/getting-started-with-firewall-builder/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 04:28:22 +0000</pubDate>
		<dc:creator>Christer Edwards</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[fwbuilder]]></category>

		<guid isPermaLink="false">http://ubuntu-tutorials.com/?p=1080</guid>
		<description><![CDATA[


 This article is part of a series regarding firewalling and network security using the Firewall Builder tool on Ubuntu. This is user-contributed content. If you would like to contribute an article, please see the About page for contact information.
Getting Started with Firewall Builder




Author: vadim@fwbuilder.org
http://www.fwbuilder.org



This guide starts a series of articles about Firewall Builder. Firewall [...]]]></description>
			<content:encoded><![CDATA[<p><em>This article is part of a series regarding firewalling and network security using the <strong>Firewall Builder</strong> tool on Ubuntu. This is user-contributed content. If you would like to contribute an article, please see the About page for contact information.</em></p>
<h2>Getting Started with Firewall Builder</h2>
<table border="0">
<tbody>
<tr>
<td><img src="http://www.fwbuilder.org/images/icon_128x128.png" alt="" width="128" height="128" /></td>
<td>Author: vadim@fwbuilder.org</p>
<p><a href="http://www.fwbuilder.org">http://www.fwbuilder.org</a></td>
</tr>
</tbody>
</table>
<p>This guide starts a series of articles about Firewall Builder. <strong>Firewall Builder</strong> (also known as <strong>fwbuilder</strong>) is a GUI firewall configuration and management tool that supports <strong>iptables (netfilter), ipfilter, pf, ipfw, Cisco PIX (FWSM, ASA) and Cisco routers extended access lists</strong>. Both professional network administrators and hobbyists managing firewalls with policies more complex that is allowed by simple web based UI can simplify management tasks with the application. The program runs on Linux, FreeBSD, OpenBSD, Windows and Mac OS X and can manage both local and remote firewalls. The first article is an introduction to the program. We will follow up with series of articles focusing on more advanced aspects of it in the coming weeks.</p>
<p>Firewall Builder is packaged with most Linux distributions and is available under <em>&#8220;System/Administration&#8221;</em> menu.</p>
<p><img src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_011.png" alt="" /></p>
<p>If it is not there, then it probably needs to be installed on your system. You need to install package that has supporting API library <strong>libfwbuilder</strong> and package <strong>fwbuilder</strong> that contains Firewall Builder GUI and policy compilers.  Use <em>apt-get</em> or <em>aptitude</em> to find and install them:</p>
<blockquote><p><code> # aptitude install libfwbuilder fwbuilder</code></p></blockquote>
<p>On FreeBSD and OpenBSD Firewall Builder is part of ports, you can find it in <strong>/usr/ports/security/fwbuilder</strong>.</p>
<p>Packages shipping with Ubuntu are always one or two minor revisions behind. If you want to try the latest version, you can use pre-built binary <em>.deb</em> packages offered on the project&#8217;s web site or build from source using our online <a href="http://www.fwbuilder.org/guides/firewall_builder_installation.html">installation instructions</a>. Pre-built binary packages can be installed using our repositories of rpm and deb packages, see instructions on <a href="http://www.fwbuilder.org/docs/firewall_builder_packages.html">this page</a>.</p>
<p>If the system menu item is not there or you have built the program from source, you can always launch it from the command line by just typing &#8220;fwbuilder&#8221; on the shell prompt:</p>
<blockquote><p><code>$ fwbuilder</code></p></blockquote>
<p><span id="more-1080"></span></p>
<p>The program starts and opens main window and greeting dialog. The dialog provides links to the project web site where you can find more tutorials, FAQ, Firewall Builder CookBoook and other documentation, as well as bug tracking system and links to user forums and mailing list. Clicking on the link in the dialog opens corresponding web page in your web browser. This works the same on all supported OS: Linux, Windows and Mac OS X. You can always open this dialog later using an item in the main menu &#8220;Help&#8221;.</p>
<p><img class="alignnone size-full wp-image-1087" title="pict_010" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_010.png" alt="pict_010" width="550" height="481" /></p>
<p>Lets create our first firewall object. To do this, we&#8217;ll use object creation menu that appears when you click on the icon in the small toolbar right above the object tree. Choose menu item &#8220;New Firewall&#8221; from the menu that appears.</p>
<p><img class="alignnone size-full wp-image-1088" title="pict_020" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_020.png" alt="pict_020" width="505" height="354" /></p>
<p>The program presents wizard-like dialog that will guide you through the process of creation of the new firewall object.  In the first page of the wizard you can enter the name for the new firewall object (here it is &#8220;guardian&#8221;), its platform ( &#8220;iptables&#8221;) and host OS (&#8221;Linux&#8221;).</p>
<p>There are two ways new firewall can be created: you can use one of the preconfigured template firewall objects or create it from scratch. This tutotiral demonstrates the first method (using template object). To do this, check checkbox &#8220;Use pre configured template firewall objects&#8221;. Template can be taken from the library of template objects that comes with Firewall Builder package or from a file provided by the user. The latter is useful when administrator wants to distribute a library of predefined templates to other users in the enterprise. We are using one of the standard templates in this guide and therefore leave standard template library path and name in the &#8220;Template file:&#8221; input field. Click &#8220;Next&#8221; to move on to the next page of the wizard.</p>
<p>Note that template firewall object comes completely configured, including addresses and netmasks of its interfaces and some basic policy and NAT rules. This configuration is intended as a starting point only. You should reconfigure addresses of interfaces to match those used on your network and most likely will have to adjust rules to match your security policy.</p>
<p><img class="alignnone size-full wp-image-1089" title="pict_030" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_030.png" alt="pict_030" width="531" height="324" /></p>
<p>This page of the wizard shows template objects and their configuration. Standard template objects represent firewalls with two or three interfaces, a host with one interface, web server or Cisco router. Choose firewall with three interfaces for this guide. Note that template comes with completely configured firewall object, including set of interfaces and their ip addresses and some basic firewall policy. You will see how addresses can be changed later on in this guide. Click &#8220;Finish&#8221; to create a new firewall object using chosen template.</p>
<p><img class="alignnone size-full wp-image-1090" title="pict_040" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_040.png" alt="pict_040" width="531" height="733" /></p>
<p>Here is our new firewall object. Its name is <strong>guardian</strong>, it appears in the object tree in the left hand side of the main window in the folder <strong>Firewalls</strong>. When an object is selected in the tree, a brief summary of its properties appears in the panel under the tree. Double-clicking on the object in the tree opens it in the editor panel at the bottom of the right hand side panel of the main window. The editor for the firewall object allows the user to change its name, platform and host OS and also provides buttons that open dialogs for &#8220;advanced&#8221; settings for the firewall platform and host OS. We will inspect these little later in this tutorial.</p>
<p>You can always resize the main window to make all columns of the policy view be visible.</p>
<p><img class="alignnone size-full wp-image-1091" title="pict_050" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_050.png" alt="pict_050" width="550" height="466" /></p>
<p>Now would be a good time to save the data to a disk file. This is done in a usual way using main menu <strong>File/Save As</strong>.</p>
<p>Lets take a little tour of the network and service objects that come standard with the program. You can use these preconfigured objects to build policy and NAT rules for your firewall.</p>
<p>Objects in the tree are orginized in libraries, you can switch between libraries using drop-down menu above the tree. Firewall Builder comes with a collection of address, network, service and time interval objects in the library called &#8220;Standard&#8221;. Lets take a look at them. Notice that the background color of the panel that shows objects tree depends on the chosen object library. This makes it easier to keep track of the library currently opened in the program.</p>
<p><img class="alignnone size-full wp-image-1092" title="pict_060" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_060.png" alt="pict_060" width="274" height="203" /></p>
<p>Folder <strong>Objects/Hosts</strong> contains few host objects used in standard firewall templates. Folder <strong>Objects/Network</strong> contains network objects that represent various standard address ranges and blocks, such as multicast, net 127/8, networks defined in RFC1918 and so on.</p>
<p><img class="alignnone size-full wp-image-1093" title="pict_070" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_070.png" alt="pict_070" width="257" height="348" /></p>
<p>Firewall Builder also comes with extensive collection of TCP, UDP and ICMP service objects that describe commonly used protocols. This slide shows some TCP objects (all of them do not fit in the screenshot).</p>
<p><img class="alignnone size-full wp-image-1094" title="pict_080" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_080.png" alt="pict_080" width="260" height="347" /></p>
<p>Here is an example of a simple TCP service. It defines source and destination port ranges (in this case source port range is not defined and there is only one destination port 80). TCP service object can also define any combination of tcp flags the firewall should inspect and also which ones of them should be set in order for a packet to match this object. In the case of the service &#8220;http&#8221; we do not need to define any flags.</p>
<p><img class="alignnone size-full wp-image-1095" title="pict_090" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_090.png" alt="pict_090" width="551" height="254" /></p>
<p>Now lets take a look at the objects created as part of the new firewall object <strong>guardian</strong>. In order to do this, switch to the library <strong>User</strong> where this object was created. To open an object in the editor panel to inspect or change it, double click on it in the tree. Also, if you click on an object in the policy rule to select it, it will automatically open in the tree on the left.</p>
<p><img class="alignnone size-full wp-image-1096" title="pict_100" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_100.png" alt="pict_100" width="550" height="465" /></p>
<p>First, the firewall object itself.</p>
<p>Every object in fwbuilder has basic attributes such as its name and comment. Other attributes depend on the object type.</p>
<p>Attributes of the firewall object include platform (can be iptables, pf, ipfilter, etc.), version (platform-depended) and host OS. Buttons <strong>Host OS Settings</strong> and <strong>Firewall Settings</strong> open dialogs with many additional attributes that depend on the firewall platform and host OS. More on these later.</p>
<p><img class="alignnone size-full wp-image-1097" title="pict_110" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_110.png" alt="pict_110" width="551" height="260" /></p>
<p>Here are the choices for the firewall platform, version (for iptables) and host OS.</p>
<p><img class="alignnone size-full wp-image-1098" title="pict_103" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_103.png" alt="pict_103" width="550" height="460" /></p>
<p>Interfaces of the firewall are represented by objects located below the Firewall object in the tree. We refer to them as &#8220;children&#8221; of the firewall object. This slide demonstrates properties of the interface eth0. To open it in the editor double click on it in the tree. If editor panel is already open and shows some object, it is sufficient to select new object in the tree to reveal it in the editor panel (no need to double click).</p>
<p>IP and MAC addresses of interfaces are represented by child objects in the tree located below corresponding interface.</p>
<p><img class="alignnone size-full wp-image-1099" title="pict_120" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_120.png" alt="pict_120" width="261" height="243" /></p>
<p>Interface object has several attributes that define its function, such as &#8220;Management interface&#8221;, &#8220;external&#8221; etc.</p>
<ul>
<li>Name: the name of the interface object in Firewall Builder must match exactly the name of the interface of the firewall machine it represents. This will be something like &#8220;eth0&#8243;, &#8220;eth1&#8243;, &#8220;en0&#8243;, &#8220;br0&#8243; and so on.</li>
<li>Label: On most OS this ﬁeld is not used and serves the purpose of a descriptive label. Firewall Builder GUI uses a label, if it is not blank, to show interfaces in the tree. One of the suggested uses for this ﬁeld is to mark interfaces to reﬂect the network topology (’outside’, ’inside’) or the purpose (’web frontend’ or ’backup subnet’). The label is mandatory for Cisco PIX though, where it must reﬂect the network topology.</li>
<li>&#8220;Management interface&#8221;: Sometimes the host has several network interfaces in which case one of them can be marked as the ’manaagement interface’. The management interface is used for all communication between Firewall Builder and the host.</li>
<li>&#8220;External interface (insecure)&#8221;: marks an interface that connects to the Internet.</li>
<li>&#8220;Unprotected interface&#8221;: marks interface to which fwbuilder should not assign any access lists (used only with Cisco IOS platform)</li>
<li>&#8220;Regular Interface&#8221;: Use this option if the interface has an IP address assigned to it manually.</li>
<li>&#8220;Address is assigned dynamically&#8221;: Use this option if the interface has a dynamic address (obtained by means of DHCP or PPP or another protocol); in this case an address is unknown at the moment when Firewall Builder generates the ﬁrewall policy.</li>
<li>&#8220;Unnumbered interface&#8221;: Use this option if the interface can never have an IP address, such as the ethernet interface used to run PPPoE communication on some ADSL connections, tunnel endpoint interface, or an interface on a bridging ﬁrewall. See below Section 5.3.1 for more detailed discussion of these different types of interfaces.</li>
<li>&#8220;Bridge port&#8221;: this option is used for port of bridged firewall.</li>
<li>&#8220;Security level&#8221;: security level of this interface, used only with Cisco PIX (ASA)</li>
<li>&#8220;Network zone&#8221;: network zone of this interface, used only with Cisco PIX (ASA). Network zone drop-down list shows all network obejcts and groups of addresses and networks present in the tree. Choose one of them to tell the compiler which networks and blocks of addresses can be reached through this interface. Compiler uses this information to decide which interface each ACL rule should be associated with based on the addresses used in the destination of the rule.</li>
</ul>
<p><img class="alignnone size-full wp-image-1100" title="pict_130" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_130.png" alt="pict_130" width="551" height="260" /></p>
<p>Here is IP address of interface eth0, external interface of the firewall. The address and netmask are attributes of the child object of the type &#8220;IPv4 address&#8221;. Here the address is &#8220;192.0.2.1&#8243; and netmask &#8220;255.255.255.0&#8243;. Button &#8220;DNS Lookup&#8221; can be used to determine ip address using DNS. The program runs DNS query for the &#8220;A&#8221; record for the name of the parent firewall object.</p>
<p><img class="alignnone size-full wp-image-1101" title="pict_140" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_140.png" alt="pict_140" width="547" height="259" /></p>
<p>Lets look at the IP address of the internal interface of the firewall. The address used in the template is  192.168.1.1&#8243; with netmask &#8220;255.255.255.0&#8243;. This is rather typical address used for small and home networks. Some commercial firewall appliances come preconfigured with this address.</p>
<p><img class="alignnone size-full wp-image-1102" title="pict_150" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_150.png" alt="pict_150" width="479" height="601" /></p>
<p>If address <strong>192.168.1.0/24</strong> matches address of your local network, you can skip this part of the guide and move to the page 4. Otherwise, you need to reconfigure the address of the internal interface of the firewall object that you just created in fwbuilder and also change address object used in the policy rules. Start with changing address attribute (and possibly netmask, if necessary) of the object <strong>guardian:eth1:ip</strong> as shown in the screenshot:</p>
<p><img class="alignnone size-full wp-image-1103" title="pict_160" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_160.png" alt="pict_160" width="300" height="267" /></p>
<p>Now we need to change IP address used in the rules. To do this, we create new Network object with correct address and replace object <strong>net-192.168.1.0</strong> in all rules with this new network object.</p>
<p>Use new object menu to create Network object.</p>
<p><img class="alignnone size-full wp-image-1104" title="pict_170" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_170.png" alt="pict_170" width="268" height="212" /></p>
<p>New Network object is created with default name &#8216;New Network&#8217; and IP address 0.0.0.0.</p>
<p><img class="alignnone size-full wp-image-1105" title="pict_180" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_180.png" alt="pict_180" width="516" height="270" /></p>
<p>Edit object name and address, then hit &#8220;Apply&#8221;.</p>
<p><img class="alignnone size-full wp-image-1106" title="pict_190" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_190.png" alt="pict_190" width="516" height="288" /></p>
<p>Use menu Object / Find to activate search and replace dialog. The Find and Replace dialog opens at the bottom of the right hand side panel in the main window, below the policy rules view.</p>
<p><img class="alignnone size-full wp-image-1107" title="pict_200" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_200.png" alt="pict_200" width="327" height="176" /></p>
<p>Locate object object <strong>net-192.168.1.0</strong> in any policy rule where it is used or in its location in the tree in library <strong>Standard</strong> and drag and drop it to the left object well in the search and replace dialog as shown on the screenshot:</p>
<p><img class="alignnone size-full wp-image-1108" title="pict_210" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_210.png" alt="pict_210" width="550" height="179" /></p>
<p>Change the scope setting to &#8220;Policy of all firewalls&#8221;. If you have many firewalls in the tree, use scope &#8220;policy of the opened firewall&#8221; instead.  Locate new Network object you just created in the tree and drag and drop it to the right object well in the search and replace dialog as shown on the screenshot:</p>
<p><img class="alignnone size-full wp-image-1109" title="pict_220" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_220.png" alt="pict_220" width="550" height="105" /></p>
<p>Now hit &#8220;Replace all&#8221; button. Pop-up dialog should appear and report how many replacements the program had to make in all rules of the firewall. Note that the replacement is done not only in the policy rules, but in NAT rules as well.</p>
<p><img class="alignnone size-full wp-image-1110" title="pict_230" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_230.png" alt="pict_230" width="254" height="203" /></p>
<p>Now that you have created a new object and replaced old network object with new one in all rules, do not forget to save data to a file using menu <strong>File/Save</strong></p>
<p>Lets inspect properties of the firewall object. Double click on the firewall &#8220;guardian&#8221; in the tree to open it in the editor panel, then click &#8220;Firewall Settings&#8221; button in the editor. This opens new dialog that looks like this. Notice button &#8220;Help&#8221; in this dialog, clicking this button opens help as shown on the next slide.</p>
<p><img class="alignnone size-full wp-image-1111" title="pict_240" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_240.png" alt="pict_240" width="550" height="607" /></p>
<p>Online help explains all attributes and parameters located in each tab of the firewall settings dialog. I encourage you to explore it as many parameters are important and affect generated iptables script in different ways.</p>
<p>Next few screenshots show other tabs of the firewall settings dialog. You can find detailed explanations of all parameters in the online help.</p>
<p><img class="alignnone size-full wp-image-1112" title="pict_250" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_250.png" alt="pict_250" width="550" height="497" /></p>
<p>This page defines various parameters for the built-in policy installer. Installer uses ssh client (pscp.exe and plink.exe on Windows) to transfer generated script to the firewall machine and activate it there.</p>
<p><img class="alignnone size-full wp-image-1113" title="pict_260" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_260.png" alt="pict_260" width="550" height="607" /></p>
<p>User can define shell commands that will be included in the generated script at the beginning and in the end of it. These commands can do anything you want, such as configure some subsystems, set up routing etc.</p>
<p><img class="alignnone size-full wp-image-1114" title="pict_270" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_270.png" alt="pict_270" width="550" height="608" /></p>
<p>Parameters for logging.</p>
<p><img class="alignnone size-full wp-image-1117" title="pict_280" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_280.png" alt="pict_280" width="549" height="283" /></p>
<p>More options for the script generation. Notice that fwbuilder can produce iptables script in two formats: 1) as a shell script that calls iptables utility to add each rule one by one, or 2) it can use iptables-restore script to activate the whole policy at once. Other parameters are explained in the online help.</p>
<p><img class="alignnone size-full wp-image-1119" title="pict_290" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_290.png" alt="pict_290" width="550" height="263" /></p>
<p>Starting with v3.0 Firewall Builder can generate both IPv4 and IPv6 policy. This tab controls the order in which they are added to the script if user defined rules for both address families in the Policy objects of the firewall.</p>
<p><img class="alignnone size-full wp-image-1121" title="pict_300" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_300.png" alt="pict_300" width="550" height="149" /></p>
<p>Lets take a look at the policy of the template firewall. These rules are intended to be an example, a starting point to help you create your own policy quicker. Most likely you will want to modify them to suite your requirements. Explanation of the rules given here is rather brief because the goal of this guide was only to demonstrate how to use Firewall Builder.</p>
<ul>
<li>Rule 0: this is an anti-spoofing rule. It block incoming packets with source address that matches addresses of the firewall or internal or DMZ networks. The rule is associated with outside interface and has direction set to &#8220;Inbound&#8221;.</li>
<li>Rule 1: this rule permits any packets on loopback interface. This is necessary because many services on the firewall machine communicate back to the same machine via loopback.</li>
<li>Rule 2: permit ssh access from internal network to the firewall machine. Notice service object &#8220;ssh&#8221; in the column &#8220;Service&#8221;. This object can be found in the Standard objects library, folder Services/TCP.</li>
</ul>
<p><img class="alignnone size-full wp-image-1122" title="pict_310" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_310.png" alt="pict_310" width="550" height="288" /></p>
<p>Policy rules belong to the object &#8220;Policy&#8221;, which is a child object of the firewall and can be found in the tree right below it. As any other object in Firewall Builder, Policy object has some attributes that you can edit if you double click on it in the tree.</p>
<ul>
<li> Policy can be either IPv4, or IPv4 or combined IPv4 and IPv6. In the latter case you can use a mix of IPv4 and IPv6 addess objects in the same policy (in different rules) and Firewall Builder will automatically figure out which one is which and will sort them out.</li>
<li> Policy can translate to only mangle table, or a combination of filter and mangle tables. Again, in the latter case policy compiler decides which table to use based on the rule action and service object. Some actions, such as &#8220;Tag&#8221; (translates into iptables target MARK) go into mangle table.</li>
<li> &#8220;Top ruleset&#8221; means that compiler will place generated iptables rules into built-in chains INPUT/OUTPUT/FORWARD. If policy is not marked as &#8220;top ruleset&#8221;, generated rules will go into user-defined chain with the name the same as the name of the policy object.</li>
</ul>
<p><img class="alignnone size-full wp-image-1123" title="pict_320" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_320.png" alt="pict_320" width="503" height="255" /></p>
<p>Here are preconfigured NAT rules.</p>
<ul>
<li>Rule 0: tells the firewall that no address translation should be done for packets coming from network 192.168.2.0 going to 192.168.1.0 (because Translated Source, Translated Destination and Translated Service are left empty)</li>
<li>Rule 1: packets coming to the firewall from internal and DMZ networks should be translated so that source address will change and become that of the outside interface of the firewall.</li>
<li>Rule 2: packets coming from the Internet to the interface &#8220;outside&#8221; will be translated and forwarded to the internal server on DMZ represented by the host object &#8220;server on dmz&#8221;.</li>
</ul>
<p><img class="alignnone size-full wp-image-1120" title="pict_330" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_330.png" alt="pict_330" width="550" height="110" /></p>
<p>Now we should be ready to compile policy of the firewall <strong>guardian</strong> and generate iptables script. To do this, select firewall in the tree and click right mouse button. Choose item &#8220;Compile&#8221; in the pop-up menu. The dialog that appears lists all firewall objects defined in the objects tree and lets you select which ones should be compiled. The firewall <strong>guardian</strong> has just been created and has never been compiled and dialog shows that. Make sure checkbox next to the firewall object <strong>guardian</strong> is checked and click button <strong>&#8220;Next&#8221;</strong>.</p>
<p><img class="alignnone size-full wp-image-1118" title="pict_340" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_340.png" alt="pict_340" width="549" height="546" /></p>
<p>Firewall Builder calls policy compiler (which is by the way an external program which can be used on the command line). The next page of the dialog shows compiler progress and result.</p>
<p><img class="alignnone size-full wp-image-1116" title="pict_350" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_350.png" alt="pict_350" width="550" height="414" /></p>
<p>Compiler generates iptables script in the file with the name the same as the name of the firewall object, with extension &#8220;.fw&#8221;. The file is placed in the same directory where the data file .fwb is located.</p>
<blockquote><p><code> $ ls -la test2.fwb guardian.fw</code></p>
<p><code>-rwxr-xr-x 1 vadim vadim 11253 2009-02-16 16:41 guardian.fw</p>
<p></code><code>-rw-r--r-- 1 vadim vadim 24696 2009-02-16 16:41 test2.fwb</code></p></blockquote>
<p>Here is how generated script looks liie. This is just a fragment from the middle to show some generated iptables commands.</p>
<blockquote><p><code><br />
# ================ IPv4<br />
# ================ Table 'filter', automatic rules</p>
<p>$IPTABLES -P OUTPUT  DROP<br />
$IPTABLES -P INPUT   DROP<br />
$IPTABLES -P FORWARD DROP</p>
<p>cat /proc/net/ip_tables_names | while read table; do</p>
<p>$IPTABLES -t $table -L -n | while read c chain rest; do</p>
<p>if test "X$c" = "XChain" ; then<br />
$IPTABLES -t $table -F $chain<br />
fi<br />
done</p>
<p>$IPTABLES -t $table -X<br />
done</p>
<p>$IPTABLES -A INPUT   -m state --state ESTABLISHED,RELATED -j ACCEPT<br />
$IPTABLES -A OUTPUT  -m state --state ESTABLISHED,RELATED -j ACCEPT<br />
$IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT</p>
<p># ================ Table 'nat',  rule set NAT<br />
# NAT compiler errors and warnings:</p>
<p>#<br />
#<br />
# Rule 0 (NAT)<br />
#</p>
<p>echo "Rule 0 (NAT)"</p>
<p>#<br />
# no need to translate<br />
# between DMZ and<br />
# internal net</p>
<p>$IPTABLES -t nat -A POSTROUTING   -s 192.168.2.0/24 -d 172.16.22.0/24 -j ACCEPT<br />
$IPTABLES -t nat -A PREROUTING   -s 192.168.2.0/24 -d 172.16.22.0/24 -j ACCEPT<br />
</code></p></blockquote>
<p>Now you can transfer it to the firewall and execute it there to install iptables rules. However it is much more convenient to use built-in policy installer to do this. To use installer, click right mouse button on the firewall object in the tree and use menu item <strong>Install</strong>. Firewall Builder will compile the policy if necessary and then open dialog where you can configure parameters of the installer. Here you need to enter password to authenticate to the firewall. Once you click <strong>OK</strong>, installer will connect to the firewall using ssh client. First, it will copy generated script to the directory <strong>/etc</strong> on the firewall (or different one, if configured in the <strong>Installer</strong> tab of firewall settings dialog), then it will run this script and check for errors. Its progress will be visible in the panel of the installer wizard, just like the progress of policy compiler.</p>
<p><img class="alignnone size-full wp-image-1115" title="pict_370" src="http://ubuntu-tutorials.com/wp-content/uploads/2009/06/pict_370.png" alt="pict_370" width="527" height="557" /></p>
<p>This guide walked you step by step through the process of creating of a firewall object, making some minor changes in its parameters and policy rules, compiling the policy and activating it on the firewall machine. This guide did not touch advanced topics such as built-in revision control system, working with multiple data files, working with multiple firewall objects, IPv6. You can find documentation and guides on these topics and more on our project web site at <a href="http://www.fwbuilder.org">http://www.fwbuilder.org</a>.<br />
<h3>Other Points of Interest</h3>
<ul class="related_post">
<li>June 12, 2009 &#8212; <a href="http://ubuntu-tutorials.com/2009/06/12/firewall-builder-using-the-policy-importer/" title="Firewall Builder: Using The Policy Importer">Firewall Builder: Using The Policy Importer (0)</a></li>
<li>July 9, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/07/09/enable-timed-or-automatic-login-on-ubuntu-804/" title="Enable Timed or Automatic Login on Ubuntu 8.04">Enable Timed or Automatic Login on Ubuntu 8.04 (10)</a></li>
<li>June 29, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/06/29/what-would-you-like-to-see-poll-expiring-tomorrow/" title="&#8220;What Would You Like To See?&#8221; Poll Expiring Tomorrow">&#8220;What Would You Like To See?&#8221; Poll Expiring Tomorrow (10)</a></li>
<li>June 18, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/06/18/tunnel-web-and-dns-traffic-over-ssh/" title="Tunnel Web and DNS Traffic Over SSH">Tunnel Web and DNS Traffic Over SSH (5)</a></li>
<li>May 4, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/05/04/why-ufw-does-not-need-a-gui/" title="Why ufw Does Not Need A GUI">Why ufw Does Not Need A GUI (14)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ubuntu-tutorials.com/2009/06/03/getting-started-with-firewall-builder/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Block Advertisements in ANY Browser via /etc/hosts</title>
		<link>http://ubuntu-tutorials.com/2009/05/15/block-advertisements-in-any-browser-via-etchosts/</link>
		<comments>http://ubuntu-tutorials.com/2009/05/15/block-advertisements-in-any-browser-via-etchosts/#comments</comments>
		<pubDate>Fri, 15 May 2009 16:57:49 +0000</pubDate>
		<dc:creator>Christer Edwards</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[adblock]]></category>
		<category><![CDATA[adware]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[extensions]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[hosts]]></category>
		<category><![CDATA[malicious]]></category>
		<category><![CDATA[spyware]]></category>

		<guid isPermaLink="false">http://ubuntu-tutorials.com/?p=1075</guid>
		<description><![CDATA[I have been getting more and more tired of Firefox lately. Tired of the bloat. The unreliability. The gecko engine. I&#8217;ve been tinkering with alternate browsers such as Midori (which is *great*, assuming you can get &#62;=0.1.6), Arora and Chromium. I think WebKit is the browser engine of the future, and with these browsers it [...]]]></description>
			<content:encoded><![CDATA[<p>I have been getting more and more tired of Firefox lately. Tired of the bloat. The unreliability. The gecko engine. I&#8217;ve been tinkering with alternate browsers such as Midori (which is *great*, assuming you can get &gt;=0.1.6), Arora and Chromium. I think WebKit is the browser engine of the future, and with these browsers it is <em>nearly</em> a reality. They are still a little rough around the edges, but I can honestly see one of them absolutely taking off by the end of this year. Firefox, prepare to be dethroned!</p>
<p>The one missing link in most users transition to a new browser however is their reliability on extensions. I know I have a few extensions that I really don&#8217;t like to live without. I bet you do as well. Let me guess what your number one extension is? AdBlock Plus? So, if these new browsers don&#8217;t have an extension architecture (yet), how can I block ads? You can use your /etc/hosts file.</p>
<p>Let me tell you, quickly, about the /etc/hosts file for those that may not be familiar. The <em>/etc/hosts</em> file is the predecessor to the DNS system that we use now. It is a local mapping of IP address to hostname. At this point, as we now rely on DNS, the <em>/etc/hosts</em> file is generally pretty empty. You&#8217;ll likely just have entries that make sure your machine can find itself by localhost or hostname. Something along the lines of:</p>
<blockquote><p><code>127.0.0.1    localhost  hostname</code></p></blockquote>
<p>Now, you might be thinking &#8220;How am I going to block all the internets advertisements if my <em>/etc/hosts</em> file looks like that?&#8221; Well, you won&#8217;t, if it just looks like that. I have a solution for you though, and it requires very little work on your part.</p>
<p>In searching for a solution I have come across an <em>/etc/hosts</em> file that is (minus comments) 15,169 lines long. That&#8217;s right. Fifteen thousand one hundred sixty nine lines long. That is a lot of mapped IP addresses! What someone has done is collect every nasty thing he could find into the hosts file, and map it to 127.0.0.1.</p>
<p>What does that actually mean? It means that anytime your browser is told to display an ad it&#8217;ll need to look up the address. The <em>/etc/hosts</em> file is checked first <em>before</em> DNS, which then tells it to ask the local machine. The local machine, of course, does not have that information to display and therefore nothing is displayed. Bingo! No more ads.</p>
<p>But wait, there&#8217;s more! This not only applies to blocking ads, but also banners, 3rd party cookies, 3rd party page counters, web bugs, and even most hijackers. You&#8217;re not only blocking advertisements, you&#8217;re outright blocking thousands of known problematic and malicious websites. And all this without requiring a single Firefox extension. It works in <strong>ANY</strong> browser.</p>
<p>So, I hope you&#8217;re wondering where you can get a copy of this magical file that solves all of the worlds woes. Well you can get it here of course!</p>
<p><strong>disclaimer</strong>: <em>I am not the original author of this file, but it has been published under a CC-BY-SA license and under that license I am redistributing it. Attribution is contained within the file itself.</em></p>
<blockquote><p><code>sudo mv /etc/hosts /etc/hosts.orig</code></p>
<p>sudo wget -c http://zelut.org/projects/misc/hosts -O /etc/hosts</p></blockquote>
<p>These commands will move your original file as a backup and then pull the file from the web, putting it directly where it needs to go. You should be ready-set-protected after completion of the second command. Pull up a browser (hopefully you&#8217;ll try something other than Firefox), and give it a try.</p>
<p>If you have anything to add or subtract from the hosts file, you may edit it directly with a text editor. If you&#8217;d like to share your changes with the rest of us you may email me your update in the form of a patch. Please make sure your patch is created against the <a title="latest version - super hosts file" href="http://zelut.org/projects/misc/hosts">latest version</a>.</p>
<p>I hope this solution works for many of you towards trying out and helping improve alternate browsers. Again, I highly suggest Midori or Arora as GTK or Qt (respectively) WebKit based browsers.<br />
<h3>Other Points of Interest</h3>
<ul class="related_post">
<li>June 18, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/06/18/tunnel-web-and-dns-traffic-over-ssh/" title="Tunnel Web and DNS Traffic Over SSH">Tunnel Web and DNS Traffic Over SSH (5)</a></li>
<li>April 4, 2009 &#8212; <a href="http://ubuntu-tutorials.com/2009/04/04/help-needed-auto-configure-proxy-settings-via-dhcp/" title="Help Needed: Auto-Configure Proxy Settings via DHCP">Help Needed: Auto-Configure Proxy Settings via DHCP (13)</a></li>
<li>February 24, 2009 &#8212; <a href="http://ubuntu-tutorials.com/2009/02/24/dns-hiccup/" title="DNS Hiccup">DNS Hiccup (0)</a></li>
<li>February 22, 2009 &#8212; <a href="http://ubuntu-tutorials.com/2009/02/22/server-migration-complete/" title="Server Migration Complete">Server Migration Complete (5)</a></li>
<li>November 12, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/11/12/wiki-editing-with-your-favorite-editor/" title="Wiki Editing With Your Favorite Editor">Wiki Editing With Your Favorite Editor (5)</a></li>
<li>October 25, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/10/25/ubuntu-tutorials-search-plugin/" title="Ubuntu Tutorials Search Plugin">Ubuntu Tutorials Search Plugin (1)</a></li>
<li>July 15, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/07/15/create-smart-keyword-search-for-ubuntu-tutorials/" title="Create Smart Keyword Search for Ubuntu Tutorials">Create Smart Keyword Search for Ubuntu Tutorials (7)</a></li>
<li>July 8, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/07/08/improve-application-startup-times-with-preload/" title="Improve Application Startup Times With Preload">Improve Application Startup Times With Preload (5)</a></li>
<li>June 25, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/06/25/install-adobe-acrobat-plugins-for-firefox/" title="Install Adobe Acrobat Plugins For Firefox">Install Adobe Acrobat Plugins For Firefox (5)</a></li>
<li>June 22, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/06/22/firefox-shortcut-keys/" title="Firefox Shortcut Keys">Firefox Shortcut Keys (21)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ubuntu-tutorials.com/2009/05/15/block-advertisements-in-any-browser-via-etchosts/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Add PPA Key To Your Apt Keyring</title>
		<link>http://ubuntu-tutorials.com/2009/05/14/add-ppa-key-to-your-apt-keyring/</link>
		<comments>http://ubuntu-tutorials.com/2009/05/14/add-ppa-key-to-your-apt-keyring/#comments</comments>
		<pubDate>Thu, 14 May 2009 22:07:10 +0000</pubDate>
		<dc:creator>Christer Edwards</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[apt]]></category>
		<category><![CDATA[GPG]]></category>
		<category><![CDATA[keyring]]></category>
		<category><![CDATA[PPA]]></category>

		<guid isPermaLink="false">http://ubuntu-tutorials.com/?p=1072</guid>
		<description><![CDATA[I know many of you use Launchpad&#8217;s &#8220;Personal Package Archive&#8221; for updated and beta packages. I have about a half-dozen configured on my machine to give me the latest and greatest of my favorite applications. The one problem with a PPA though is that the packages can&#8217;t be verified when downloaded because you don&#8217;t have [...]]]></description>
			<content:encoded><![CDATA[<p>I know many of you use Launchpad&#8217;s &#8220;Personal Package Archive&#8221; for updated and beta packages. I have about a half-dozen configured on my machine to give me the latest and greatest of my favorite applications. The one problem with a PPA though is that the packages can&#8217;t be verified when downloaded because you don&#8217;t have the GPG imported into your Apt Keyring. The following command is a template that you can use to import whatever PPA based keys you have warnings on:</p>
<blockquote><p><code>sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys &lt;key id&gt;</code></p></blockquote>
<p>You can gather the &lt;key id&gt; in the output of:</p>
<blockquote><p><code>sudo apt-get update</code></p></blockquote>
<p>You should see the warnings, along with the key id at the bottom of the output.</p>
<p>For each GPG key that you get a warning on, run the command above, and you&#8217;ll stop seeing the warnings. You will have imported that team/project&#8217;s GPG key into your keyring, considering them trusted.<br />
<h3>Other Points of Interest</h3>
<ul class="related_post">
<li>July 21, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/07/21/a-supported-pgp-passphrase-agent-is-not-running/" title="A supported PGP passphrase agent is not running">A supported PGP passphrase agent is not running (1)</a></li>
<li>June 11, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/06/11/like-gnome-do-check-out-the-05-release/" title="Like Gnome-Do?  Check Out The 0.5 Release!">Like Gnome-Do?  Check Out The 0.5 Release! (9)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ubuntu-tutorials.com/2009/05/14/add-ppa-key-to-your-apt-keyring/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Automatically Logout SSH Sessions After Period of Inactivity</title>
		<link>http://ubuntu-tutorials.com/2009/03/02/automatically-logout-ssh-sessions-after-period-of-inactivity/</link>
		<comments>http://ubuntu-tutorials.com/2009/03/02/automatically-logout-ssh-sessions-after-period-of-inactivity/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 01:33:13 +0000</pubDate>
		<dc:creator>Christer Edwards</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[.ssh]]></category>

		<guid isPermaLink="false">http://ubuntu-tutorials.com/?p=965</guid>
		<description><![CDATA[At work we maintain over a hundred machines, most of which are regularly accessed via SSH by our developers.  Due to the number of machines and the number of tasks that need completed, we found that many of the developers would often forget they were logged into a server and leave an idle SSH session [...]]]></description>
			<content:encoded><![CDATA[<p>At work we maintain over a hundred machines, most of which are regularly accessed via SSH by our developers.  Due to the number of machines and the number of tasks that need completed, we found that many of the developers would often forget they were logged into a server and leave an idle SSH session open.  Due to the sensitive nature of the data on many of the servers we needed to find a solution to this.  We decided to implement an SSH feature to automatically logout SSH sessions after a period of inactivity.  Here is how we did it.</p>
<p>Inside the sshd_config file (/etc/ssh/sshd_config) there is a setting for <code>ClientAliveInterval</code> and <code>ClientAliveCountMax</code>.  Edit these two lines to look something like:</p>
<blockquote><p><code>ClientAliveInterval 300<br />
ClientAliveCountMax 0<br />
</code></p></blockquote>
<p>Once these settings are changed you&#8217;ll need to restart your SSH server for them to take effect.</p>
<blockquote><p><code>sudo /etc/init.d/ssh restart</code></p></blockquote>
<p>Now, if an SSH session is connected with no activity for five minutes, it&#8217;ll be automatically logged out. Hopefully reducing the chance of an open connection becoming vulnerable at an idle workstation.<br />
<h3>Other Points of Interest</h3>
<ul class="related_post">
<li>March 6, 2009 &#8212; <a href="http://ubuntu-tutorials.com/2009/03/06/ssh-pop-quiz/" title="SSH Pop Quiz">SSH Pop Quiz (14)</a></li>
<li>June 18, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/06/18/tunnel-web-and-dns-traffic-over-ssh/" title="Tunnel Web and DNS Traffic Over SSH">Tunnel Web and DNS Traffic Over SSH (5)</a></li>
<li>June 12, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/06/12/use-vnc-encrypt-it-via-ssh/" title="Use VNC?  Encrypt It Via SSH">Use VNC?  Encrypt It Via SSH (9)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ubuntu-tutorials.com/2009/03/02/automatically-logout-ssh-sessions-after-period-of-inactivity/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Standard Process for Restoring IPtables at Boot?</title>
		<link>http://ubuntu-tutorials.com/2009/02/28/standard-process-for-restoring-iptables-at-boot/</link>
		<comments>http://ubuntu-tutorials.com/2009/02/28/standard-process-for-restoring-iptables-at-boot/#comments</comments>
		<pubDate>Sat, 28 Feb 2009 15:35:47 +0000</pubDate>
		<dc:creator>Christer Edwards</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://ubuntu-tutorials.com/?p=961</guid>
		<description><![CDATA[I got to thinking about something the other day when I rebuilt my webserver using Debian 5.0.  How does Debian/Ubuntu standardize on reloading the iptables rules at boot time?
I know that Red Hat and its variants use the /etc/sysconfig/iptables file as a save and restore point, and there is an init script, iptables, that [...]]]></description>
			<content:encoded><![CDATA[<p>I got to thinking about something the other day when I rebuilt my webserver using Debian 5.0.  How does Debian/Ubuntu standardize on reloading the iptables rules at boot time?</p>
<p>I know that Red Hat and its variants use the <strong>/etc/sysconfig/iptables</strong> file as a save and restore point, and there is an init script, <strong>iptables</strong>, that starts at boot prior to the network script, but is there a similar standard on Debian/Ubuntu?</p>
<p>The solution I&#8217;ve come up with (and I&#8217;m very curious to hear what others have done) is the following:</p>
<p>First, I manually enter my base iptables rules&#8230;</p>
<blockquote><p><code>iptables -A INPUT -i lo -j ACCEPT<br />
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT<br />
iptables -A INPUT -s 17.88.115.150/32 -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT<br />
iptables -A INPUT -s 111.70.51.51/32 -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT<br />
iptables -A INPUT -s 16.10.111.177/32 -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT<br />
iptables -A INPUT -j REJECT --reject-with icmp-host-unreachable<br />
...etc, etc.<br />
</code></p></blockquote>
<p>*(ip addresses have been scrambled to protect their identity) <img src='http://ubuntu-tutorials.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I then run:</p>
<blockquote><p><code>iptables-save &gt; /etc/default/iptables<br />
</code></p></blockquote>
<p>From this point forward I manually update my ruleset by editing the file directly with a text editor.</p>
<p>To reload these rules at boot-time I have added a line to my <strong>/etc/network/interfaces</strong> configuration as follows:</p>
<blockquote><p><code>auto eth0<br />
iface eth0 inet static<br />
address foo<br />
netmask bar<br />
gateway baz<br />
dns-search domain.tld<br />
dns-nameservers foo<br />
pre-up iptables-restore &lt; /etc/default/iptables</code></p></blockquote>
<p>That last line tells the machine that, before you activate these network settings, run <strong>iptables-restore</strong> and read from the file <strong>/etc/default/iptables</strong>.  This seems to work well enough so far, but I&#8217;m still curious what others have done.  Do you simply write an init script on your own and maintain the ruleset within that file?  Do you use a file similar to what I&#8217;ve done, but source it via an init script?  I&#8217;m curious, as there does not seem to be a standard that I&#8217;m aware of.<br />
<h3>Other Points of Interest</h3>
<ul class="related_post">
<li>June 12, 2009 &#8212; <a href="http://ubuntu-tutorials.com/2009/06/12/firewall-builder-using-the-policy-importer/" title="Firewall Builder: Using The Policy Importer">Firewall Builder: Using The Policy Importer (0)</a></li>
<li>April 23, 2009 &#8212; <a href="http://ubuntu-tutorials.com/2009/04/23/ubuntu-904-jaunty-released-torrents-available-here/" title="Ubuntu 9.04 &#8220;Jaunty&#8221; Released: Torrents Available Here">Ubuntu 9.04 &#8220;Jaunty&#8221; Released: Torrents Available Here (14)</a></li>
<li>April 1, 2009 &#8212; <a href="http://ubuntu-tutorials.com/2009/04/01/four-years-and-counting/" title="Four Years and Counting..">Four Years and Counting.. (0)</a></li>
<li>March 3, 2009 &#8212; <a href="http://ubuntu-tutorials.com/2009/03/03/thinking-about-covering-more-than-just-ubuntu/" title="Thinking About Covering More Than Just Ubuntu&#8230;">Thinking About Covering More Than Just Ubuntu&#8230; (25)</a></li>
<li>October 24, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/10/24/upgrading-using-the-alternate-cd-804-810/" title="Upgrading Using the Alternate CD (8.04 -> 8.10)&#8221;>Upgrading Using the Alternate CD (8.04 -> 8.10) (3)</a></li>
<li>June 28, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/06/28/install-xubuntu-desktop-alongside-ubuntu/" title="Install Xubuntu Desktop alongside Ubuntu">Install Xubuntu Desktop alongside Ubuntu (12)</a></li>
<li>June 27, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/06/27/presenting-at-oscon-2008-july-21-25-2008/" title="Presenting at OSCON 2008 : July 21-25, 2008">Presenting at OSCON 2008 : July 21-25, 2008 (1)</a></li>
<li>June 19, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/06/19/extend-your-battery-life-with-powertop/" title="Extend Your Battery Life With Powertop">Extend Your Battery Life With Powertop (9)</a></li>
<li>June 7, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/06/07/how-to-install-vmware-tools-on-ubuntu-804-guests/" title="How To Install VMware Tools on Ubuntu 8.04 Guests">How To Install VMware Tools on Ubuntu 8.04 Guests (28)</a></li>
<li>May 4, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/05/04/why-ufw-does-not-need-a-gui/" title="Why ufw Does Not Need A GUI">Why ufw Does Not Need A GUI (14)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ubuntu-tutorials.com/2009/02/28/standard-process-for-restoring-iptables-at-boot/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>A supported PGP passphrase agent is not running</title>
		<link>http://ubuntu-tutorials.com/2008/07/21/a-supported-pgp-passphrase-agent-is-not-running/</link>
		<comments>http://ubuntu-tutorials.com/2008/07/21/a-supported-pgp-passphrase-agent-is-not-running/#comments</comments>
		<pubDate>Tue, 22 Jul 2008 03:42:49 +0000</pubDate>
		<dc:creator>Christer Edwards</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[enigmail]]></category>
		<category><![CDATA[gpa]]></category>
		<category><![CDATA[GPG]]></category>
		<category><![CDATA[key]]></category>
		<category><![CDATA[seahorse]]></category>

		<guid isPermaLink="false">http://ubuntu-tutorials.com/?p=737</guid>
		<description><![CDATA[This post is published in the hope that it&#8217;ll help others solve an issue I&#8217;ve been dealing with for the past few weeks.  I have searched and searched for a solution and only recently found one workaround for the problem.  The bug that I have found is here.  Hopefully with some more attention it&#8217;ll be [...]]]></description>
			<content:encoded><![CDATA[<p>This post is published in the hope that it&#8217;ll help others solve an issue I&#8217;ve been dealing with for the past few weeks.  I have searched and searched for a solution and only recently found one workaround for the problem.  The bug that I have found is <a title="A supported PGP passphrase agent is not running" href="https://bugs.launchpad.net/ubuntu/+source/seahorse/+bug/183514">here</a>.  Hopefully with some more attention it&#8217;ll be properly fixed.</p>
<p>The issue that I have been running into is that no supported PGP passphrase agents were running.  In other words I was not able to unlock my PGP keys for email signing and encryption.  You will have noticed this problem if you use email signing and encryption with tools such as Enigmail, etc.</p>
<p>The solution that I found, which is also outlined within the bug, is to remove a file that is apparently being loaded when the X session starts.  For some reason this file conflicts with the seahorse key caching system, and neither work.</p>
<p>To fix the issue simply move the conflicting file elsewhere:</p>
<blockquote><p><code>sudo mv /etc/X11/Xsession.d/90gpg-agent ~/90gpg-agent.bak</code></p></blockquote>
<p>Once this file is moved you should be able to restart X and have your key-caching functionality again.  If anyone else has a better fix or other suggestions please comment.<br />
<h3>Other Points of Interest</h3>
<ul class="related_post">
<li>May 14, 2009 &#8212; <a href="http://ubuntu-tutorials.com/2009/05/14/add-ppa-key-to-your-apt-keyring/" title="Add PPA Key To Your Apt Keyring">Add PPA Key To Your Apt Keyring (3)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ubuntu-tutorials.com/2008/07/21/a-supported-pgp-passphrase-agent-is-not-running/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tunnel Web and DNS Traffic Over SSH</title>
		<link>http://ubuntu-tutorials.com/2008/06/18/tunnel-web-and-dns-traffic-over-ssh/</link>
		<comments>http://ubuntu-tutorials.com/2008/06/18/tunnel-web-and-dns-traffic-over-ssh/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 11:06:35 +0000</pubDate>
		<dc:creator>Christer Edwards</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[.ssh]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[tunnel]]></category>

		<guid isPermaLink="false">http://ubuntu-tutorials.com/?p=679</guid>
		<description><![CDATA[I have been tunneling all of my web traffic over an encrypted SSH connection for some time now.  Considering the fact that I travel a lot, I&#8217;m very regularly on untrusted, insecure networks.  I prefer to secure those connections (web, IM, email, etc) by creating an encrypted SSH connection and pushing the traffic [...]]]></description>
			<content:encoded><![CDATA[<p>I have been tunneling all of my web traffic over an encrypted SSH connection for some time now.  Considering the fact that I travel a lot, I&#8217;m very regularly on untrusted, insecure networks.  I prefer to secure those connections (web, IM, email, etc) by creating an encrypted SSH connection and pushing the traffic through it.  Today I also found a method for also pushing DNS requests through the same tunnel.  This ensures total privacy between yourself and the SSH Server.</p>
<p><strong>Step 1: Creating the Tunnel</strong></p>
<p>Creating this private connection you&#8217;ll need a remote SSH server to connect to.  Mine runs at home in my garage on an old Pentium III 500MHz box (yeah, the kind most people threw away long, long ago!).  I connect to this tunnel using:</p>
<blockquote><p><code>ssh -D 8080 -fN user@server</code></p></blockquote>
<p>This creates a SOCKS compatible proxy, which is a requirement of the DNS forwarding.  Other methods on the interwebs suggest using <code>ssh -L</code> or similar, which are not SOCKS compatible proxies.</p>
<p><strong>Step 2: Forwarding DNS</strong></p>
<p>If you&#8217;d like to also forward your DNS requests (ie; the site addresses you type into your browser), you&#8217;ll need to change a setting in Firefox.  This can be done by accessing the address <a title="about config - firefox configuration" href="about:config">about:config</a>, and entering this string into the configuration:</p>
<blockquote><p><code>network.proxy.socks_remote_dns</code></p></blockquote>
<p>Change this value to &#8220;true&#8221;.</p>
<p><strong>Step 3: Using the Tunnel</strong></p>
<p>The last step is to configure your browser to use these new settings.  In Firefox 3 (I hope you&#8217;ve upgraded by now), you can activate/toggle these settings via:</p>
<blockquote><p><code>Edit &gt; Preferences &gt; Advanced &gt; Network &gt; Settings</code></p></blockquote>
<p>Select &#8220;Manual Proxy Configuration&#8221; and add <code>localhost</code> to the &#8220;SOCKS Host:&#8221; field, followed by port <code>8080</code> (assuming you&#8217;ve used the port in the example above).</p>
<p><a href="http://ubuntu-tutorials.com/wp-content/uploads/2008/06/socks-proxy.png"><img class="alignnone size-thumbnail wp-image-680" style="clear left" style="border: 1px solid black; margin: 1px; float: left;" title="socks-proxy" src="http://ubuntu-tutorials.com/wp-content/uploads/2008/06/socks-proxy-150x150.png" alt="configure proxy in firefox" width="150" height="150" /></a></p>
<p>This will then forward your web traffic through the SSH tunnel and DNS requests will also be forwarded.</p>
<p>You may want to check out the <a title="foxyproxy firefox addon" href="https://addons.mozilla.org/en-US/firefox/addon/2464">FoxyProxy</a> plugin for a simpler way of toggling this on &amp; off.</p>
<p>To deactivate the tunneling and use the local DNS again simply revert Step 3 back to &#8220;Direct Connection to the Internet&#8221;.<br />
<h3>Other Points of Interest</h3>
<ul class="related_post">
<li>May 15, 2009 &#8212; <a href="http://ubuntu-tutorials.com/2009/05/15/block-advertisements-in-any-browser-via-etchosts/" title="Block Advertisements in ANY Browser via /etc/hosts">Block Advertisements in ANY Browser via /etc/hosts (19)</a></li>
<li>June 12, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/06/12/use-vnc-encrypt-it-via-ssh/" title="Use VNC?  Encrypt It Via SSH">Use VNC?  Encrypt It Via SSH (9)</a></li>
<li>June 3, 2009 &#8212; <a href="http://ubuntu-tutorials.com/2009/06/03/getting-started-with-firewall-builder/" title="Getting Started with Firewall Builder">Getting Started with Firewall Builder (4)</a></li>
<li>April 4, 2009 &#8212; <a href="http://ubuntu-tutorials.com/2009/04/04/help-needed-auto-configure-proxy-settings-via-dhcp/" title="Help Needed: Auto-Configure Proxy Settings via DHCP">Help Needed: Auto-Configure Proxy Settings via DHCP (13)</a></li>
<li>March 6, 2009 &#8212; <a href="http://ubuntu-tutorials.com/2009/03/06/ssh-pop-quiz/" title="SSH Pop Quiz">SSH Pop Quiz (14)</a></li>
<li>March 2, 2009 &#8212; <a href="http://ubuntu-tutorials.com/2009/03/02/automatically-logout-ssh-sessions-after-period-of-inactivity/" title="Automatically Logout SSH Sessions After Period of Inactivity">Automatically Logout SSH Sessions After Period of Inactivity (2)</a></li>
<li>February 24, 2009 &#8212; <a href="http://ubuntu-tutorials.com/2009/02/24/dns-hiccup/" title="DNS Hiccup">DNS Hiccup (0)</a></li>
<li>February 22, 2009 &#8212; <a href="http://ubuntu-tutorials.com/2009/02/22/server-migration-complete/" title="Server Migration Complete">Server Migration Complete (5)</a></li>
<li>November 12, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/11/12/wiki-editing-with-your-favorite-editor/" title="Wiki Editing With Your Favorite Editor">Wiki Editing With Your Favorite Editor (5)</a></li>
<li>October 25, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/10/25/ubuntu-tutorials-search-plugin/" title="Ubuntu Tutorials Search Plugin">Ubuntu Tutorials Search Plugin (1)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ubuntu-tutorials.com/2008/06/18/tunnel-web-and-dns-traffic-over-ssh/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Use VNC?  Encrypt It Via SSH</title>
		<link>http://ubuntu-tutorials.com/2008/06/12/use-vnc-encrypt-it-via-ssh/</link>
		<comments>http://ubuntu-tutorials.com/2008/06/12/use-vnc-encrypt-it-via-ssh/#comments</comments>
		<pubDate>Fri, 13 Jun 2008 03:04:09 +0000</pubDate>
		<dc:creator>Christer Edwards</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[.ssh]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[Privacy]]></category>
		<category><![CDATA[vnc]]></category>

		<guid isPermaLink="false">http://ubuntu-tutorials.com/?p=667</guid>
		<description><![CDATA[I covered VNC this afternoon in my Linux system administration course and the question came up on how to secure VNC.  You may or may not be aware than VNC is not encrypted by default, which could be a security concern.
If you use VNC regularly to connect to other Linux machines you may want [...]]]></description>
			<content:encoded><![CDATA[<p>I covered VNC this afternoon in my Linux system administration course and the question came up on how to secure VNC.  You may or may not be aware than VNC is not encrypted by default, which could be a security concern.</p>
<p>If you use VNC regularly to connect to other Linux machines you may want to consider adding a level of encryption with SSH.  Here is a quick run-down on how that is done:</p>
<p>If you look at the man page for vncviewer (<code>man vncviewer</code>) you&#8217;ll notice there is a small section for <strong>-via</strong>.  The <strong>-via</strong> option, as outlined in the man page will do:</p>
<blockquote><p>Makes the connection go through SSH to a gateway host.  The gateway should be the target host for best connection secrecy.</p></blockquote>
<p>Basically this is saying that you can tunnel VNC over SSH within your connection command.  Let&#8217;s give it a try.</p>
<blockquote><p><code>vncviewer -via user@host localhost:0</code></p></blockquote>
<p>This, of course, will require that you have both ssh and vnc access to a remote machine.</p>
<p>This is a much simpler method than many other tutorials I&#8217;ve found which generally suggest creating a tunnel with ssh -L and then using that tunnel.<br />
<h3>Other Points of Interest</h3>
<ul class="related_post">
<li>June 18, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/06/18/tunnel-web-and-dns-traffic-over-ssh/" title="Tunnel Web and DNS Traffic Over SSH">Tunnel Web and DNS Traffic Over SSH (5)</a></li>
<li>March 6, 2009 &#8212; <a href="http://ubuntu-tutorials.com/2009/03/06/ssh-pop-quiz/" title="SSH Pop Quiz">SSH Pop Quiz (14)</a></li>
<li>March 2, 2009 &#8212; <a href="http://ubuntu-tutorials.com/2009/03/02/automatically-logout-ssh-sessions-after-period-of-inactivity/" title="Automatically Logout SSH Sessions After Period of Inactivity">Automatically Logout SSH Sessions After Period of Inactivity (2)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ubuntu-tutorials.com/2008/06/12/use-vnc-encrypt-it-via-ssh/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>OpenSSL &amp; OpenSSH Vulnerabilities : Confirm &amp; Fix Instructions</title>
		<link>http://ubuntu-tutorials.com/2008/05/13/openssh-openssh-vulnerabilities-confirm-fix-instructions/</link>
		<comments>http://ubuntu-tutorials.com/2008/05/13/openssh-openssh-vulnerabilities-confirm-fix-instructions/#comments</comments>
		<pubDate>Tue, 13 May 2008 19:49:34 +0000</pubDate>
		<dc:creator>Christer Edwards</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[openssh]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[patch]]></category>

		<guid isPermaLink="false">http://ubuntu-tutorials.com/?p=639</guid>
		<description><![CDATA[I&#8217;m sure many of you have heard by this point that there is a reported vulnerability in openSSL and openSSH.  The basis of this is that they keys that are generated when you use these tools (ie; installing openssh-server, etc) are generated in a weak manner and can be prone to simple brute force attacking.
If [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m sure many of you have heard by this point that there is a reported <a title="openssl key vulnerability" href="http://www.ubuntu.com/usn/usn-612-1">vulnerability in openSSL</a> and <a title="openssh key vulnerability" href="http://www.ubuntu.com/usn/usn-612-2">openSSH</a>.  The basis of this is that they keys that are generated when you use these tools (ie; installing openssh-server, etc) are generated in a weak manner and can be prone to simple brute force attacking.</p>
<p><strong>If you&#8217;ve never installed openssh-server, used openssh-clients or generated an X.509 certificate you should be safe.  If you <em>have</em> done any of the above keep reading for a validation and fix instructions.  It can&#8217;t hurt to run the validation script in either case, just to be safe.<br />
</strong></p>
<p>Security patches have been deployed to the Ubuntu archives so the first step is to, of course, apply any security patches available.</p>
<p><strong>Am I Affected?</strong></p>
<p>The first item at hand is verifying whether or not you have been affected by the vulnerability.  As mentioned above there are some common tasks that would qualify, but lets test your machine to make sure.</p>
<p>Download the script linked below and run it using the example syntax below:</p>
<p><a title="validate whether or not you are affected" href="http://security.debian.org/project/extra/dowkd/dowkd.pl.gz">dowkd.pl.gz</a> (Download this file and unzip)<a title="validate whether or not you are affected" href="http://security.debian.org/project/extra/dowkd/dowkd.pl.gz"><br />
</a></p>
<p><a title="validate the dowkd.pl script signature" href="http://security.debian.org/project/extra/dowkd/dowkd.pl.gz.asc">dowkd.pl PGP signature</a> (Optionally verify the signature of the script)</p>
<p>Cut-n-Paste command-line example of downloading and running the test:</p>
<blockquote><p><code>wget -c http://security.debian.org/project/extra/dowkd/dowkd.pl.gz<br />
gunzip dowkd.pl.gz<br />
chmod u+x dowkd.pl<br />
./dowkd.pl user<br />
./dowkd.pl host &lt;hostname&gt;</code></p></blockquote>
<p>If you see output similar to:</p>
<blockquote><p><code>/home/<em>username</em>/.ssh/id_dsa.pub:1: weak key</code></p></blockquote>
<p>&#8230;then you have been affected by the vulnerability.  If you do not see &#8220;weak key&#8221; reported then you are OK.</p>
<p><strong>How Do I Fix My Machine?</strong></p>
<p>To update your machine and patch the vulnerability the first thing you want to do is check for and apply any system updates available.  The main Ubuntu archives have been updated with the fixes.  If you are using an alternate mirror the fix may not have propagated yet, so you may not see it available for another few hours.</p>
<p>Apply any updates:</p>
<blockquote><p><code>sudo apt-get update<br />
sudo apt-get upgrade<br />
sudo apt-get dist-upgrade</code></p></blockquote>
<p>You should see an update for openssl and openssh packages (along with anything else available).</p>
<p>After these new packages have been applied you&#8217;ll want to regenerate any keys that you&#8217;ve generated (ie; openssh keys, CA cert, etc).</p>
<p><strong>UPDATE</strong>: The latest package release will automagically re-create any server-side ssh keys for you and notify you of the reason.  Also, there is a new utility built into the latest release that will check keys for you.  After your updates are applied try the tool:</p>
<blockquote><p><code>ssh-vulnkey</code></p></blockquote>
<p>To generate a new openssh key for your user: (This only required if &#8216;<code>./dowkd.pl user</code>&#8216; reports weak)</p>
<blockquote><p><code>ssh-keygen -t dsa -b 1024</code></p></blockquote>
<p>To generate a new openssh key for your server: (This only required if <code>./dowkd.pl host &lt;hostname</code>&gt; reports weak)</p>
<blockquote><p><code>sudo rm /etc/ssh/ssh_host_{dsa,rsa}_key*<br />
sudo dpkg-reconfigure -plow openssh-server</code></p></blockquote>
<p>You should now run the validation script again and make sure it does not report any errors.  If you still see reported warnings such as:</p>
<blockquote><p><code>/home/<em>username</em>/.ssh/authorized_hosts:1: weak key</code></p></blockquote>
<p>&#8230;this means that you have authorized_host keys saved that are still affected.  Open the .ssh/authorized_hosts file with a text editor and delete the affected line (:1: means line 1, etc).</p>
<p>Continue to run the ./dowkd.pl script until no weaknesses are reported.</p>
<p><strong>These steps should be run on any system that you manage to ensure they are sufficiently patched.</strong><br />
<h3>Other Points of Interest</h3>
<ul class="related_post">
<li>July 6, 2008 &#8212; <a href="http://ubuntu-tutorials.com/2008/07/06/install-the-1152-no-cd-patch-for-starcraft-on-ubuntu-804/" title="Install the 1.15.2 &#8220;no CD&#8221; Patch for StarCraft on Ubuntu 8.04">Install the 1.15.2 &#8220;no CD&#8221; Patch for StarCraft on Ubuntu 8.04 (6)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ubuntu-tutorials.com/2008/05/13/openssh-openssh-vulnerabilities-confirm-fix-instructions/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.659 seconds -->
