<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Best practices: iptables</title>
	<atom:link href="http://rackerhacker.com/2010/04/12/best-practices-iptables/feed/" rel="self" type="application/rss+xml" />
	<link>http://rackerhacker.com/2010/04/12/best-practices-iptables/</link>
	<description>Words of wisdom from a server administrator</description>
	<lastBuildDate>Mon, 21 May 2012 12:07:17 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Davetiye</title>
		<link>http://rackerhacker.com/2010/04/12/best-practices-iptables/#comment-22847</link>
		<dc:creator>Davetiye</dc:creator>
		<pubDate>Mon, 02 May 2011 23:12:59 +0000</pubDate>
		<guid isPermaLink="false">http://rackerhacker.com/?p=1377#comment-22847</guid>
		<description>I have had lots of problems on my server becouse of iptables. But informations that you give helped me a lot. Thanks for post.</description>
		<content:encoded><![CDATA[<p>I have had lots of problems on my server becouse of iptables. But informations that you give helped me a lot. Thanks for post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Edno360 - Best practices: iptables</title>
		<link>http://rackerhacker.com/2010/04/12/best-practices-iptables/#comment-20718</link>
		<dc:creator>Edno360 - Best practices: iptables</dc:creator>
		<pubDate>Mon, 14 Feb 2011 09:39:51 +0000</pubDate>
		<guid isPermaLink="false">http://rackerhacker.com/?p=1377#comment-20718</guid>
		<description>[...] in&#160;Edno, General, Recommended&#160;&#160;&#160;Tags: google, iptables, practices, website  Written by: Major Hayden [...]</description>
		<content:encoded><![CDATA[<p>[...] in&nbsp;Edno, General, Recommended&nbsp;&nbsp;&nbsp;Tags: google, iptables, practices, website  Written by: Major Hayden [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: iptables &#171; Eikonal Blog</title>
		<link>http://rackerhacker.com/2010/04/12/best-practices-iptables/#comment-20260</link>
		<dc:creator>iptables &#171; Eikonal Blog</dc:creator>
		<pubDate>Mon, 24 Jan 2011 20:46:39 +0000</pubDate>
		<guid isPermaLink="false">http://rackerhacker.com/?p=1377#comment-20260</guid>
		<description>[...] &#8220;Best practices: iptables&#8221; (Racker Hacker blog) &#8211; http://rackerhacker.com/2010/04/12/best-practices-iptables/ [...]</description>
		<content:encoded><![CDATA[<p>[...] &#8220;Best practices: iptables&#8221; (Racker Hacker blog) &#8211; <a href="http://rackerhacker.com/2010/04/12/best-practices-iptables/" rel="nofollow">http://rackerhacker.com/2010/04/12/best-practices-iptables/</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adding comments to iptables rules &#124; Racker Hacker</title>
		<link>http://rackerhacker.com/2010/04/12/best-practices-iptables/#comment-16435</link>
		<dc:creator>Adding comments to iptables rules &#124; Racker Hacker</dc:creator>
		<pubDate>Mon, 26 Jul 2010 15:01:10 +0000</pubDate>
		<guid isPermaLink="false">http://rackerhacker.com/?p=1377#comment-16435</guid>
		<description>[...] comments to iptables rules After I wrote a recent post on best practices for iptables, I noticed that I forgot to mention comments for iptables rules. They can be extremely handy if you [...]</description>
		<content:encoded><![CDATA[<p>[...] comments to iptables rules After I wrote a recent post on best practices for iptables, I noticed that I forgot to mention comments for iptables rules. They can be extremely handy if you [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: davetiye</title>
		<link>http://rackerhacker.com/2010/04/12/best-practices-iptables/#comment-16243</link>
		<dc:creator>davetiye</dc:creator>
		<pubDate>Thu, 13 May 2010 22:27:44 +0000</pubDate>
		<guid isPermaLink="false">http://rackerhacker.com/?p=1377#comment-16243</guid>
		<description>thank you very much</description>
		<content:encoded><![CDATA[<p>thank you very much</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sheldon Hearn</title>
		<link>http://rackerhacker.com/2010/04/12/best-practices-iptables/#comment-16152</link>
		<dc:creator>Sheldon Hearn</dc:creator>
		<pubDate>Thu, 15 Apr 2010 09:01:09 +0000</pubDate>
		<guid isPermaLink="false">http://rackerhacker.com/?p=1377#comment-16152</guid>
		<description>I&#039;d say that, if your staff need to be told these best practices, you should seriously consider introducing an iptables wrapper like firehol, ferm or shorewall. There are others, these are just the ones I&#039;ve used with success. These three are listed in order of their policy langauges&#039; readability.

Not only do wrappers offer highly readable policy languages (some more readable than others), they usually provide a toolchain that adds some protection against foot shooting. For example, &quot;firehol try&quot; will:

1) save your active ruleset
2) load the candidate ruleset
3) wait for 30 seconds for you to type &quot;commit&quot;
4) roll back to the saved ruleset if you don&#039;t.

I cut my teeth on raw iptables, and I enjoyed showing off my iptables fu in front of others. But the flush of pride isn&#039;t worth the headache of having less experienced staff trip up all over your ruleset and toolchain.

This makes it extremely easy to avoid locking yourself out of a box. And all three of the wrappers I listed above embody all of your best practices, except perhaps for &quot;Be stringent with your rules&quot;.

I appreciate that there are some arguments against wrappers. I used to spout all of these:

1) if you can&#039;t drive iptables, you shouldn&#039;t be operating a firewall
2) wrappers produce inefficient rulesets
3) you learn one wrapper, then find yourself lost when it comes to raw iptables.

In fact, I found none of this to matter when my business serviced numerous corporate firewall customers. What I found was:

1) wrappers made it possible for my staff to do -most- of the work
2) wrapper inefficiency only made a measurable difference for one, highly specialized firewall
3) staff took at interest in the generated raw iptables, using the wrapper as a learning aid.

Ciao,
Sheldon.</description>
		<content:encoded><![CDATA[<p>I'd say that, if your staff need to be told these best practices, you should seriously consider introducing an iptables wrapper like firehol, ferm or shorewall. There are others, these are just the ones I've used with success. These three are listed in order of their policy langauges' readability.</p>
<p>Not only do wrappers offer highly readable policy languages (some more readable than others), they usually provide a toolchain that adds some protection against foot shooting. For example, "firehol try" will:</p>
<p>1) save your active ruleset<br />
2) load the candidate ruleset<br />
3) wait for 30 seconds for you to type "commit"<br />
4) roll back to the saved ruleset if you don't.</p>
<p>I cut my teeth on raw iptables, and I enjoyed showing off my iptables fu in front of others. But the flush of pride isn't worth the headache of having less experienced staff trip up all over your ruleset and toolchain.</p>
<p>This makes it extremely easy to avoid locking yourself out of a box. And all three of the wrappers I listed above embody all of your best practices, except perhaps for "Be stringent with your rules".</p>
<p>I appreciate that there are some arguments against wrappers. I used to spout all of these:</p>
<p>1) if you can't drive iptables, you shouldn't be operating a firewall<br />
2) wrappers produce inefficient rulesets<br />
3) you learn one wrapper, then find yourself lost when it comes to raw iptables.</p>
<p>In fact, I found none of this to matter when my business serviced numerous corporate firewall customers. What I found was:</p>
<p>1) wrappers made it possible for my staff to do -most- of the work<br />
2) wrapper inefficiency only made a measurable difference for one, highly specialized firewall<br />
3) staff took at interest in the generated raw iptables, using the wrapper as a learning aid.</p>
<p>Ciao,<br />
Sheldon.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous Coward</title>
		<link>http://rackerhacker.com/2010/04/12/best-practices-iptables/#comment-16145</link>
		<dc:creator>Anonymous Coward</dc:creator>
		<pubDate>Wed, 14 Apr 2010 13:39:09 +0000</pubDate>
		<guid isPermaLink="false">http://rackerhacker.com/?p=1377#comment-16145</guid>
		<description>&quot;good systems administrators who are unaware of the default policy&quot; in an oxymoron.</description>
		<content:encoded><![CDATA[<p>"good systems administrators who are unaware of the default policy" in an oxymoron.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Twirrim</title>
		<link>http://rackerhacker.com/2010/04/12/best-practices-iptables/#comment-16132</link>
		<dc:creator>Twirrim</dc:creator>
		<pubDate>Mon, 12 Apr 2010 16:55:31 +0000</pubDate>
		<guid isPermaLink="false">http://rackerhacker.com/?p=1377#comment-16132</guid>
		<description>I&#039;ve been burned by &quot;iptables -F&quot; on a system using default DROP a stupid number of times.  I very rarely take drastic steps like flushing, so I&#039;d have hoped it would sink in, but usually it doesn&#039;t until I twig I&#039;ve locked myself out of a server again.

A couple of suggestions:
1) Carry out iptables actions from inside a &quot;screen&quot; session, particularly with chains of commands (as my understanding goes).  This for one makes sure all the actions will be carried out, but also means that if you have accidentally screwed up you can re-attach and pick up where you left off from whatever other method you can use to get onto the server (different IP address, remote hands service(?)).

2) Have a &quot;get out of jail free&quot; card ready to hand.  Either within the context of a screen session, or through the &#039;at&#039; scheduler, have something in place to restore a working iptables configuration set for xx seconds / minutes in the future.  Do your potentially disruptive thing, see if you&#039;ve still got connectivity and if you have, stop that scheduled restore.

iptables aren&#039;t as complicated as some people would have you believe (whilst being incredibly powerful), but it is easy to make mistakes that you&#039;re often better approaching it from the perspective &quot;I&#039;m going to screw up&quot; and ensure you&#039;ve covered your arse appropriately :D</description>
		<content:encoded><![CDATA[<p>I've been burned by "iptables -F" on a system using default DROP a stupid number of times.  I very rarely take drastic steps like flushing, so I'd have hoped it would sink in, but usually it doesn't until I twig I've locked myself out of a server again.</p>
<p>A couple of suggestions:<br />
1) Carry out iptables actions from inside a "screen" session, particularly with chains of commands (as my understanding goes).  This for one makes sure all the actions will be carried out, but also means that if you have accidentally screwed up you can re-attach and pick up where you left off from whatever other method you can use to get onto the server (different IP address, remote hands service(?)).</p>
<p>2) Have a "get out of jail free" card ready to hand.  Either within the context of a screen session, or through the 'at' scheduler, have something in place to restore a working iptables configuration set for xx seconds / minutes in the future.  Do your potentially disruptive thing, see if you've still got connectivity and if you have, stop that scheduled restore.</p>
<p>iptables aren't as complicated as some people would have you believe (whilst being incredibly powerful), but it is easy to make mistakes that you're often better approaching it from the perspective "I'm going to screw up" and ensure you've covered your arse appropriately <img src='http://rackerhacker.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Major Hayden</title>
		<link>http://rackerhacker.com/2010/04/12/best-practices-iptables/#comment-16130</link>
		<dc:creator>Major Hayden</dc:creator>
		<pubDate>Mon, 12 Apr 2010 15:42:50 +0000</pubDate>
		<guid isPermaLink="false">http://rackerhacker.com/?p=1377#comment-16130</guid>
		<description>errr - 

