Linux Netfilter discussions
 help / color / mirror / Atom feed
* Using iptables for throttling SMTP traffic
@ 2010-11-01 19:07 Alex
  2010-11-02  9:30 ` Brent Clark
  2010-11-02  9:55 ` Pascal Hambourg
  0 siblings, 2 replies; 8+ messages in thread
From: Alex @ 2010-11-01 19:07 UTC (permalink / raw)
  To: netfilter

Hi,

I've set up a few basic rules to throttle SMTP traffic from an
individual host should they make more than 10 connections in ten
seconds:

iptables -I INPUT -p tcp --dport 25 -i eth0 -m state --state NEW -m recent --set
iptables -I INPUT -p tcp --dport 25 -i eth0 -m state --state NEW -m
recent --update --seconds 10 --hitcount 10 -j LOG
iptables -I INPUT -p tcp --dport 25 -i eth0 -m state --state NEW -m
recent --update --seconds 10 --hitcount 10 -j DROP

Is this the correct way to do this? I notice the seconds value can't
be any greater than 20. What is the reason for this? I'd like to do
something like permit up to 100 messages/connections over any
60-second period. Is this possible?

My hope is to block hundreds of connections on my mail server from
bulk mail senders like constantcontact, as well as the flood of
connections from spam bots that are rejected by zen anyway.

How can I tell what rules are currently in place for a particular IP?
In other words, I see log entries for the initial block, but it
doesn't appear that an actual rule is added, correct?

Thanks,
Alex

^ permalink raw reply	[flat|nested] 8+ messages in thread
* Denial-of-Service attack on UDP-port 5060 (SIP/VoIP)
@ 2010-11-28 16:02 Secure-SIP-Server
  2010-11-28 18:59 ` Pascal Hambourg
  0 siblings, 1 reply; 8+ messages in thread
From: Secure-SIP-Server @ 2010-11-28 16:02 UTC (permalink / raw)
  To: netfilter

Hi,

I'm suffering on a Denial-of-Service attack on my SIP(VoIP) UDP port 5060, 
getting more then 70 REGISTER requests per second since yesterday. All 
comming from the Japanese IP 59.146.75.111:5088.

First I wrote into my iptable:
....
/sbin/iptables -P INPUT DROP
/sbin/iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
....
/sbin/iptables -A INPUT -p udp --dport 5060 -s 59.146.75.111 -j REJECT
....

but it didn't work.
1st Question:
Why??

Then I wrote:
....
/sbin/iptables -P INPUT DROP
/sbin/iptables -A INPUT -m state --state ESTABLISHED -j ACCEPT
/sbin/iptables -A INPUT -p udp --dport 5060 -s 59.146.75.111 -j REJECT
/sbin/iptables -A INPUT -m state --state RELATED -j ACCEPT
....

Nothing changed, still receiving this REGISTER requests on my server.
Then I did:
....
/sbin/iptables -P INPUT DROP
/sbin/iptables -A INPUT -p udp --dport 5060 -s 59.146.75.111 -j REJECT
/sbin/iptables -A INPUT -m state --state ESTABLISHED -j ACCEPT
/sbin/iptables -A INPUT -m state --state RELATED -j ACCEPT
....

This worked! All requests from that IP are rejected, all others reach my 
server as ever.

/sbin/iptables -L --line-numbers -v -n
shows me an rapidly increasing number of packages and bytes rejected by the 
first statement.

Now my 2nd question:
How can this requests (UDP) be from a ESTABLISHED connection??? They passed 
the firewall in the first two examples and therefore they must be 
ESTABLISHED!?!

3rd question:
Is there a way to tell iptables to lock only a specific IP:PORT for a while 
if this IP transmits more then 50 requests per second? If so, how?

Thanks and regards

Detlef Pilzecker
Weitlahnerstrafle 8
D - 83209 Prien am Chiemsee 


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-11-30 14:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-01 19:07 Using iptables for throttling SMTP traffic Alex
2010-11-02  9:30 ` Brent Clark
2010-11-02 14:11   ` Alex
2010-11-02  9:55 ` Pascal Hambourg
2010-11-02 11:01   ` Jan Engelhardt
  -- strict thread matches above, loose matches on Subject: below --
2010-11-28 16:02 Denial-of-Service attack on UDP-port 5060 (SIP/VoIP) Secure-SIP-Server
2010-11-28 18:59 ` Pascal Hambourg
2010-11-28 21:31   ` Secure-SIP-Server
2010-11-30 13:14     ` Using iptables for throttling SMTP traffic Secure-SIP-Server
2010-11-30 13:24       ` Jan Engelhardt
2010-11-30 14:01       ` lst_hoe02

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox