LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-31-2005, 06:30 PM   #1
wwnexc
Member
 
Registered: Sep 2005
Location: California
Distribution: Slackware & Debian
Posts: 264

Rep: Reputation: 30
Arrow Protecting Apache from DOS & Brute Force


Hi,

1) I was wondering wether or not there is a way to restrict how many website a user or ip can get per minute.
2) When a folder is password protected, how can one limit the number of password-tries per minute?
3) is there any other smart way to avoid becoming a victim to a script-kiddie attack? (except updating software, of course)

Thanks
 
Old 10-31-2005, 06:55 PM   #2
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Quote:
1) I was wondering wether or not there is a way to restrict how many website a user or ip can get per minute.
Linux was built with the system administrator in mind, not with the accountant. Therefor:

-Use iptables
-Create a custom chain which counts the number of times it is traversed
-Set up some other rules which jump to that chain

In my case, I looked at tcp and upd packets coming from $net_wrl. In the tcp case, I only looked at connections not yet established, i.e. requests for new connections.


Code:
 
# Define custom chain for possibleDDoS attacks
$IPTABLES -N DDoS
$IPTABLES -A DDoS -m limit --limit 10/s --limit-burst 32 -j RETURN
$IPTABLES -A DDoS -j LOG --log-prefix "[Connection overflow] "
$IPTABLES -A DDoS -j DROP
#:
Code:
#:This one for Timmie's gaming fun: drop the initation of too many packets:
$IPTABLES -A FORWARD -p tcp -s $net_wrl --tcp-flags SYN,RST,ACK SYN -j DDoS
$IPTABLES -A FORWARD -p udp -s $net_wrl -j DDoS
#:
Quote:
2) When a folder is password protected, how can one limit the number of password-tries per minute?
3) is there any other smart way to avoid becoming a victim to a script-kiddie attack? (except updating software, of course)
Google for "tarpit" and "brute force" There are a few programs which do exactly what you are asking for. (Linux was built...) I don't have any experience, but it looks good.

jlinkels
 
Old 10-31-2005, 07:23 PM   #3
wwnexc
Member
 
Registered: Sep 2005
Location: California
Distribution: Slackware & Debian
Posts: 264

Original Poster
Rep: Reputation: 30
Would i have to run iptables on a seperate machine, or would it be ok to run iptables on the webserver itself?
 
Old 11-01-2005, 05:30 AM   #4
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
You can run iptables on the web server itself. However, you would have to do the filtering (the lines which say -j DDoS) in the INPUT chain.

If you are going to use iptables for advanced tricks like these, I recommend that you read thourougly thru the iptables-HOWTO. Most of the iptables scripts you find on the Internet are for masquerading firewalls. That is not what you might want to do. One very important concept you'd have to understand is the difference between INPUT, FORWARD and OUTPUT chains. Especially if you want to use iptables on your server machine.

jlinkels
 
  


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
Brute Force Detection for iptables SlAiD Linux - Security 3 05-05-2005 04:03 PM
SSH brute force.... compromised? heri0n Linux - Security 15 11-21-2004 05:51 PM
Nessus Brute Force Gerardoj Linux - General 0 12-27-2003 04:07 PM
Brute force DHCP SSBN Linux - Networking 10 10-21-2003 10:34 AM
Brute Force kwigibo Linux - General 2 08-01-2002 12:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:49 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