Forum Moderators: phranque

Message Too Old, No Replies

IPTables, allowing IP only once per hour/day/week/etc.

         

rollinj

6:00 am on Jun 21, 2008 (gmt 0)

10+ Year Member



if anyone happens to know how to block any IP address from accessing a page/file/site more than once every hour/day/week could you please post it here?

I'm faily savvy with WHM and cPanel.. I hope there's an option to edit it from within there?

And I don't want to select certain IP addresses.. I'd just like to put this restriction across all of my pages.. need further clarification? Ask for it! Thanks in advance..

jdMorgan

4:15 pm on Jun 22, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You'll need a script to do this because Apache has no "memory" of any previous requests, and therefore cannot take action based on "previous requests." You will need a script to record IP addresses (in most cases, but this can get complex because of caching proxies such as those used by AOL and EarthLink), and what those IP addresses accessed, in order to take action on that basis.

The "runaway bot" script by xlcus and AlexK, available in our PHP forum library, may be adaptable to suit your needs.

Jim

rollinj

4:30 am on Jun 23, 2008 (gmt 0)

10+ Year Member



Darn.. so what I was looking at [adding commands such as]

sudo iptables -A INPUT -i eth0 -p tcp --dport 22 -m state --state NEW -m recent --set --name SSH
sudo iptables -A INPUT -i eth0 -p tcp --dport 22 -m state --state NEW -m recent --update --seconds 60 --hitcount 8 --rttl --name SSH -j DROP

wouldn't work..? I know it's for SSH but..

Is it impossible to block the user AFTER he/she has completed viewing the page? I fear not as you say apache has no memory of this..? Just wondering.. thanks!

[edited by: jdMorgan at 6:35 pm (utc) on June 24, 2008]
[edit reason] No URLs, please. See TOS. [/edit]

jdMorgan

6:36 pm on Jun 24, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I haven't ever tried configuring ipTables that way. Give it a try and let us know if it works or not.

I said "Apache has no memory" but this "memory" is apparently in ipTables itself... cool!

Jim