Not really.  I&#039;ve just found that even the most seasoned systems administrators will overlook the policy line on a chain if they&#039;re not used to looking for it.  I normally check it when I log into a server that I don&#039;t normally administer, but that&#039;s only because I&#039;ve been burned many times by it. :-)</description>
		<content:encoded><![CDATA[<p>errr - </p>
<p>Not really.  I've just found that even the most seasoned systems administrators will overlook the policy line on a chain if they're not used to looking for it.  I normally check it when I log into a server that I don't normally administer, but that's only because I've been burned many times by it. <img src='http://rackerhacker.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: errr</title>
		<link>http://rackerhacker.com/2010/04/12/best-practices-iptables/#comment-16129</link>
		<dc:creator>errr</dc:creator>
		<pubDate>Mon, 12 Apr 2010 15:34:43 +0000</pubDate>
		<guid isPermaLink="false">http://rackerhacker.com/?p=1377#comment-16129</guid>
		<description>Vid -

I like to make bash scripts to make my firewall.. You could use something similar.. Just create an array with your allowed ports and one with your allowed hosts. Then loop though the arrays accepting traffic from those hosts on the allowed ports. Here is an example if what I use. http://systemsninja.com/firewall.txt It does use a default drop policy which goes against this blog, but that can be changed with ease :-)

Rackerhacker - 
Is there any benefit other than what you named to not using a default DROP policy? I ask because a book I just finished reading: Linux Firewalls: Attack Detection and Response with iptables, psad, and fwsnort suggested using a default drop policy. I did find moving to the default DROP made it very annoying for the first few hours while debugging trying to get my backups and system updates working (had to allow the outbound ftp AND http traffic).</description>
		<content:encoded><![CDATA[<p>Vid -</p>
<p>I like to make bash scripts to make my firewall.. You could use something similar.. Just create an array with your allowed ports and one with your allowed hosts. Then loop though the arrays accepting traffic from those hosts on the allowed ports. Here is an example if what I use. <a href="http://systemsninja.com/firewall.txt" rel="nofollow">http://systemsninja.com/firewall.txt</a> It does use a default drop policy which goes against this blog, but that can be changed with ease <img src='http://rackerhacker.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Rackerhacker -<br />
Is there any benefit other than what you named to not using a default DROP policy? I ask because a book I just finished reading: Linux Firewalls: Attack Detection and Response with iptables, psad, and fwsnort suggested using a default drop policy. I did find moving to the default DROP made it very annoying for the first few hours while debugging trying to get my backups and system updates working (had to allow the outbound ftp AND http traffic).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Major Hayden</title>
		<link>http://rackerhacker.com/2010/04/12/best-practices-iptables/#comment-16128</link>
		<dc:creator>Major Hayden</dc:creator>
		<pubDate>Mon, 12 Apr 2010 14:01:31 +0000</pubDate>
		<guid isPermaLink="false">http://rackerhacker.com/?p=1377#comment-16128</guid>
		<description>Vid - 

I don&#039;t really have a specific ruleset to be honest.  I normally just toss together some relevant rules for the particular instance I&#039;m running.  If you want to allow access on port 3306 for three IP addresses that aren&#039;t in continuous IP space, you&#039;d have to write three separate rules for it.</description>
		<content:encoded><![CDATA[<p>Vid - </p>
<p>I don't really have a specific ruleset to be honest.  I normally just toss together some relevant rules for the particular instance I'm running.  If you want to allow access on port 3306 for three IP addresses that aren't in continuous IP space, you'd have to write three separate rules for it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vid Luther</title>
		<link>http://rackerhacker.com/2010/04/12/best-practices-iptables/#comment-16127</link>
		<dc:creator>Vid Luther</dc:creator>
		<pubDate>Mon, 12 Apr 2010 13:54:06 +0000</pubDate>
		<guid isPermaLink="false">http://rackerhacker.com/?p=1377#comment-16127</guid>
		<description>Major, 
 I was wondering if you had a set of rules you like to use on new slices at slicehost? One thing I&#039;ve been struggling to find is a simple/easy way to protect eth1 on the slices, the general rules allowing 80/443 inbound are fine, but I only want to allow inbound 3306 from specific ips, or some other ports (munin nodes).. luckily munin and mysql have their own ACL&#039;s, but i&#039;d really like a simple way of saying allow inbound access on port 3306 from these 3 ips only.</description>
		<content:encoded><![CDATA[<p>Major,<br />
 I was wondering if you had a set of rules you like to use on new slices at slicehost? One thing I've been struggling to find is a simple/easy way to protect eth1 on the slices, the general rules allowing 80/443 inbound are fine, but I only want to allow inbound 3306 from specific ips, or some other ports (munin nodes).. luckily munin and mysql have their own ACL's, but i'd really like a simple way of saying allow inbound access on port 3306 from these 3 ips only.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

