This is the script, it comes with mod_evasive:
#!/usr/bin/perl
#test.pl: small script to test mod_dosevasive's effectiveness
use IO::Socket;
use strict;
for(0..100) {
my($response);
my($SOCKET) = new IO::Socket::INET( Proto => "tcp",
PeerAddr=> "MY_IP:80");
if (! defined $SOCKET) { die $!; }
print $SOCKET "GET /?$_ HTTP/1.0\n\n";
$response = <$SOCKET>;
print $response;
close($SOCKET);
}
If I run this script in my PC, replacing "MY_IP" with the ip of my VPS (openVZ, 3 CPU cores 2.53Ghz, 1Gb ram), the CPU load in the server increases really fast. If I run 3 or 4 instances of the script at the same time, CPU load reaches 100%. Once the scripts are stopped, CPU usage comes back to 5-10%.
Is it normal?? CSF is installed, and it blocks IPs with more than 300 connections, but it doesn't seem to block this script. If I check netstat -n | grep MY_PC_IP
, I never see more than 30 or 40 connections, even when running the scripts.
If you run the script against your site, does the CPU usage increases? What's wrong with my server or apache?