users@grizzly.java.net

Re: DoS prevention [was Re: Quickest way to kill a connection]

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Fri, 30 Nov 2007 13:05:06 -0500

Alan Williamson wrote:
>> OK can you try the following. Download the following jars:
>>
>> http://weblogs.java.net/blog/jfarcand/archive/DosTest.zip
>>
>> This is the Grizzly WebServer. I've set the default timeout to 5000. I
>> start the server with:
>>
>> java -jar http-1.6-SNAPSHOT.jar 8080 /var/www/
>>
>> Then I'm doing:
>>
>>
>>> [ja120114_at_localhost grizzly]$ telnet localhost 8080
>>> Trying 127.0.0.1...
>>> Connected to localhost.
>>> Escape character is '^]'.
>>> aaaa
>>> aaaa
>>
>> The 5000 seems to work. Could it be an issue with your implementation?
>
> Thanks ... okay we are getting close.

OK that one works :-)

>
> This particular example does work. HOWEVR ... i can open up a
> connection and send NOTHING to it, and it sits there for ages. Well
> past the 5second mark.

Hum..here is what I've tested. I've wrote:

> #!/bin/sh
> t1=`date +%s`
> telnet localhost 8080
> t2=`date +%s`
> echo Connection closed after: `expr $t2 - $t1` seconds

and got:

> [ja120114_at_localhost container]$ ./timedTelnet.sh
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> Connection closed by foreign host.
> Connection closed after: 31 seconds

which is what I was expecting as the default keepAliveInSeconds is 30.

If you execute the same script, is it closing on time?
Are you invoking in your main:

st.setMaxKeepAliveInSeconds(30); //Default is 30 when not set.

Thanks

-- Jeanfrancois



It's as soon as i send the first character does
> the timer actually kick in.
>
> make sense?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>