LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 09-14-2012, 11:41 AM   #1
packets
Member
 
Registered: Oct 2005
Posts: 339

Rep: Reputation: 32
ddos on apache


I notice that a bot is attacking my http. I see lots of GET request sometimes 20-30 request in just a seconds! How do I block or limit http request per ip? I'm using apache. I already added module mod_evasive but it seems it was not loaded though the DOSSystemCommand command under mod_evasive20.c Ifmodule.

Any suggestions?
 
Old 09-14-2012, 12:14 PM   #2
YankeePride13
Member
 
Registered: Aug 2012
Distribution: Ubuntu 10.04, CentOS 6.3, Windows 7
Posts: 262

Rep: Reputation: 55
You should talk to your ISP.
 
Old 09-14-2012, 12:36 PM   #3
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
I agree that talking to your upstream service provider would be in order as the best place to block or filter the traffic would be before it even enters your system. Anything that you do will consume resources.

Aside from that, some things you can try locally:
1 - rate limit filtering in IPTables. This can be difficult because it requires you to balance the needs of valid traffic versus the malicious traffic.
2 - create a robots.txt, though if it is a malicious bot it is unlikely to abide by this
3 - investigate mod_dosevasive (found from seaching, don't know enough about it to endorse or not)
4 - investigate mod_security
5 - Depending on the requests, try fail2ban though it may be a little on the slow side
6 - look into using syn cookies.

Edit: to really get at the meat of the problem you will need to actually capture traffic data and then try to create a filter based upon it. This is a rather advanced topic.

Last edited by Noway2; 09-14-2012 at 12:37 PM.
 
Old 09-14-2012, 01:21 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
...in addition here's two limiting rules:
Code:
# Per /24 block:
-A INPUT -m tcp -p tcp --syn -m multiport --dports 80,443 -m connlimit --connlimit-above 8 --connlimit-mask 24 -j REJECT --reject-with tcp-reset
# 2 packets p/s std, burst to 10 pps per IP address:
-A INPUT -m tcp -p tcp -m multiport --dports 80,443 -m hashlimit --hashlimit 2/s --hashlimit-burst 10 --hashlimit-mode srcip,dstport --hashlimit-htable-size 1024 --hashlimit-htable-max 2048 --hashlimit-name HTTP --hashlimit-htable-gcinterval 1000 --hashlimit-htable-expire 1000 -m state --state NEW -j ACCEPT
See '/sbin/iptables -m hashlimit --help' for more.
 
Old 09-14-2012, 09:17 PM   #5
packets
Member
 
Registered: Oct 2005
Posts: 339

Original Poster
Rep: Reputation: 32
Thanks for the response. I guess I'll try iptables.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How could Apache Error Impacting Named? Is it DDOS? romeo_tango Linux - Server 3 02-21-2012 01:18 PM
Is this Apache DDOS attack? saharabear Linux - Security 16 06-15-2011 10:09 AM
How to prevent ddos apache attacks skoinga Linux - Security 2 01-27-2011 06:45 PM
DDoS trough a VerliHub bug, apache is dead c00kie Linux - Security 46 04-10-2007 05:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 10:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration