<?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>Random and Irrelevant &#187; iptables</title>
	<atom:link href="http://sgp.me.uk/tag/iptables/feed/" rel="self" type="application/rss+xml" />
	<link>http://sgp.me.uk</link>
	<description>Sam Pearson&#039;s weblog - irrelevant content randomly updated</description>
	<lastBuildDate>Fri, 18 Nov 2011 18:06:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Brute force ssh password attacks</title>
		<link>http://sgp.me.uk/2005/08/25/ssh-attacks/</link>
		<comments>http://sgp.me.uk/2005/08/25/ssh-attacks/#comments</comments>
		<pubDate>Thu, 25 Aug 2005 10:48:56 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://sgp.me.uk/2005/08/25/ssh-attacks</guid>
		<description><![CDATA[Since opening my <a href="http://www.openssh.com/">SSH</a> server at home to the internet yesterday - less than 24 hours ago - there have been 2883 failed attempts to log in from two ip addresses... <a href="http://sgp.me.uk/2005/08/25/ssh-attacks/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Since opening my <a href="http://www.openssh.com/">SSH</a> server at home to the internet yesterday &#8211; less than 24 hours ago &#8211; there have been 2883 failed attempts to log in from two ip addresses: <code>209.183.190.11</code> and <code>59.120.13.130</code>.  That makes me nervous, even though I&#8217;m reasonably confident that it&#8217;s secure due to password authentication being turned off and the following two handy <code>iptables</code> rules in force:</p>
<pre><code>iptables -A INPUT -p tcp -m state --state NEW --dport 22 \
 -m recent --update --seconds 15 -j DROP 

iptables -A INPUT -p tcp -m state --state NEW --dport 22 \
 -m recent --set -j ACCEPT</code></pre>
<p>I got this idea from <a href="http://groups.google.com/group/alt.os.linux.slackware/msg/6dd3ce3163d2f524" rel="via">a post to alt.os.linux.slackware</a>.  These rules use the <a href="http://www.netfilter.org/documentation/HOWTO//netfilter-extensions-HOWTO-3.html#ss3.16" title="Netfilter Extensions HOWTO: recent patch">recent extension</a> to <code>iptables</code> to track attempted SSH connections and drop any that come from the same IP within 15 seconds.  If you miss-type your passphrase, you just have to remember to hang back for a few seconds before retrying to avoid getting caught out.  You could jump to a custom chain that logged such connections before dropping them if you felt the need to monitor the effectiveness of the rule &#8211; although the scripts usually just stop trying after a few connection attempts are dropped.</p>
]]></content:encoded>
			<wfw:commentRss>http://sgp.me.uk/2005/08/25/ssh-attacks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

