Avoiding too many connections at startup (TCP SYN sweep)

Feel free to talk about anything and everything in this board.
Post Reply
attlinux
Newbie
Newbie
Posts: 9
Joined: October 4th, 2012, 4:31 am

Avoiding too many connections at startup (TCP SYN sweep)

Post by attlinux »

Hello,

To whom it may concern,
I find it a little bit problematic that SABNZBD is connecting too fast at the beginning.
For example, I have 2 newsservers and each of these servers is having 15 connections, so at the startup of SABNZBD there will be a short moment when he makes 30 connections within one second.
Some firewalls, unfortunately, classify this as an attack coming from the inside, and fire up a false alarm about a TCP SYN HOST SWEEP attack (which, in fact, is no attack at all).

I want to avoid these false alarms, so I need a short delay between starting up of each connection.
I tried to do this myself and can tell you despite I am no python programmer at all (I'm rather a perl programmer) I think I succeeded; but better methods or suggestions how to implement this are, ofcourse, welcome.

What I did is: I changed the file /usr/local/src/SABnzbd-0.7.11/sabnzbd/downloader.py: ( - yes - I am a Linux user!)

I changed following lines:

Code: Select all

 try:                                                                                                             
                            logging.info("%s@%s:%s: Initiating connection",                                                              
                                              nw.thrdnum, server.host, server.port)                                                      
                                       nw.init_connect(self.write_fds)                 

by adding a time.sleep - into:

Code: Select all

 try:                                                                                                             
                            logging.info("%s@%s:%s: Initiating connection",                                                              
                                              nw.thrdnum, server.host, server.port)                                                      
                            time.sleep(2)                                                                                                
                            nw.init_connect(self.write_fds)                 
So, whenever SABNZBD initiates a connection, he sleeps for 2 seconds. Thus it takes 60 seconds to connect to all 30 connections, but I think it's worth the trouble.
I just want to avoid unneccessary trouble from paranoid persons. ;)

Is my solution correct? What do you think? Anything else that could be done about this issue?
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: Avoiding too many connections at startup (TCP SYN sweep)

Post by shypike »

It may work, but I don't know whether there are any side effects.
Obviously we're not going to bother the average user with this,
I can hear the complaints coming: why does it take so long to get upto speed?
In fact we would have to compensate for over-zealous "security" software.
So another obscure option for a small audience.
I'll have to think about this one.
Thanks for the analysis though.
Post Reply