No subject


Sun Jul 19 19:54:31 CDT 2009


at least once a week I receive such an attack coming from a different ip.

I will read the articles. Thanks again to everyone.


Regards,
Rodrigo Lang.


2010/6/29 Kenny Watson <kwatson at geniusgroupltd.com>

> Hi, you can use fail2ban
> http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asterisk<http://www.voip-info.org/wiki/view/Fail2Ban+%28with+iptables%29+And+Asterisk>
>
> Which works well, when a pattern is found in a log file it addes in an
> iptables rules to block the traffic for a period.
>
> On debian you can apt-get install fail2ban and on centos/redhat yum -i
> fail2ban
>
> Thanks
>
> Kenny
>
> ----- Original Message -----
> From: "Gareth Blades" <list-asterisk at skycomuk.com>
> To: "Asterisk Users Mailing List - Non-Commercial Discussion" <
> asterisk-users at lists.digium.com>
> Sent: Tuesday, 29 June, 2010 4:12:42 PM
> Subject: Re: [asterisk-users] Find a way to block brute force attacks.
>
> Rodrigo Lang wrote:
> > Hello list.
> >
> > I'm trying to find a way to block any ip that tries to login more than
> > three times with the wrong password and try to log in three different
> > extensions. For I have suffered some brute force attacks on my asterisk
> > in the morning period.
> >
> > The idea would be: Any ip with three attempts without success to log
> > into an extension is blocked.
> >
> > Is there any way to accomplish this directly by the asterisk? Or is
> > there some kind of asterisk spit this information via the AMI?
> >
> > I was wondering to make a Java program to listen to the AMI and create a
> > rule in iptables for ip in specific.
> >
> > Does anyone have any suggestions?
> >
> >
> > Thanks,
> > Rodrigo Lang.
> >
> Does asterisk log the failed attempts to a file?
> If so then you could use sshblack to monitor the file for incorrect
> logins. It will add firewalls rules to a custom iptables chain based on
> various criteria. You can then point incoming SIP connections through
> this chain so offenders will be forewalled for a specific amount of time.
> http://www.pettingers.org/code/sshblack.html
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>               http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>               http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>

--0016e6d7e04096c193048a2e8bdc
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<span id=3D"result_box" class=3D"long_text"><span title=3D"Boa tarde." onmo=
useover=3D"this.style.backgroundColor=3D&#39;#ebeff9&#39;" onmouseout=3D"th=
is.style.backgroundColor=3D&#39;#fff&#39;">Good afternoon.
<br>
<br></span><span title=3D"Obrigado =E0 todos pelas respostas." onmouseover=
=3D"this.style.backgroundColor=3D&#39;#ebeff9&#39;" onmouseout=3D"this.styl=
e.backgroundColor=3D&#39;#fff&#39;">Thanks to everyone for=20
answers.
</span><span title=3D"O que eu acho estranho =E9 o asterisk n=E3o possuir=
=20
alguma ferramenta nativa =E0 ele para seguran=E7a do servidor SIP." onmouse=
over=3D"this.style.backgroundColor=3D&#39;#ebeff9&#39;" onmouseout=3D"this.=
style.backgroundColor=3D&#39;#fff&#39;">What I find strange is=20
the asterisk does not have any native tool for him to SIP server=20
security.
</span><span title=3D"Segue um exemplo do syslog messages do=20
asterisk:" onmouseover=3D"this.style.backgroundColor=3D&#39;#ebeff9&#39;" o=
nmouseout=3D"this.style.backgroundColor=3D&#39;#fff&#39;">Here&#39;s an exa=
mple of the=20
syslog messages from asterisk:
<br>
<br></span><span style=3D"background-color: rgb(255, 255, 255);" title=3D"[=
Jun 15 03:05:46] NOTICE[25284] chan_sip.c: Registration from=20
&#39;&quot;213&quot; &lt;sip:213 at my_extern_ip&gt;&#39; failed for=20
&#39;116.124.128.82&#39; - Wrong password" onmouseover=3D"this.style.backgr=
oundColor=3D&#39;#ebeff9&#39;" onmouseout=3D"this.style.backgroundColor=3D&=
#39;#fff&#39;">[Jun 15 03:05:46] NOTICE=20
[25284] chan_sip.c: Registration from &#39;&quot;213&quot;=20
&lt;sip:213 at my_extern_ip&gt;&#39; failed for &#39;116 .124.128.82 &#39;- Wr=
ong=20
password
<br></span><span style=3D"background-color: rgb(255, 255, 255);" title=3D"[=
Jun 15 03:05:46] NOTICE[25284] chan_sip.c: Registration from=20
&#39;&quot;213&quot; &lt;sip:213 at my_extern_ip&gt;&#39; failed for=20
&#39;116.124.128.82&#39; - Wrong password" onmouseover=3D"this.style.backgr=
oundColor=3D&#39;#ebeff9&#39;" onmouseout=3D"this.style.backgroundColor=3D&=
#39;#fff&#39;">[Jun 15 03:05:46] NOTICE=20
[25284] chan_sip.c: Registration from &#39;&quot;213&quot;=20
&lt;sip:213 at my_extern_ip&gt;&#39; failed for &#39;116 .124.128.82 &#39;- Wr=
ong=20
password
<br></span><span style=3D"background-color: rgb(255, 255, 255);" title=3D"[=
Jun 15 03:05:46] NOTICE[25284] chan_sip.c: Registration from=20
&#39;&quot;213&quot; &lt;sip:213 at my_extern_ip&gt;&#39; failed for=20
&#39;116.124.128.82&#39; - Wrong password" onmouseover=3D"this.style.backgr=
oundColor=3D&#39;#ebeff9&#39;" onmouseout=3D"this.style.backgroundColor=3D&=
#39;#fff&#39;">[Jun 15 03:05:46] NOTICE=20
[25284] chan_sip.c: Registration from &#39;&quot;213&quot;=20
&lt;sip:213 at my_extern_ip&gt;&#39; failed for &#39;116 .124.128.82 &#39;- Wr=
ong=20
password
<br></span><span style=3D"background-color: rgb(255, 255, 255);" title=3D"[=
Jun 15 03:05:46] NOTICE[25284] chan_sip.c: Registration from=20
&#39;&quot;213&quot; &lt;sip:213 at my_extern_ip&gt;&#39; failed for=20
&#39;116.124.128.82&#39; - Wrong password" onmouseover=3D"this.style.backgr=
oundColor=3D&#39;#ebeff9&#39;" onmouseout=3D"this.style.backgroundColor=3D&=
#39;#fff&#39;">[Jun 15 03:05:46] NOTICE=20
[25284] chan_sip.c: Registration from &#39;&quot;213&quot;=20
&lt;sip:213 at my_extern_ip&gt;&#39; failed for &#39;116 .124.128.82 &#39;- Wr=
ong=20
password
<br></span><span style=3D"background-color: rgb(255, 255, 255);" title=3D"[=
Jun 15 03:05:46] NOTICE[25284] chan_sip.c: Registration from=20
&#39;&quot;213&quot; &lt;sip:213 at my_extern_ip&gt;&#39; failed for=20
&#39;116.124.128.82&#39; - Wrong password" onmouseover=3D"this.style.backgr=
oundColor=3D&#39;#ebeff9&#39;" onmouseout=3D"this.style.backgroundColor=3D&=
#39;#fff&#39;">[Jun 15 03:05:46] NOTICE=20
[25284] chan_sip.c: Registration from &#39;&quot;213&quot;=20
&lt;sip:213 at my_extern_ip&gt;&#39; failed for &#39;116 .124.128.82 &#39;- Wr=
ong=20
password
<br></span><span style=3D"background-color: rgb(255, 255, 255);" title=3D"[=
Jun 15 03:05:46] NOTICE[25284] chan_sip.c: Registration from=20
&#39;&quot;213&quot; &lt;sip:213 at my_extern_ip&gt;&#39; failed for=20
&#39;116.124.128.82&#39; - Wrong password" onmouseover=3D"this.style.backgr=
oundColor=3D&#39;#ebeff9&#39;" onmouseout=3D"this.style.backgroundColor=3D&=
#39;#fff&#39;">[Jun 15 03:05:46] NOTICE=20
[25284] chan_sip.c: Registration from &#39;&quot;213&quot;=20
&lt;sip:213 at my_extern_ip&gt;&#39; failed for &#39;116 .124.128.82 &#39;- Wr=
ong=20
password
<br></span><span style=3D"background-color: rgb(255, 255, 255);" title=3D"[=
Jun 15 03:05:46] NOTICE[25284] chan_sip.c: Registration from=20
&#39;&quot;213&quot; &lt;sip:213 at my_extern_ip&gt;&#39; failed for=20
&#39;116.124.128.82&#39; - Wrong password" onmouseover=3D"this.style.backgr=
oundColor=3D&#39;#ebeff9&#39;" onmouseout=3D"this.style.backgroundColor=3D&=
#39;#fff&#39;">[Jun 15 03:05:46] NOTICE=20
[25284] chan_sip.c: Registration from &#39;&quot;213&quot;=20
&lt;sip:213 at my_extern_ip&gt;&#39; failed for &#39;116 .124.128.82 &#39;- Wr=
ong=20
password
<br></span><span style=3D"background-color: rgb(255, 255, 255);" title=3D"[=
Jun 15 03:05:46] NOTICE[25284] chan_sip.c: Registration from=20
&#39;&quot;213&quot; &lt;sip:213 at my_extern_ip&gt;&#39; failed for=20
&#39;116.124.128.82&#39; - Wrong password" onmouseover=3D"this.style.backgr=
oundColor=3D&#39;#ebeff9&#39;" onmouseout=3D"this.style.backgroundColor=3D&=
#39;#fff&#39;">[Jun 15 03:05:46] NOTICE=20
[25284] chan_sip.c: Registration from &#39;&quot;213&quot;=20
&lt;sip:213 at my_extern_ip&gt;&#39; failed for &#39;116 .124.128.82 &#39;- Wr=
ong=20
password
<br>
<br>
</span><span style=3D"background-color: rgb(255, 255, 255);" title=3D"Pelo =
que contei existe em torno de vinte mil registros desse em=20
uma hora." onmouseover=3D"this.style.backgroundColor=3D&#39;#ebeff9&#39;" o=
nmouseout=3D"this.style.backgroundColor=3D&#39;#fff&#39;">From what I told =
there is
 around twenty thousand records that at one time. </span><span title=3D"E=
