hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : Help - How to prevent DDoS attacks?
Reply

Hosting Security and Technology Configuring and optimizing web hosting servers and operating systems, developing administration scripts, building servers, protecting against hackers, and general security (SSL certificates, etc.)
Forum Jump

Help - How to prevent DDoS attacks?

Reply Post New Thread In Hosting Security and Technology Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 07-23-2009, 01:08 AM
Phatmat Phatmat is offline
Junior Guru Wannabe
 
Join Date: Aug 2008
Posts: 35

Help - How to prevent DDoS attacks?


I believe that my site is being DDoSed against, and I'm wondering how I can prevent this from happening.

I'm running CentOS 5.3.

Are there any server side scripts of PHP scripts that could be used to dynamically block out IP's that are consuming too many resources on the VPS?

- Matt.

Reply With Quote


Sponsored Links
  #2  
Old 07-23-2009, 01:34 AM
Chris Isaac Chris Isaac is offline
Newbie
 
Join Date: Jul 2009
Posts: 14
Consider installing Dos_deflate. It will help you blocking DDos to a certain extend. By blocking the IP's which exceeds a threshold value specified.

Reply With Quote
  #3  
Old 07-23-2009, 01:38 AM
Thomas Manning Thomas Manning is offline
Junior Guru
 
Join Date: May 2009
Location: On a Speck!!!!!
Posts: 215
Hello,

Use the following command from the shell to find the IP's that have large number of connection with the server.

"netstat -plan|grep :80|awk '{print $5}'|cut -d: -f 1|sort|uniq -c|sort -n"

Reply With Quote
Sponsored Links
  #4  
Old 07-23-2009, 02:10 AM
W1zzard W1zzard is offline
Junior Guru Wannabe
 
Join Date: May 2006
Posts: 64
also check the logs for a large number of repeated hits to the same url spaced a short time apart

Reply With Quote
  #5  
Old 07-23-2009, 03:09 AM
logicsupport logicsupport is offline
Aspiring Evangelist
 
Join Date: May 2006
Location: World Wide Web
Posts: 380
Hi,

You can confirm whether the server is under DDOS attack using the below script.

netstat -plan|grep :80|awk {'print $5'}|cut -d: -f 1|sort|uniq -c|sort -nk 1

( The above script will give the total number of http connections to the port 80 )

If you are confirmed the server is under DDOS attack then you need to made some tweaks on your server , just like

1) Install mod security
2) Install dos evasive
3 ) Harden the sysctl parameters (kernel params) to mitigate the current attack.
4 ) Increasing the backlog queue size and decreasing the backlog queuing time might help a bit.
5) Also you need to run some scripts to monitor the server and block the ip's if it cause DDOS
6) Check for specious process and files using latest scanning tools

__________________
LogicSupport.com - Support That Makes Sense!
Quality Server Management & Web Hosting Support


Reply With Quote
  #6  
Old 07-23-2009, 03:30 AM
Cristi4n Cristi4n is offline
Web Hosting Evangelist
 
Join Date: Jun 2006
Location: Cluj Napoca
Posts: 468
logicsupport, not to be rude since we try to help Phatmat but if he is under a DDOS (not DOS) then installing mod_security and dos_evasive will not help at all and will only waste time for him.
Also you cannot block the ip that causes the DDOS since a DDOS is a distributted DOS (multiple ips, usually many).

hardening (more of tuning because it's not really hardening) sysctl will help.
If indeed you are getting a DDOS on port 80 (apache) please let us know.
If it's only a DOS then that can be solved quickly.

__________________
IntoDNS - Check your DNS health and configuration
IntoVPS - US Fremont and Dallas;EU - Netherlands and Romania VPS hosting

Reply With Quote
  #7  
Old 07-23-2009, 03:50 AM
Phatmat Phatmat is offline
Junior Guru Wannabe
 
Join Date: Aug 2008
Posts: 35
Quote:
Originally Posted by Cristi4n View Post
logicsupport, not to be rude since we try to help Phatmat but if he is under a DDOS (not DOS) then installing mod_security and dos_evasive will not help at all and will only waste time for him.
Also you cannot block the ip that causes the DDOS since a DDOS is a distributted DOS (multiple ips, usually many).

hardening (more of tuning because it's not really hardening) sysctl will help.
If indeed you are getting a DDOS on port 80 (apache) please let us know.
If it's only a DOS then that can be solved quickly.
I don't believe that it would be a major attack. From my knowledge, a member was banned on my forum for breaking the rules, and got back at us by DDoSing, I don't think he would be using anything too major.

Though, how would I check if they are attacking on port 80? At the moment I've got no access to my VPS, since SSH is down and the servers unpingable. I'm waiting for my hosts to reboot it - I suppose my main issue is how to prevent this banned user taking down my forum again. Once it's back online I'll try to get some of those mods installed listed above.

Thanks for all the quick help guys.

Reply With Quote
  #8  
Old 07-23-2009, 04:24 AM
logicsupport logicsupport is offline
Aspiring Evangelist
 
Join Date: May 2006
Location: World Wide Web
Posts: 380
Phatmat,

Thank you for the update.

Mod_security and Mod_dosevasive ( to prevent Dos ) will help to prevent vulnerable activities in the server. Its always better to install these modules on your server. Also do the security tweaks we have mentioned once load become normal.

==> " Though, how would I check if they are attacking on port 80? "

You can confirm this using the following script , just execute this in the shell

netstat -plan|grep :80|awk {'print $5'}|cut -d: -f 1|sort|uniq -c|sort -nk 1


DDOS is Distributed Dos, means the attack from different sources. We can block such source ip's using scripts like Dos_deflate ( Chris Isaac, already mentioned that ). Actually it is ( D)Dos_deflate. Also install a firewall such as CSF and confirm all the unwanted ports are closed.

Please note that DDOS cant be prevented completely. But it can control using some customized scripts.

__________________
LogicSupport.com - Support That Makes Sense!
Quality Server Management & Web Hosting Support


Reply With Quote
  #9  
Old 07-23-2009, 04:40 AM
Cristi4n Cristi4n is offline
Web Hosting Evangelist
 
Join Date: Jun 2006
Location: Cluj Napoca
Posts: 468
Phatmat, let us know when the VPS is online and you have checked to see if you are getting a dos or a ddos.

logicsupport, he is on a VPS, installing a lot of modules without a reson will not help at all. dos_deflate is a waste of time for a true ddos not just 2 IP's flooding something. It's useless to get into details right now about this.
mod_security is ok but Pathman should know what he is doing and his problem doesn't seem very related to what mod_security can protect against.

Batter to wait for Pathman to let us know when the server is online.

__________________
IntoDNS - Check your DNS health and configuration
IntoVPS - US Fremont and Dallas;EU - Netherlands and Romania VPS hosting


Last edited by Cristi4n; 07-23-2009 at 04:52 AM.
Reply With Quote
  #10  
Old 07-23-2009, 05:23 AM
whrss whrss is offline
Premium Member
 
Join Date: May 2009
Location: SLASH ROOT
Posts: 554
Dear Phatmat,

You will get a handful of DDOS mitigation tools. But I would suggest you to analyze the current attack (monitor the traffic, intensity and nature), using tools like tcpdump, iptraf etc and then take steps to prevent it.

__________________
█ WebHostRepo.com
█ Linux | Windows
| VPS | Cloud
█ Outsourced Technical Support since 2009
█ sales@webhostrepo.com

Reply With Quote
  #11  
Old 07-23-2009, 05:41 AM
inspiron inspiron is offline
Support Facility
 
Join Date: Jun 2009
Posts: 2,318
Using given below command will use to check incoming and the outgoing connections on server.

netstat -na | grep 'tcp\|udp' | awk '{ print $4}' | cut -d: -f2 | sort | uniq -c | awk '{print $2}'


You can block the IPs by getting the csf firewall installed on the server by using the command,

# csf -d ipadress

__________________
Support Facility | 24/7 web hosting technical support services
Technical support | Server management | Data migration

Technical Articles

Reply With Quote
  #12  
Old 07-23-2009, 06:48 AM
Phatmat Phatmat is offline
Junior Guru Wannabe
 
Join Date: Aug 2008
Posts: 35
When I install ddos_deflate (http://deflate.medialayer.com/), what should the download directory be?

All they say is:

wget http://www.inetbase.com/scripts/ddos/install.sh
chmod 0700 install.sh
./install.sh

What directory should this be downloaded into?

Reply With Quote
  #13  
Old 07-23-2009, 07:16 AM
logicsupport logicsupport is offline
Aspiring Evangelist
 
Join Date: May 2006
Location: World Wide Web
Posts: 380
Hi Phatmat,

You can download the script to /usr/local and execute the script. This will automatically create a cron job and will monitor the connections.


cd /usr/local
wget http://www.inetbase.com/scripts/ddos/install.sh
chmod 0700 install.sh
./install.sh

Also you can customize the script for your use. For example

vi /usr/local/ddos/ddos.conf
##### How many connections define a bad IP? Indicate that below.
NO_OF_CONNECTIONS=50

__________________
LogicSupport.com - Support That Makes Sense!
Quality Server Management & Web Hosting Support


Reply With Quote
  #14  
Old 07-23-2009, 07:31 AM
Phatmat Phatmat is offline
Junior Guru Wannabe
 
Join Date: Aug 2008
Posts: 35
Quote:
Originally Posted by logicsupport View Post
Hi Phatmat,

You can download the script to /usr/local and execute the script. This will automatically create a cron job and will monitor the connections.


cd /usr/local
wget http://www.inetbase.com/scripts/ddos/install.sh
chmod 0700 install.sh
./install.sh

Also you can customize the script for your use. For example

vi /usr/local/ddos/ddos.conf
##### How many connections define a bad IP? Indicate that below.
NO_OF_CONNECTIONS=50
Is there any way to know whether the script will function for sure? I know, from experience, that when I install things like this they generally don't run first try - meaning my server will possibly get taken down again.

My plan is to move to a new VPS host in a day or two, resetting up my server with many more security measures. Though, it's my first time doing so, and was wondering if anyone could help me check the security of my VPS? I'm going to be running DirectAdmin with CentOS 5.3 (VPS has 512mb RAM).

- Matt.

Reply With Quote
  #15  
Old 07-23-2009, 07:51 AM
logicsupport logicsupport is offline
Aspiring Evangelist
 
Join Date: May 2006
Location: World Wide Web
Posts: 380
If you would like someone to have a look at that, I would suggest you can post your requirement in the system management request section in WHT. Here's the link:-

http://www.webhostingtalk.com/forumdisplay.php?f=140

I am sure, there would be many who would offer you assistance there.

__________________
LogicSupport.com - Support That Makes Sense!
Quality Server Management & Web Hosting Support


Reply With Quote
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
Q: Prevent DDoS attacks with restarting httpd ? The-Webhost Hosting Security and Technology 14 01-13-2008 11:53 PM
Got DDoS? BLCC DDoS Protection sale! Stop HTTP GET attacks in their tracks! IRCCo Jeff Dedicated Hosting Offers 7 01-17-2007 12:49 PM
How to Prevent These Attacks On Apache AyKuT Hosting Security and Technology 15 05-30-2005 07:09 PM
DDOS attacks? Is there a security company to help prevent? ebizcraftsman Web Hosting 11 12-17-2004 12:42 AM

Related posts from TheWhir.com
Title Type Date Posted
Petition Urges White House to Consider DDoS Attacks Legal Form of Protest Web Hosting News 2013-01-11 11:26:47
DDoS Mitigation Provider Prolexic Blocks Extended DDoS Attack Against Ecommerce Website Parts Geek Web Hosting News 2012-11-07 10:57:01
Web Host Tenzing Launches DDoS, DoS Mitigation Service Web Hosting News 2012-10-11 17:35:53
Web Host Yola Uses DDoS Mitigation Service Prolexic Web Hosting News 2011-12-07 20:42:42
WHIR TV - Rick from Neustar Discusses DDOS Threats and Defense Blog 2011-09-23 13:52:45


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?