Donate to A.R.T.

Advertisement

powered_by.png, 1 kB

Archive Changelog


Home arrow Projects arrow Ratelimiting with Iptables
Ratelimiting with Iptables Print E-mail
Written by scott   
Wednesday, 10 May 2006
The following is a rule I put together to rate limit inbound connections to a Project Gamera server. I like doing this in firewall rules over the internal control mechanisms, since I can apply it to other services:

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 60 --hitcount 4 -j LOG --log-prefix "RATELIMIT: "
iptables -I INPUT -p tcp --dport 25 -i eth0 -m state --state NEW -m recent --update --seconds 60 --hitcount 4 -j DROP

What this does is track how many times a host will connect to the mail server in 60 seconds, if the number of New connections initiated in 60 seconds exceeds 4, it will log the attempt, and drop the connection.

The first rule sets netfilter to track new connections to port 25, the second rule is optional, this logs attempts that exceed the threshold, and the third line drops any new connections over 4.

Comments

Only registered users can write comments.
Please login or register.

Powered by AkoComment 2.0.3!

Last Updated ( Tuesday, 27 June 2006 )
 
< Prev
© 2010 atomicrocketturtle.com :: digital turtlist
Joomla! is Free Software released under the GNU/GPL License.
sheta@atomicrocketturtle.com
Fight Spam! Click Here!