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 04-25-2008, 09:12 AM   #1
crime
LQ Newbie
 
Registered: Apr 2006
Posts: 11

Rep: Reputation: 0
Max conn. limit with Iptables.


Hello guys.

I am getting some attacks to my linux box. I have iptables installed but I didnt use it. But now I have to use I think

I think their attacking method opens connections to my IPs. And every connection has different source ports. Like;

x.y.z.c:2810
x.y.z.c:2811
x.y.z.c:2812
..

So I have to limit IPs that opens connections more than one port. The destination port is 27015.

Here is my try to block more than 3 connecions in 3 seconds. It doesnt work. I dont know how to specify amount of ports that can be connect at that moment.

iptables -I INPUT -p tcp --dport 27015 -m state --state NEW -m recent --set
iptables -I INPUT -p tcp --dport 27015 -m state --state NEW -m recent --update --seconds 3 --hitcount 3 -j DROP
 
Old 04-25-2008, 12:37 PM   #2
dkm999
Member
 
Registered: Nov 2006
Location: Seattle, WA
Distribution: Fedora
Posts: 407

Rep: Reputation: 35
According to my manpage, the --set option will always return success (which I think means that it causes the rule evaluation to stop on that chain). So try putting the --update rule first, and the --set rule second.
 
Old 04-25-2008, 05:47 PM   #3
zerg4141
LQ Newbie
 
Registered: Jul 2005
Distribution: Debian
Posts: 27

Rep: Reputation: 15
>Here is my try to block more than 3 connecions in 3 seconds. It doesnt >work. I dont know how to specify amount of ports that can be connect at >that moment.
>
>iptables -I INPUT -p tcp --dport 27015 -m state --state NEW -m recent >--set
>iptables -I INPUT -p tcp --dport 27015 -m state --state NEW -m recent >--update --seconds 3 --hitcount 3 -j DROP

==================================================

try this:

iptables -A INPUT -m recent --name BAD_JUJU --update --seconds 3 --hitcount 3 -j DROP
iptables -A INPUT -p tcp --dport 27015 -m state --state NEW -m recent --name BAD_JUJU --set -j ACCEPT
 
  


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
does ifconfig rx bytes counter have Max limit dimsh Linux - Newbie 2 12-26-2005 05:07 PM
APACHE: limit max connections from the same IP ? tclwp Linux - Networking 3 06-24-2005 11:47 AM
Threads - Max Limit socratesinus Linux - Software 5 04-20-2005 03:43 PM
iptables and I-net Conn. sharing problems anwar_lpk Linux - Networking 2 06-25-2003 12:26 PM
max process limit anoop_chandran Linux - Networking 2 01-16-2002 05:22 AM

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

All times are GMT -5. The time now is 10:42 AM.

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