<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Yes, and that works well. &nbsp;Initially I was trying to guard against a bunch of INVITEs without auth replys. &nbsp;For the time being I've set up a separate fail2ban filter that looks at the invite challenges and only blocks someone if its extremely high in a short period of time. &nbsp; I still have to figure out how many of these INVITEs without auths the systems can handle because when you've got several instances going just the disk activity from the logs becomes problematic if there is a massive spike. &nbsp;Logging the auth timeouts seems to be the ideal solution because you could then drop the timeouts without affecting legit traffic.<div><br></div><div>Spencer</div><div><br><div><br><div><div><div><div>On Feb 21, 2011, at 2:33 PM, jay binks wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">could you not just modify your fail2ban regex and set the threshold for Register Auths in fail2ban ?<div>( you would not want to do it on invite auths, because it will include GOOD auths for calls )</div><div><br></div><div> I still like the idea of loggin sip_authentication timeouts ..</div><div>I might play with that a little today.</div><div><br></div><div>J<br><br><div class="gmail_quote">On Mon, Feb 21, 2011 at 8:28 PM, Spencer Thomason <span dir="ltr">&lt;<a href="mailto:spencer@5ninesolutions.com">spencer@5ninesolutions.com</a>&gt;</span> wrote:<br> <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">After tinkering with it, I think that might be the best way. &nbsp;The<br> iptables method is cool but I'd like to have more dynamic control and<br> with Fail2Ban looking at the challenges you could specifically ignore<br> certain high traffic IPs and block others. &nbsp;What would be very cool is<br> if instead of logging every challenge, a log entry was written if<br> there was a high number from a specific IP, then you could decide what<br> to do about it with fail2ban, similar to the pike module for opensips<br> does.<br> <div><div></div><div class="h5"><br> <br> On Feb 21, 2011, at 1:31 AM, <a href="mailto:covici@ccs.covici.com">covici@ccs.covici.com</a> wrote:<br> <br> &gt; I would change sip auth failure to challenge and then have sufficient<br> &gt; times to only block if there are too many challenges in a certain<br> &gt; time.<br> &gt; I am not even sure the failure works any more in recent gits.<br> &gt;<br> &gt; Spencer Thomason &lt;<a href="mailto:spencer@5ninesolutions.com">spencer@5ninesolutions.com</a>&gt; wrote:<br> &gt;<br> &gt;&gt; Yes, that works great if they respond to the challenge with a failed<br> &gt;&gt; auth. But the scenario I'm trying to prevent is if they just send the<br> &gt;&gt; INVITE and never respond to the challenge. &nbsp;Fail2Ban will not work as<br> &gt;&gt; every endpoint will initially send an INVITE and receive a challenge.<br> &gt;&gt; Legit calls will then respond correctly and not be logged as a SIP<br> &gt;&gt; auth failure but every call that is challenged will show up as SIP<br> &gt;&gt; auth challenge in the logs so there is no regex to differentiate<br> &gt;&gt; between legit an non legit traffic.<br> &gt;&gt;<br> &gt;&gt; Spencer<br> &gt;&gt;<br> &gt;&gt; On Feb 20, 2011, at 10:39 PM, Ken Rice wrote:<br> &gt;&gt;<br> &gt;&gt;&gt; Fail2Ban ... This is block an IP with too many failed attempts from<br> &gt;&gt;&gt; something like SipVicious pretty quickly<br> &gt;&gt;&gt;<br> &gt;&gt;&gt;<br> &gt;&gt;&gt; On 2/20/11 11:07 PM, "Spencer Thomason" &lt;<a href="mailto:spencer@5ninesolutions.com">spencer@5ninesolutions.com</a>&gt;<br> &gt;&gt;&gt; wrote:<br> &gt;&gt;&gt;<br> &gt;&gt;&gt;&gt; Hi,<br> &gt;&gt;&gt;&gt; We run hosted Freeswitch instances in VMs with the internal profile<br> &gt;&gt;&gt;&gt; on<br> &gt;&gt;&gt;&gt; port 5060 connecting to clients mostly behind NAT and then the<br> &gt;&gt;&gt;&gt; external profile connecting to our proxies only. &nbsp;Protecting the<br> &gt;&gt;&gt;&gt; external profile its straightforward.. we only allow traffic to/<br> &gt;&gt;&gt;&gt; from<br> &gt;&gt;&gt;&gt; our proxies at the firewall level. &nbsp;But protecting the internal<br> &gt;&gt;&gt;&gt; profile seems to be a bit more difficult because the UACs could be<br> &gt;&gt;&gt;&gt; theoretically anywhere on the network.<br> &gt;&gt;&gt;&gt;<br> &gt;&gt;&gt;&gt; I'm currently using Fail2Ban to prevent brute force registration<br> &gt;&gt;&gt;&gt; and<br> &gt;&gt;&gt;&gt; INVITEs on auth failures, e.g.:<br> &gt;&gt;&gt;&gt; failregex = \[WARNING\] sofia_reg.c:\d+ SIP auth failure \<br> &gt;&gt;&gt;&gt; (REGISTER\)<br> &gt;&gt;&gt;&gt; on sofia profile \'\w+\' for \[.*\] from ip &lt;HOST&gt;<br> &gt;&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\[WARNING\] sofia_reg.c:\d+ SIP auth failure \(INVITE\)<br> &gt;&gt;&gt;&gt; on sofia profile \'\w+\' for \[.*\] from ip &lt;HOST&gt;<br> &gt;&gt;&gt;&gt;<br> &gt;&gt;&gt;&gt; My question is, since its part of a normal SIP dialog to challenge<br> &gt;&gt;&gt;&gt; the<br> &gt;&gt;&gt;&gt; INVITE, is there any way to prevent a possible DoS from just sheer<br> &gt;&gt;&gt;&gt; volume of incoming INVITEs on an Internet facing server<br> &gt;&gt;&gt;&gt; automatically. &nbsp;I.e., If you block the logged challenge, you'd<br> &gt;&gt;&gt;&gt; block<br> &gt;&gt;&gt;&gt; all legitimate INVITEs and registrations. &nbsp;Since its UDP traffic I<br> &gt;&gt;&gt;&gt; couldn't come up with a way to do it automatically at the iptables<br> &gt;&gt;&gt;&gt; level. i.e. number of concurrent connections. &nbsp;Is there some option<br> &gt;&gt;&gt;&gt; to<br> &gt;&gt;&gt;&gt; just not respond if a client is sending a number of requests over a<br> &gt;&gt;&gt;&gt; certain threshold? &nbsp;It might not stop them from sending the traffic<br> &gt;&gt;&gt;&gt; but pretty soon they'd get the idea that it wasn't going to go<br> &gt;&gt;&gt;&gt; anywhere. &nbsp;My concern is say there are 50 Freeswitch instances on a<br> &gt;&gt;&gt;&gt; box (albeit 8 core, 32GB ram, 8 15K raid 10 storage) and someone<br> &gt;&gt;&gt;&gt; starts sending thousands of rouge INVITEs to every VM on a physical<br> &gt;&gt;&gt;&gt; box that the CPU load from just challenging the incoming INVITEs<br> &gt;&gt;&gt;&gt; would<br> &gt;&gt;&gt;&gt; create a DoS. &nbsp;We the logs regularly to try to catch people doing<br> &gt;&gt;&gt;&gt; this<br> &gt;&gt;&gt;&gt; sort of thing and drop them at a router upstream of the core<br> &gt;&gt;&gt;&gt; network,<br> &gt;&gt;&gt;&gt; but I'd like to have it happen without human intervention. &nbsp;Have I<br> &gt;&gt;&gt;&gt; completely over thought this and am missing something obvious?<br> &gt;&gt;&gt;&gt;<br> &gt;&gt;&gt;&gt; Thanks,<br> &gt;&gt;&gt;&gt; Spencer<br> &gt;&gt;&gt;&gt;<br> &gt;&gt;&gt;&gt;<br> &gt;&gt;&gt;&gt; _______________________________________________<br> &gt;&gt;&gt;&gt; FreeSWITCH-users mailing list<br> &gt;&gt;&gt;&gt; <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br> &gt;&gt;&gt;&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br> &gt;&gt;&gt;&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br> &gt;&gt;&gt;&gt; <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br> &gt;&gt;&gt;<br> &gt;&gt;&gt;<br> &gt;&gt;&gt;<br> &gt;&gt;&gt; _______________________________________________<br> &gt;&gt;&gt; FreeSWITCH-users mailing list<br> &gt;&gt;&gt; <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br> &gt;&gt;&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br> &gt;&gt;&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br> &gt;&gt;&gt; <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br> &gt;&gt;&gt;<br> &gt;&gt;<br> &gt;&gt;<br> &gt;&gt; _______________________________________________<br> &gt;&gt; FreeSWITCH-users mailing list<br> &gt;&gt; <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br> &gt;&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br> &gt;&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br> &gt;&gt; <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br> &gt;<br> &gt; --<br> &gt; Your life is like a penny. &nbsp;You're going to lose it. &nbsp;The question is:<br> &gt; How do<br> &gt; you spend it?<br> &gt;<br> &gt; &nbsp; &nbsp; &nbsp; &nbsp; John Covici<br> &gt; &nbsp; &nbsp; &nbsp; &nbsp; <a href="mailto:covici@ccs.covici.com">covici@ccs.covici.com</a><br> &gt;<br> &gt; _______________________________________________<br> &gt; FreeSWITCH-users mailing list<br> &gt; <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br> &gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br> &gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br> &gt; <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br> &gt;<br> <br> <br> _______________________________________________<br> FreeSWITCH-users mailing list<br> <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br> <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br> UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br> <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br> </div></div></blockquote></div><br><br clear="all"><br>-- <br>Sincerely<br><br>Jay<br> </div> _______________________________________________<br>FreeSWITCH-users mailing list<br><a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>http://lists.freeswitch.org/mailman/listinfo/freeswitch-users<br>UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users<br>http://www.freeswitch.org<br></blockquote></div><br></div></div></div></div></body></html>