<?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>Tim's Weblog &#187; firewall</title>
	<atom:link href="http://blog.hokkertjes.nl/tag/firewall/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.hokkertjes.nl</link>
	<description>Random Thoughts and Rants</description>
	<lastBuildDate>Fri, 23 Jul 2010 11:41:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>ip6tables: ACCEPT icmpv6 before dropping state INVALID</title>
		<link>http://blog.hokkertjes.nl/2009/04/16/ip6tables-accept-icmpv6-before-dropping-state-invalid/</link>
		<comments>http://blog.hokkertjes.nl/2009/04/16/ip6tables-accept-icmpv6-before-dropping-state-invalid/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 15:30:16 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[arp]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[icmp]]></category>
		<category><![CDATA[invalid]]></category>
		<category><![CDATA[ip6tables]]></category>
		<category><![CDATA[ipv6]]></category>
		<category><![CDATA[nd]]></category>
		<category><![CDATA[neighbour detection]]></category>
		<category><![CDATA[state]]></category>

		<guid isPermaLink="false">http://blog.hokkertjes.nl/?p=832</guid>
		<description><![CDATA[Spend some hours trying to figure out why our firewall was blocking ipv6 icmp traffic. Apparantly, ipv6 packets start out in state invalid and get valid after some sort of icmp traffic. If anyone can explain it to me, I&#8217;d love to hear the details. My guess is that in ipv4, state is somehow set [...]]]></description>
			<content:encoded><![CDATA[<p>Spend some hours trying to figure out why our firewall was blocking ipv6 icmp traffic. Apparantly, ipv6 packets start out in state invalid and get valid after some sort of icmp traffic. If anyone can explain it to me, I&#8217;d love to hear the details. My guess is that in ipv4, state is somehow set to valid via ARP. Since ipv6 doesn&#8217;t use ARP but icmp for neighbour detection, my guess is that you need to accept this before doing any state checking.</p>

<!-- start wp-tags-to-technorati 1.02 -->

<p class='technorati-tags'>Tags: <a class='technorati-link' href='http://technorati.com/tag/arp' rel='tag' target='_self'>arp</a>, <a class='technorati-link' href='http://technorati.com/tag/firewall' rel='tag' target='_self'>firewall</a>, <a class='technorati-link' href='http://technorati.com/tag/icmp' rel='tag' target='_self'>icmp</a>, <a class='technorati-link' href='http://technorati.com/tag/invalid' rel='tag' target='_self'>invalid</a>, <a class='technorati-link' href='http://technorati.com/tag/ip6tables' rel='tag' target='_self'>ip6tables</a>, <a class='technorati-link' href='http://technorati.com/tag/ipv6' rel='tag' target='_self'>ipv6</a>, <a class='technorati-link' href='http://technorati.com/tag/nd' rel='tag' target='_self'>nd</a>, <a class='technorati-link' href='http://technorati.com/tag/neighbour+detection' rel='tag' target='_self'>neighbour detection</a>, <a class='technorati-link' href='http://technorati.com/tag/state' rel='tag' target='_self'>state</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://blog.hokkertjes.nl/2009/04/16/ip6tables-accept-icmpv6-before-dropping-state-invalid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IPv6 Tunnel behind Thomson modem, continued</title>
		<link>http://blog.hokkertjes.nl/2009/04/15/ipv6-tunnel-behind-thomson-modem-2/</link>
		<comments>http://blog.hokkertjes.nl/2009/04/15/ipv6-tunnel-behind-thomson-modem-2/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 20:34:37 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[6to4]]></category>
		<category><![CDATA[DMZ]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[ipv6]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[modem]]></category>
		<category><![CDATA[nat]]></category>
		<category><![CDATA[pointopoint]]></category>
		<category><![CDATA[proto41]]></category>
		<category><![CDATA[sixxs]]></category>
		<category><![CDATA[telnet]]></category>
		<category><![CDATA[thomson]]></category>

		<guid isPermaLink="false">http://blog.hokkertjes.nl/?p=826</guid>
		<description><![CDATA[My coworker is even better than me. After I thought I fixed it, I noticed that the incoming connection is denied if the machine hasn&#8217;t had any outgoing ipv6 over the tunnel for a little while. My coworker, Kees, found the solution and implemented it and now it works! Yay! This is what you need [...]]]></description>
			<content:encoded><![CDATA[<p>My coworker is even better than me. After I thought I fixed it, I noticed that the incoming connection is denied if the machine hasn&#8217;t had any outgoing ipv6 over the tunnel for a little while. My coworker, Kees, <a href="http://blog.keesmeijs.nl/?p=86">found the solution and implemented it</a> and now it works! Yay!</p>
<p>This is what you need to do (blatantly copied from Kees&#8217; blog):<br />
<code>:expr add name=ipv6 type=serv proto=41<br />
:firewall rule add chain=forward_host_service name=SixXS serv=ipv6 state=enabled action=accept<br />
:nat tmpladd intf=Internet type=nat outside_addr=0.0.0.1 inside_addr=192.168.4.4 protocol=6to4<br />
:saveall</code></p>
<p>Let me know if this helped you too!</p>

<!-- start wp-tags-to-technorati 1.02 -->

<p class='technorati-tags'>Tags: <a class='technorati-link' href='http://technorati.com/tag/6to4' rel='tag' target='_self'>6to4</a>, <a class='technorati-link' href='http://technorati.com/tag/DMZ' rel='tag' target='_self'>DMZ</a>, <a class='technorati-link' href='http://technorati.com/tag/firewall' rel='tag' target='_self'>firewall</a>, <a class='technorati-link' href='http://technorati.com/tag/ipv6' rel='tag' target='_self'>ipv6</a>, <a class='technorati-link' href='http://technorati.com/tag/linux' rel='tag' target='_self'>linux</a>, <a class='technorati-link' href='http://technorati.com/tag/modem' rel='tag' target='_self'>modem</a>, <a class='technorati-link' href='http://technorati.com/tag/nat' rel='tag' target='_self'>nat</a>, <a class='technorati-link' href='http://technorati.com/tag/pointopoint' rel='tag' target='_self'>pointopoint</a>, <a class='technorati-link' href='http://technorati.com/tag/proto41' rel='tag' target='_self'>proto41</a>, <a class='technorati-link' href='http://technorati.com/tag/sixxs' rel='tag' target='_self'>sixxs</a>, <a class='technorati-link' href='http://technorati.com/tag/telnet' rel='tag' target='_self'>telnet</a>, <a class='technorati-link' href='http://technorati.com/tag/thomson' rel='tag' target='_self'>thomson</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://blog.hokkertjes.nl/2009/04/15/ipv6-tunnel-behind-thomson-modem-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rate limit incoming ssh connections</title>
		<link>http://blog.hokkertjes.nl/2008/07/06/rate-limit-incoming-ssh-connections/</link>
		<comments>http://blog.hokkertjes.nl/2008/07/06/rate-limit-incoming-ssh-connections/#comments</comments>
		<pubDate>Sun, 06 Jul 2008 14:13:42 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[connection]]></category>
		<category><![CDATA[ferm]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[ipt_recent]]></category>
		<category><![CDATA[limit]]></category>
		<category><![CDATA[rate limit]]></category>
		<category><![CDATA[recent]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[worm]]></category>

		<guid isPermaLink="false">http://blog.hokkertjes.nl/?p=492</guid>
		<description><![CDATA[So apparently, there&#8217;s a ssh worm in the wild that tries to break into servers by bombarding the ssh daemon with logins. No idea what they think they can achieve with this, since it mostly just takes down the ssh service (for everyone, including themselves). So it&#8217;s more annoying and inconvenient (you can&#8217;t login) than [...]]]></description>
			<content:encoded><![CDATA[<p>So apparently, there&#8217;s a ssh worm in the wild that tries to break into servers by bombarding the ssh daemon with logins. No idea what they think they can achieve with this, since it mostly just takes down the ssh service (for everyone, including themselves). So it&#8217;s more annoying and inconvenient (you can&#8217;t login) than threatening, in my opinion.</p>
<p>Luckily, there are easy ways to deal with this. We use the following <a href="http://ferm.foo-projects.org/">ferm</a> recipe to limit the incoming new ssh connections on source ip basis. Hope this helps someone. </p>
<p>You do the following in the filter table from the input chain. We assume you already allow established connections to pass.</p>
<pre>proto tcp dport ssh {
  # Rate-limit incoming SSH connections
  mod state state NEW mod recent name "ssh" {
    set NOP;
    update seconds 300 hitcount 31 REJECT reject-with tcp-reset;
  }

  # allow SSH clients which play nice
  ACCEPT;
}</pre>
<p>This will keep track of the number of connections made on the ssh port in the last 300 seconds, per source ip address. If more than 30 connections are made within 300 seconds, they will be rejected. Otherwise, they&#8217;re allowed.</p>
<p>This works great for us, but you want to test it before using it in a production environment, of course!</p>
<p><b>Update:</b> So ipt_recent only allows up to 20 counts. You might want to change the numbers in this recipe a bit to make it work correctly <img src='http://blog.hokkertjes.nl/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p><b>Update 2:</b> Or even better:</p>
<pre>$ cat /etc/modprobe.d/ipt_recent
options ipt_recent ip_pkt_list_tot=31
$ sudo /etc/init.d/ferm stop
$ sudo rmmod ipt_recent
$ sudo /etc/init.d/ferm start</pre>
<p>You can check /sys/module/ipt_recent/parameters/ip_pkt_list_tot to see if it changed.</p>
<p>Btw, this all is not my own research, merely transcribing what Bart and Kees researched.</p>

<!-- start wp-tags-to-technorati 1.02 -->

<p class='technorati-tags'>Tags: <a class='technorati-link' href='http://technorati.com/tag/connection' rel='tag' target='_self'>connection</a>, <a class='technorati-link' href='http://technorati.com/tag/ferm' rel='tag' target='_self'>ferm</a>, <a class='technorati-link' href='http://technorati.com/tag/firewall' rel='tag' target='_self'>firewall</a>, <a class='technorati-link' href='http://technorati.com/tag/ipt_recent' rel='tag' target='_self'>ipt_recent</a>, <a class='technorati-link' href='http://technorati.com/tag/limit' rel='tag' target='_self'>limit</a>, <a class='technorati-link' href='http://technorati.com/tag/rate+limit' rel='tag' target='_self'>rate limit</a>, <a class='technorati-link' href='http://technorati.com/tag/recent' rel='tag' target='_self'>recent</a>, <a class='technorati-link' href='http://technorati.com/tag/ssh' rel='tag' target='_self'>ssh</a>, <a class='technorati-link' href='http://technorati.com/tag/worm' rel='tag' target='_self'>worm</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://blog.hokkertjes.nl/2008/07/06/rate-limit-incoming-ssh-connections/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
