<?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>blog.poucet.org</title>
	<atom:link href="http://blog.poucet.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.poucet.org</link>
	<description>Blogging about technology, functional programming, linux and life in general.</description>
	<lastBuildDate>Tue, 17 Nov 2009 23:01:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Setting up iptables to throttle incoming ssh</title>
		<link>http://blog.poucet.org/2009/11/setting-up-iptables-to-throttle-incoming-ssh/</link>
		<comments>http://blog.poucet.org/2009/11/setting-up-iptables-to-throttle-incoming-ssh/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 22:56:13 +0000</pubDate>
		<dc:creator>poucet</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.poucet.org/?p=132</guid>
		<description><![CDATA[So I decided today, since I seem to be getting a lot of ssh attempts to my firewall at home to set up some iptable rules.
It took me quite a while to figure it out, since I needed to set up some modprobe options.
First, I set that I can count up to 250 (I think [...]]]></description>
			<content:encoded><![CDATA[<p>So I decided today, since I seem to be getting a lot of ssh attempts to my firewall at home to set up some iptable rules.</p>
<p>It took me quite a while to figure it out, since I needed to set up some modprobe options.</p>
<p>First, I set that I can count up to 250 (I think the maximum is 256) recent ip hits.</p>
<p><code>cat /etc/modprobe.d/options<br />
options ipt_recent ip_pkt_list_tot=250</code></p>
<p>Then I created a firewall script:</p>
<p><code>cat firewall.sh</code></p>
<pre><code>#!/bin/sh
ipt=/sbin/iptables

set -x

if [ -z $1 ] ; then
echo "$0 &lt;public device&gt;"
exit
fi

# Clear rules
$ipt -D INPUT -i $1 -p TCP --dport ssh -m state --state NEW -j "$1"-SSH 2&gt;/dev/null

# Set up an ssh and blacklist chain.
$ipt -F "$1"-SSH 2&gt;/dev/null
$ipt -F "$1"-BLACKLIST 2&gt;/dev/null
$ipt -X "$1"-SSH 2&gt;/dev/null
$ipt -X "$1"-BLACKLIST 2&gt;/dev/null

$ipt -N "$1"-SSH
$ipt -N "$1"-BLACKLIST

# Make sure that we update the recency of the packet, and then drop them.  The timing is controlled by the ssh chain.
$ipt -A "$1"-BLACKLIST -m recent --name BLACKLIST --set
$ipt -A "$1"-BLACKLIST -j DROP

# In the ssh chain, incoming connections from BLACKLIST hosts are dropped.  The timer is restarted everytime we get a packet within 600 s.
$ipt -A "$1"-SSH -m recent --update --name BLACKLIST --seconds 600 --hitcount 1 -j DROP

# Create several counting buckets.
$ipt -A "$1"-SSH -m recent --set --name "$1"-BUCKET1
$ipt -A "$1"-SSH -m recent --set --name "$1"-BUCKET2
$ipt -A "$1"-SSH -m recent --set --name "$1"-BUCKET3
$ipt -A "$1"-SSH -m recent --set --name "$1"-BUCKET4

# Blacklist if:
#   More than 2 connections in 10 seconds
#   More than 14 connections in 120 seconds
#   More than 79 connections in 600 seconds
#   More than 250 connections in 1800 seconds
$ipt -A "$1"-SSH -m recent --update --name "$1"-BUCKET1 --seconds   10 --hitcount   3 -j "$1"-BLACKLIST
$ipt -A "$1"-SSH -m recent --update --name "$1"-BUCKET2 --seconds  120 --hitcount  15 -j "$1"-BLACKLIST
$ipt -A "$1"-SSH -m recent --update --name "$1"-BUCKET3 --seconds  600 --hitcount  80 -j "$1"-BLACKLIST
$ipt -A "$1"-SSH -m recent --update --name "$1"-BUCKET4 --seconds 1800 --hitcount 250 -j "$1"-BLACKLIST

# All other ssh access is allowed.
$ipt -A "$1"-SSH -j ACCEPT

# Allow packets that belong to existing connections.
$ipt -D INPUT -i $1 -m state --state RELATED,ESTABLISHED -j ACCEPT 2&gt;/dev/null
$ipt -A INPUT -i $1 -m state --state RELATED,ESTABLISHED -j ACCEPT

# Allow all packets from loopback device.
$ipt -D INPUT -i lo -j ACCEPT 2&gt;/dev/null
$ipt -A INPUT -i lo -j ACCEPT

# Redirect all incoming ssh connections to the chain of the same name.
$ipt -A INPUT -i $1 -p TCP --dport ssh -m state --state NEW -j "$1"-SSH

# What remains has no right to continue.
$ipt -D INPUT -i $1 -j DROP 2&gt;/dev/null
$ipt -A INPUT -i $1 -j DROP</code></pre>
<p>Finally, I set it up in my /etc/network/interfaces, that this should be called for my main interface (my public one):<br />
<code>auto eth0<br />
iface eth0 inet dhcp<br />
up firewall.sh eth0</code><br />
I hope this helps anyone.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.poucet.org/2009/11/setting-up-iptables-to-throttle-incoming-ssh/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>To my family and friends</title>
		<link>http://blog.poucet.org/2009/08/to-my-family-and-friends/</link>
		<comments>http://blog.poucet.org/2009/08/to-my-family-and-friends/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 15:39:49 +0000</pubDate>
		<dc:creator>poucet</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.poucet.org/?p=127</guid>
		<description><![CDATA[I think this is probably one of the best XKCD comics.  I wish I had had this in the past when people or family would ask me questions about computers (usually windows, being an avid Linux user).

]]></description>
			<content:encoded><![CDATA[<p>I think this is probably one of the best <a href="http://www.xkcd.com">XKCD</a> comics.  I wish I had had this in the past when people or family would ask me questions about computers (usually windows, being an avid Linux user).</p>
<p><a href="http://xkcd.com/627/"><img class="alignnone" title="How geeks perform tech support." src="http://imgs.xkcd.com/comics/tech_support_cheat_sheet.png" alt="" width="732" height="823" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.poucet.org/2009/08/to-my-family-and-friends/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A fresh start</title>
		<link>http://blog.poucet.org/2009/08/a-fresh-start/</link>
		<comments>http://blog.poucet.org/2009/08/a-fresh-start/#comments</comments>
		<pubDate>Sun, 16 Aug 2009 19:42:28 +0000</pubDate>
		<dc:creator>poucet</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://blog.poucet.org/?p=1</guid>
		<description><![CDATA[For those that know my prior two blogs, they will know this is not the first time that I moved blog. While the move from the first blog to the second (blogger to wordpress) was due to technical reasons, this time I am moving because I want to finally consolidate all my content in one [...]]]></description>
			<content:encoded><![CDATA[<p>For those that know my <a href="http://notvincenz.blogspot.com">prior</a> <a href="http://cpoucet.wordpress.com">two</a> blogs, they will know this is not the first time that I moved blog. While the move from the first blog to the second (blogger to wordpress) was due to technical reasons, this time I am moving because I want to finally consolidate all my content in one place.</p>
<p>I have had a virtual host for a while now, and never truly utilized it.  I&#8217;ve been using <a href="http://www.linode.com">linode</a> and I have to say that I am very happy with the service and quality of the user-interface.  Having recently bought my own domain (yes, the one at the top in your address bar), I decided to finally run my setup completely myself.</p>
<p>So what am I running, and what do I want to write about?  Well for that I have to take a step back.</p>
<p>My last blog focused a lot on Haskell, for that is a language I am very passionate about.  Unfortunately, I have had less and less time to actually devote to it.  In the meantime, my eyes have opened to whole new worlds.</p>
<p>While I have used linux for about 10 years now, it was always a means to an end.  Finally stripped of my academic bubble I have come to appreciate the more technical aspects of it.  It is therefore that I have started devouring a variety books on the topic.</p>
<p>Additionally, since I was never formally a software engineer, having a background in electrical engineering, I decided to purchase a few books in the direction of being a better programmer.  It is one thing to be confident of the fact that you can implement an efficient kernel algorithm in your language of choice.  It is another entirely, to be able to tackle big projects and properly design software in layer.  I am starting to realize that slowly.</p>
<p>While reading the <a href="http://www.pragprog.com/titles/cfcar2/the-passionate-programmer">Passionate Programmer</a> by <a href="http://chadfowler.com/">Chad Fowler</a>, I decided that I wanted to blog more on these types of topics.  The combination of technical and psychological/sociological elements is always one that has fascinated me.</p>
<p>So that is what I hope to achieve on this blog, a place to reflect on books such as the one above, a combination of software development and career development, speckled with little technical tidbits I learn along the way or that interest me.</p>
<p>It is somewhat ironic that I am writing this now, when I am back in the city I used to study at, Leuven, to put the last dots on the &#8216;i&#8217; of my Ph.D. thesis. Writing is not something that is my forte, though I admit it is mostly laziness.  And as with everything, I hope to improve upon it.   Perhaps it is that drive for constantly improving myself that makes me enjoy reading books like Chad Fowler&#8217;s.</p>
<p>I have to say that starting this blog has definitely been rife of the <a href="http://en.wikipedia.org/wiki/index.html?curid=14872453">Paradox of Choice</a>. Questions such as what theme to use, whether to import the content of my old blog here.</p>
<p>Simple questions are often the ones that take one the longest to answer, down to what name to give to a variable.</p>
<p>Perhaps, I should open this up for discussion instead, for you, inexistent reader of this new blog, feel free to reply in the comments:</p>
<blockquote><p>Should I import my <a href="http://cpoucet.wordpress.com">old content</a> even though the topic was mostly directed towards one very specifical technical niche, namely Haskell.</p></blockquote>
<p>And for those wondering the original question, the answer is wordpress on lighttpd.  I am already created a DNS entry for a wiki extension as well, where I can jot down interesting links I might want to discuss or unfinished content, however I am still deciding on what wiki software to use (Again, choices&#8230; <img src='http://blog.poucet.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Though I am heavily leaning towards MoinMoin).</p>
<p>Finally, if anyone has an interesting suggestion for what to put on the main webpage (<a href="http://www.poucet.org">http://www.poucet.org</a>), comments are always welcome.  Discussion is the only way to learn new things, for otherwise we grow stale.</p>
<p>Note to self: Don&#8217;t be afraid of writing your own opinions, instead of sticking to purely technical things.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.poucet.org/2009/08/a-fresh-start/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.177 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2010-09-03 18:11:01 -->