=20
pelo menos uma vez por semana eu recebo um ataque desses vindo de um ip=20
diferente." onmouseover=3D"this.style.backgroundColor=3D&#39;#ebeff9&#39;" =
onmouseout=3D"this.style.backgroundColor=3D&#39;#fff&#39;">And at least onc=
e a week I
 receive such an attack coming from a different ip.
</span></span><br><br><span id=3D"result_box" class=3D"short_text"><span st=
yle=3D"" title=3D"">I will=20
read the articles. </span><span title=3D"">Thanks again to everyone.<br><br=
><br></span><span title=3D"">Regards,<br></span><span title=3D"">Rodrigo La=
ng.<br><br></span></span><br><div class=3D"gmail_quote">2010/6/29 Kenny Wat=
son <span dir=3D"ltr">&lt;<a href=3D"mailto:kwatson at geniusgroupltd.com">kwa=
tson at geniusgroupltd.com</a>&gt;</span><br>
<blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; borde=
r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi, you can use f=
ail2ban <a href=3D"http://www.voip-info.org/wiki/view/Fail2Ban+%28with+ipta=
bles%29+And+Asterisk" target=3D"_blank">http://www.voip-info.org/wiki/view/=
Fail2Ban+(with+iptables)+And+Asterisk</a><br>

<br>
Which works well, when a pattern is found in a log file it addes in an ipta=
bles rules to block the traffic for a period.<br>
<br>
On debian you can apt-get install fail2ban and on centos/redhat yum -i fail=
2ban<br>
<br>
Thanks<br>
<font color=3D"#888888"><br>
Kenny<br>
</font><div><div></div><div class=3D"h5"><br>
----- Original Message -----<br>
From: &quot;Gareth Blades&quot; &lt;<a href=3D"mailto:list-asterisk at skycomu=
k.com">list-asterisk at skycomuk.com</a>&gt;<br>
To: &quot;Asterisk Users Mailing List - Non-Commercial Discussion&quot; &lt=
;<a href=3D"mailto:asterisk-users at lists.digium.com">asterisk-users at lists.di=
gium.com</a>&gt;<br>
Sent: Tuesday, 29 June, 2010 4:12:42 PM<br>
Subject: Re: [asterisk-users] Find a way to block brute force attacks.<br>
<br>
Rodrigo Lang wrote:<br>
&gt; Hello list.<br>
&gt;<br>
&gt; I&#39;m trying to find a way to block any ip that tries to login more =
than<br>
&gt; three times with the wrong password and try to log in three different<=
br>
&gt; extensions. For I have suffered some brute force attacks on my asteris=
k<br>
&gt; in the morning period.<br>
&gt;<br>
&gt; The idea would be: Any ip with three attempts without success to log<b=
r>
&gt; into an extension is blocked.<br>
&gt;<br>
&gt; Is there any way to accomplish this directly by the asterisk? Or is<br=
>
&gt; there some kind of asterisk spit this information via the AMI?<br>
&gt;<br>
&gt; I was wondering to make a Java program to listen to the AMI and create=
 a<br>
&gt; rule in iptables for ip in specific.<br>
&gt;<br>
&gt; Does anyone have any suggestions?<br>
&gt;<br>
&gt;<br>
&gt; Thanks,<br>
&gt; Rodrigo Lang.<br>
&gt;<br>
Does asterisk log the failed attempts to a file?<br>
If so then you could use sshblack to monitor the file for incorrect<br>
logins. It will add firewalls rules to a custom iptables chain based on<br>
various criteria. You can then point incoming SIP connections through<br>
this chain so offenders will be forewalled for a specific amount of time.<b=
r>
<a href=3D"http://www.pettingers.org/code/sshblack.html" target=3D"_blank">=
http://www.pettingers.org/code/sshblack.html</a><br>
<br>
--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href=3D"http://www.api-digital.c=
om" target=3D"_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 <a href=3D"http://www.asterisk.org/hello" targ=
et=3D"_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
 =A0 <a href=3D"http://lists.digium.com/mailman/listinfo/asterisk-users" ta=
rget=3D"_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a>=
<br>
<br>
--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href=3D"http://www.api-digital.c=
om" target=3D"_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 <a href=3D"http://www.asterisk.org/hello" targ=
et=3D"_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
 =A0 <a href=3D"http://lists.digium.com/mailman/listinfo/asterisk-users" ta=
rget=3D"_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a>=
<br>
</div></div></blockquote></div><br>

--0016e6d7e04096c193048a2e8bdc--



More information about the asterisk-users mailing list