<?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: Block brute force password attempts via SSH</title>
	<atom:link href="http://systembash.com/content/block-brute-force-ssh/feed/" rel="self" type="application/rss+xml" />
	<link>http://systembash.com/content/block-brute-force-ssh/</link>
	<description>Technology and System Administration</description>
	<lastBuildDate>Fri, 12 Mar 2010 08:32:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: SSH</title>
		<link>http://systembash.com/content/block-brute-force-ssh/comment-page-1/#comment-22407</link>
		<dc:creator>SSH</dc:creator>
		<pubDate>Mon, 10 Nov 2008 22:07:29 +0000</pubDate>
		<guid isPermaLink="false">http://systembash.com/content/block-brute-force-ssh/#comment-22407</guid>
		<description>sudo iptables -A INPUT -i eth0 -p tcp --dport 22 -m state --state NEW -m recent --set --name SSH
sudo iptables -A INPUT -i eth0 -p tcp --dport 22 -m state --state NEW -m recent --update --seconds 60 --hitcount 8 --rttl --name SSH -j DROP

and off he goes :)</description>
		<content:encoded><![CDATA[<p>sudo iptables -A INPUT -i eth0 -p tcp &#8211;dport 22 -m state &#8211;state NEW -m recent &#8211;set &#8211;name SSH<br />
sudo iptables -A INPUT -i eth0 -p tcp &#8211;dport 22 -m state &#8211;state NEW -m recent &#8211;update &#8211;seconds 60 &#8211;hitcount 8 &#8211;rttl &#8211;name SSH -j DROP</p>
<p>and off he goes <img src='http://systembash.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Episkipos</title>
		<link>http://systembash.com/content/block-brute-force-ssh/comment-page-1/#comment-5849</link>
		<dc:creator>Episkipos</dc:creator>
		<pubDate>Fri, 01 Feb 2008 12:49:21 +0000</pubDate>
		<guid isPermaLink="false">http://systembash.com/content/block-brute-force-ssh/#comment-5849</guid>
		<description>OK. How about the following as another viable alternative:
+---------------------------+
/usr/bin/swatch --config-file=/etc/swatchrc --tail-file=/var/log/messages \
	--awk-field-syntax --tail-args &quot;-F&quot; &amp;
+---------------------------+
watchfor /Authentication failed for user/
        exec &quot;/usr/local/sbin/lockout $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15&quot;
+---------------------------+
#! /bin/bash
#
IP=`echo $* &#124;  awk &#039;/Authentication failed/{sub(/\(\?@/,&quot;&quot;);print $6}&#039; &#124; sed &#039;s/)//g&#039;`
ATTEMPTS=`grep $IP /var/log/messages &#124; grep &quot;Authentication failed for user&quot;  &#124; wc -l`

if [ $ATTEMPTS -gt 2 ]
then
        route add $IP lo
        MINUTES=`expr $ATTEMPTS - 2`
        echo &quot;route del $IP lo 2&gt; /dev/null&quot; &#124; at now +$MINUTES minutes 2&gt;&amp;1 &gt; /tmp/.pure-lockout.$$
        (hostname ; echo $* ; echo &quot;IP=$IP&quot; ; echo &quot;ATTEMPTS=$ATTEMPTS&quot; ; \
                echo &quot;Blocking for $MINUTES minutes&quot; ; \
                cat /tmp/.pure-lockout.$$ ) &#124; Mail -s &quot;Lockout&quot; 
admin@example.com
fi

rm -f /tmp/.lockout.$$</description>
		<content:encoded><![CDATA[<p>OK. How about the following as another viable alternative:<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
/usr/bin/swatch &#8211;config-file=/etc/swatchrc &#8211;tail-file=/var/log/messages \<br />
	&#8211;awk-field-syntax &#8211;tail-args &#8220;-F&#8221; &amp;<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
watchfor /Authentication failed for user/<br />
        exec &#8220;/usr/local/sbin/lockout $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15&#8243;<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
#! /bin/bash<br />
#<br />
IP=`echo $* |  awk &#8216;/Authentication failed/{sub(/\(\?@/,&#8221;");print $6}&#8217; | sed &#8217;s/)//g&#8217;`<br />
ATTEMPTS=`grep $IP /var/log/messages | grep &#8220;Authentication failed for user&#8221;  | wc -l`</p>
<p>if [ $ATTEMPTS -gt 2 ]<br />
then<br />
        route add $IP lo<br />
        MINUTES=`expr $ATTEMPTS &#8211; 2`<br />
        echo &#8220;route del $IP lo 2&gt; /dev/null&#8221; | at now +$MINUTES minutes 2&gt;&amp;1 &gt; /tmp/.pure-lockout.$$<br />
        (hostname ; echo $* ; echo &#8220;IP=$IP&#8221; ; echo &#8220;ATTEMPTS=$ATTEMPTS&#8221; ; \<br />
                echo &#8220;Blocking for $MINUTES minutes&#8221; ; \<br />
                cat /tmp/.pure-lockout.$$ ) | Mail -s &#8220;Lockout&#8221;<br />
<a href="mailto:admin@example.com">admin@example.com</a><br />
fi</p>
<p>rm -f /tmp/.lockout.$$</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://systembash.com/content/block-brute-force-ssh/comment-page-1/#comment-5806</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Wed, 30 Jan 2008 13:45:48 +0000</pubDate>
		<guid isPermaLink="false">http://systembash.com/content/block-brute-force-ssh/#comment-5806</guid>
		<description>DenyHosts works to block services using TCP Wrappers, such as SSH and FTP however services like Apache which do not use TCPWrappers would still allow that host to connect. Assuming that any IP performing brute force attacks on your system is malicious (I think that is safe to assume) - I would much rather block them from using all services rather than just services using TCP Wrappers. A Brute force attack may be an indication that someone is trying to find a way into your system, so in my opinion it is better to block them via Firewall (iptables) rather than TCP Wrappers.</description>
		<content:encoded><![CDATA[<p>DenyHosts works to block services using TCP Wrappers, such as SSH and FTP however services like Apache which do not use TCPWrappers would still allow that host to connect. Assuming that any IP performing brute force attacks on your system is malicious (I think that is safe to assume) &#8211; I would much rather block them from using all services rather than just services using TCP Wrappers. A Brute force attack may be an indication that someone is trying to find a way into your system, so in my opinion it is better to block them via Firewall (iptables) rather than TCP Wrappers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Episkipos</title>
		<link>http://systembash.com/content/block-brute-force-ssh/comment-page-1/#comment-5803</link>
		<dc:creator>Episkipos</dc:creator>
		<pubDate>Wed, 30 Jan 2008 12:33:31 +0000</pubDate>
		<guid isPermaLink="false">http://systembash.com/content/block-brute-force-ssh/#comment-5803</guid>
		<description>How about denyhosts?</description>
		<content:encoded><![CDATA[<p>How about denyhosts?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: systemBash &#187; Analysis of a hacked machine</title>
		<link>http://systembash.com/content/block-brute-force-ssh/comment-page-1/#comment-3656</link>
		<dc:creator>systemBash &#187; Analysis of a hacked machine</dc:creator>
		<pubDate>Fri, 24 Aug 2007 18:20:19 +0000</pubDate>
		<guid isPermaLink="false">http://systembash.com/content/block-brute-force-ssh/#comment-3656</guid>
		<description>[...] APF + BFD [...]</description>
		<content:encoded><![CDATA[<p>[...] APF + BFD [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pierre</title>
		<link>http://systembash.com/content/block-brute-force-ssh/comment-page-1/#comment-101</link>
		<dc:creator>pierre</dc:creator>
		<pubDate>Tue, 13 Mar 2007 09:49:57 +0000</pubDate>
		<guid isPermaLink="false">http://systembash.com/content/block-brute-force-ssh/#comment-101</guid>
		<description>Thaks Fort the information !</description>
		<content:encoded><![CDATA[<p>Thaks Fort the information !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ssh pest control &#171; 0ddn1x: a minimalist&#8217;s medley</title>
		<link>http://systembash.com/content/block-brute-force-ssh/comment-page-1/#comment-13</link>
		<dc:creator>ssh pest control &#171; 0ddn1x: a minimalist&#8217;s medley</dc:creator>
		<pubDate>Sat, 14 Oct 2006 16:35:14 +0000</pubDate>
		<guid isPermaLink="false">http://systembash.com/content/block-brute-force-ssh/#comment-13</guid>
		<description>[...] http://systembash.com/content/block-brute-force-ssh/ [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://systembash.com/content/block-brute-force-ssh/" rel="nofollow">http://systembash.com/content/block-brute-force-ssh/</a> [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
