<?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: Automatically Block Failed SIP Peer Registrations</title>
	<atom:link href="http://www.teamforrest.com/blog/171/asterisk-no-matching-peer-found-block/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.teamforrest.com/blog/171/asterisk-no-matching-peer-found-block/</link>
	<description>Kamailio, Asterisk, VoIP, and IT Consulting</description>
	<lastBuildDate>Mon, 23 Jan 2012 12:37:52 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: batman</title>
		<link>http://www.teamforrest.com/blog/171/asterisk-no-matching-peer-found-block/comment-page-1/#comment-1391</link>
		<dc:creator>batman</dc:creator>
		<pubDate>Mon, 23 Jan 2012 12:37:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.teamforrest.com/blog/?p=171#comment-1391</guid>
		<description>this script takes on my server 2GB of memory and then iptables does not work  memory allocation error! so I changed it!

I used hash :)
instead of push(@failhost,$1); I use:
                                                        $failhost{$1}++;
 similar:

$ls = keys %failhost; 
   if ($ls&gt;0)
                     {
   while (my ($ip, $count) = each(%failhost))  


no its working :)</description>
		<content:encoded><![CDATA[<p>this script takes on my server 2GB of memory and then iptables does not work  memory allocation error! so I changed it!</p>
<p>I used hash <img src='http://www.teamforrest.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
instead of push(@failhost,$1); I use:<br />
                                                        $failhost{$1}++;<br />
 similar:</p>
<p>$ls = keys %failhost;<br />
   if ($ls&gt;0)<br />
                     {<br />
   while (my ($ip, $count) = each(%failhost))  </p>
<p>no its working <img src='http://www.teamforrest.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Noah</title>
		<link>http://www.teamforrest.com/blog/171/asterisk-no-matching-peer-found-block/comment-page-1/#comment-1354</link>
		<dc:creator>Noah</dc:creator>
		<pubDate>Mon, 29 Aug 2011 15:58:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.teamforrest.com/blog/?p=171#comment-1354</guid>
		<description>When using strict in perl you have to establish the global variables at the top my $blockedhosts; 

This will stop error messaging from filling up your var/mail/root

#!/usr/bin/perl -w
use strict;
use warnings;
my (@failhost);
my %currblocked;
my %addblocked;
my $action;
my $blockedhosts;</description>
		<content:encoded><![CDATA[<p>When using strict in perl you have to establish the global variables at the top my $blockedhosts; </p>
<p>This will stop error messaging from filling up your var/mail/root</p>
<p>#!/usr/bin/perl -w<br />
use strict;<br />
use warnings;<br />
my (@failhost);<br />
my %currblocked;<br />
my %addblocked;<br />
my $action;<br />
my $blockedhosts;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tola</title>
		<link>http://www.teamforrest.com/blog/171/asterisk-no-matching-peer-found-block/comment-page-1/#comment-1345</link>
		<dc:creator>Tola</dc:creator>
		<pubDate>Tue, 21 Jun 2011 16:41:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.teamforrest.com/blog/?p=171#comment-1345</guid>
		<description>Is it ok to permanently block the attacker with INPUT -s.  Thanks</description>
		<content:encoded><![CDATA[<p>Is it ok to permanently block the attacker with INPUT -s.  Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arno Teigseth</title>
		<link>http://www.teamforrest.com/blog/171/asterisk-no-matching-peer-found-block/comment-page-1/#comment-1331</link>
		<dc:creator>Arno Teigseth</dc:creator>
		<pubDate>Sat, 26 Mar 2011 14:52:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.teamforrest.com/blog/?p=171#comment-1331</guid>
		<description>Hi and thanks

I was quite proud that I found out how to iptables -j DROP the addresses I watched attacking me in the asterisk console, but this script is of course what I should have googled for in the first place.

Thanks again
Arno</description>
		<content:encoded><![CDATA[<p>Hi and thanks</p>
<p>I was quite proud that I found out how to iptables -j DROP the addresses I watched attacking me in the asterisk console, but this script is of course what I should have googled for in the first place.</p>
<p>Thanks again<br />
Arno</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Explaining SIP Brute Force Attacks to non-techs &#124; TEAM FORREST Blog</title>
		<link>http://www.teamforrest.com/blog/171/asterisk-no-matching-peer-found-block/comment-page-1/#comment-1319</link>
		<dc:creator>Explaining SIP Brute Force Attacks to non-techs &#124; TEAM FORREST Blog</dc:creator>
		<pubDate>Fri, 11 Mar 2011 04:48:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.teamforrest.com/blog/?p=171#comment-1319</guid>
		<description>[...] If you&#8217;re running asterisk, you might wish to install a script that checks for attacks and blocks those connections. [...]</description>
		<content:encoded><![CDATA[<p>[...] If you&#8217;re running asterisk, you might wish to install a script that checks for attacks and blocks those connections. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Team Forrest</title>
		<link>http://www.teamforrest.com/blog/171/asterisk-no-matching-peer-found-block/comment-page-1/#comment-1317</link>
		<dc:creator>Team Forrest</dc:creator>
		<pubDate>Mon, 07 Mar 2011 13:23:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.teamforrest.com/blog/?p=171#comment-1317</guid>
		<description>You can add any block you would like in this section:

[sourcecode language=&quot;perl&quot;]
while () {
    chomp; my $line = $_;
    if ($line =~ /\&#039; failed for \&#039;(.*?)\&#039; - No matching peer found/) {
      push(@failhost,$1);
    }
    if ($line =~ /\&#039; failed for \&#039;(.*?)\&#039; - Wrong password/) {
      push(@failhost,$1);
    }
  }
[/sourcecode]

For example, for what you want...

[sourcecode language=&quot;perl&quot;]
while () {
    chomp; my $line = $_;
    if ($line =~ /\&#039; failed for \&#039;(.*?)\&#039; - No matching peer found/) {
      push(@failhost,$1);
    }
    if ($line =~ /\&#039; failed for \&#039;(.*?)\&#039; - Wrong password/) {
      push(@failhost,$1);
    }
    if ($line =~ /\&#039; failed for \&#039;(.*?)\&#039; - Device does not match ACL/) {
      push(@failhost,$1);
    }
  }
[/sourcecode]</description>
		<content:encoded><![CDATA[<p>You can add any block you would like in this section:</p>
<pre class="brush: perl; title: ; notranslate">
while () {
    chomp; my $line = $_;
    if ($line =~ /\' failed for \'(.*?)\' - No matching peer found/) {
      push(@failhost,$1);
    }
    if ($line =~ /\' failed for \'(.*?)\' - Wrong password/) {
      push(@failhost,$1);
    }
  }
</pre>
<p>For example, for what you want&#8230;</p>
<pre class="brush: perl; title: ; notranslate">
while () {
    chomp; my $line = $_;
    if ($line =~ /\' failed for \'(.*?)\' - No matching peer found/) {
      push(@failhost,$1);
    }
    if ($line =~ /\' failed for \'(.*?)\' - Wrong password/) {
      push(@failhost,$1);
    }
    if ($line =~ /\' failed for \'(.*?)\' - Device does not match ACL/) {
      push(@failhost,$1);
    }
  }
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: JeffK</title>
		<link>http://www.teamforrest.com/blog/171/asterisk-no-matching-peer-found-block/comment-page-1/#comment-1316</link>
		<dc:creator>JeffK</dc:creator>
		<pubDate>Thu, 03 Mar 2011 17:31:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.teamforrest.com/blog/?p=171#comment-1316</guid>
		<description>I added a check for &quot;- Device does not match ACL&quot;. The offending hacker was using my own external IP in it&#039;s SIP host string.</description>
		<content:encoded><![CDATA[<p>I added a check for &#8220;- Device does not match ACL&#8221;. The offending hacker was using my own external IP in it&#8217;s SIP host string.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Team Forrest</title>
		<link>http://www.teamforrest.com/blog/171/asterisk-no-matching-peer-found-block/comment-page-1/#comment-386</link>
		<dc:creator>Team Forrest</dc:creator>
		<pubDate>Fri, 10 Dec 2010 20:46:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.teamforrest.com/blog/?p=171#comment-386</guid>
		<description>Great that you think fail2ban is more useful. You should run it. This script is for those that do not wish to run fail2ban.</description>
		<content:encoded><![CDATA[<p>Great that you think fail2ban is more useful. You should run it. This script is for those that do not wish to run fail2ban.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kasio</title>
		<link>http://www.teamforrest.com/blog/171/asterisk-no-matching-peer-found-block/comment-page-1/#comment-385</link>
		<dc:creator>kasio</dc:creator>
		<pubDate>Fri, 10 Dec 2010 20:34:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.teamforrest.com/blog/?p=171#comment-385</guid>
		<description>I think fail2ban is more usefull , if  someone needs help there are thousand of people who can help, this script is just for some people if someone asks you something instead of you help you remove the comment.
That means fai2ban is for everyone this script not.</description>
		<content:encoded><![CDATA[<p>I think fail2ban is more usefull , if  someone needs help there are thousand of people who can help, this script is just for some people if someone asks you something instead of you help you remove the comment.<br />
That means fai2ban is for everyone this script not.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tony</title>
		<link>http://www.teamforrest.com/blog/171/asterisk-no-matching-peer-found-block/comment-page-1/#comment-357</link>
		<dc:creator>Tony</dc:creator>
		<pubDate>Tue, 16 Nov 2010 01:59:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.teamforrest.com/blog/?p=171#comment-357</guid>
		<description>Thanks for the very useful script.  Fail2ban seemed much too complicated to use. This script worked perfectly for me.    

I have been receiving 10s if not 100s of registration attempts a second when the attack begins.  Rather than decreasing the cron job frequency, I have added rate limiting which uses the state module:
http://pbxinaflash.com/forum/showthread.php?t=5018

Now, no more than a few failed attempts until your script kicks in the next cron job.</description>
		<content:encoded><![CDATA[<p>Thanks for the very useful script.  Fail2ban seemed much too complicated to use. This script worked perfectly for me.    </p>
<p>I have been receiving 10s if not 100s of registration attempts a second when the attack begins.  Rather than decreasing the cron job frequency, I have added rate limiting which uses the state module:<br />
<a href="http://pbxinaflash.com/forum/showthread.php?t=5018" rel="nofollow">http://pbxinaflash.com/forum/showthread.php?t=5018</a></p>
<p>Now, no more than a few failed attempts until your script kicks in the next cron job.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

