<?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>BigSmoke &#187; firewall</title>
	<atom:link href="http://blog.bigsmoke.us/tag/firewall/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.bigsmoke.us</link>
	<description>Smokes your problems, coughs fresh air.</description>
	<lastBuildDate>Sat, 04 Feb 2012 18:03:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Saving and loading iptables rules on Debian</title>
		<link>http://blog.bigsmoke.us/2010/02/03/saving-and-loading-iptables-rules-on-debian</link>
		<comments>http://blog.bigsmoke.us/2010/02/03/saving-and-loading-iptables-rules-on-debian#comments</comments>
		<pubDate>Wed, 03 Feb 2010 12:36:53 +0000</pubDate>
		<dc:creator>halfgaar</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[iptables]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=1188</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>
For some reason, Debian can&#8217;t do &#8220;/etc/init.d/iptables save&#8221;. So, we have to fix something ourselves. I used <a href="http://www.debian-administration.org/articles/445">this article</a> as source, which also has some useful comments. Apparently, the iptables initscript used to exist&#8230;
</p>

<p>
To save, type:
</p>

<pre class="php">iptables-save &gt; /etc/iptables.rules</pre>

<p>
Make /etc/network/if-pre-up.d/iptables:
</p>

<pre class="php"><span style="color: #808080; font-style: italic;">#!/bin/sh</span>
iptables-restore &lt; /etc/iptables.rules</pre>

<p>
Don&#8217;t forget to make it executable:
</p>

<pre class="bash">chmod +x /etc/network/if-pre-up.d/iptables</pre>]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2010/02/03/saving-and-loading-iptables-rules-on-debian/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convenient iptables rules</title>
		<link>http://blog.bigsmoke.us/2010/01/04/convenient-iptables-rules</link>
		<comments>http://blog.bigsmoke.us/2010/01/04/convenient-iptables-rules#comments</comments>
		<pubDate>Mon, 04 Jan 2010 10:16:56 +0000</pubDate>
		<dc:creator>halfgaar</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[iptables]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=980</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>
Here are some convenient iptables rules.
</p>

<p>
This first list is for not allowing anything in, accept packets that come back from outgoing connections, complicated related traffic like FTP, everything from the localhost, ICMP (ping and stuff) and SSH. It also sets the default policy to DROP. This you would use on a machine connected directly to the internet.
</p>

<pre class="php">iptables -A INPUT --match state --state RELATED,ESTABLISHED -j ACCEPT --match comment --comment <span style="color: #ff0000;">&quot;Accept traffic from outgoing connections and stuff like FTP.&quot;</span>
iptables -A INPUT -p icmp -j ACCEPT --match comment --comment <span style="color: #ff0000;">&quot;Allow ICMP&quot;</span>
iptables -A INPUT -p tcp --dport <span style="color: #cc66cc;">22</span> -j ACCEPT --match comment --comment <span style="color: #ff0000;">&quot;Allow SSH&quot;</span>
iptables -A INPUT --in-interface lo -j ACCEPT --match comment --comment <span style="color: #ff0000;">&quot;Allow everything on the localhost&quot;</span>
iptables -P INPUT DROP</pre>

Here are some rules to allow certain MAC addresses to access everything. Simplifies things on a LAN (even though it&#8217;s not attacker-proof, it keeps unwanted people out of my SMB and stuff):

<pre class="php">iptables -A INPUT --match mac --mac-source xx:xx:xx:xx:xx:xx --match comment --comment <span style="color: #ff0000;">&quot;Allow everything from [computer]&quot;</span> -j ACCEPT</pre>

<p>
Besides computers you want to grant full access to a machine, don&#8217;t forget to include the MACs  of the router and the machine&#8217;s own ethernet interface.
</p>

<p>
When the machine acts as a masquerading SNAT server, use this to forward ports to LAN hosts (be sure to have the &#8211;to after the -j):
</p>

<pre class="php">iptables -t nat -A PREROUTING --in-interface eth0 -p tcp --dport <span style="color: #cc66cc;">80</span> -j DNAT --to <span style="color: #cc66cc;">10.0</span><span style="color: #cc66cc;">.0</span><span style="color: #cc66cc;">.1</span>:<span style="color: #cc66cc;">22</span> --match comment --comment <span style="color: #ff0000;">&quot;forwards incoming port 80 to port 22 on 10.0.0.1&quot;</span></pre>

<p>
To allow everything for a samba server:
</p>

<pre class="php">iptables -A INPUT -p tcp --dport <span style="color: #cc66cc;">139</span> -m comment --comment <span style="color: #ff0000;">&quot;Allow Netbios-ssn&quot;</span> -j ACCEPT 
iptables -A INPUT -p tcp --dport <span style="color: #cc66cc;">445</span> -m comment --comment <span style="color: #ff0000;">&quot;Allow microsoft-ds&quot;</span> -j ACCEPT 
iptables -A INPUT -p udp --dport <span style="color: #cc66cc;">137</span> -m comment --comment <span style="color: #ff0000;">&quot;Allow netbios-ns&quot;</span> -j ACCEPT 
iptables -A INPUT -p udp --dport <span style="color: #cc66cc;">138</span> -m comment --comment <span style="color: #ff0000;">&quot;Allow netbios-dgm&quot;</span> -j ACCEPT</pre>]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2010/01/04/convenient-iptables-rules/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

