Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old March 15th, 2001, 04:17 PM
avatar avatar is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 1 avatar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to avatar Send a message via AIM to avatar
How do I do it, for starters? and can I use wildcards?

I run the latest Apache server, and I use PHP4 and MySQL.

Reply With Quote
  #2  
Old March 15th, 2001, 10:09 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0

Reply With Quote
  #3  
Old March 16th, 2001, 07:19 AM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 13
Send a message via AIM to rod k
freebsd,

You seem to be the most knowledgable among us on this sort of thing.

Do you know of anyway to use an external file holding a list of IPs to be used in a DENY directive?

Reply With Quote
  #4  
Old March 16th, 2001, 08:12 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
There are 3 ways to do it technically:
1) Using http://httpd.apache.org/docs/mod/core.html#include, but your situation needs to by dynamic, so this probabaly doesn't work well

2) Using http://httpd.apache.org/docs/mod/mo...tml#RewriteMap. Specifically, you need to be using something like this:

RewriteMap deny-list txt:/path/to/deny.txt

But still, you can't use RewriteMap directive in .htaccess (can't be dynamic as well)

Try this link -> http://httpd.apache.org/docs/misc/rewriteguide.html and look for Host Deny.

3) The only dynamic way (I can think of) to do it is to alter .htaccess with a script:

<Limit GET POST>
order allow,deny
allow from all
deny from # alter this line and put all IPs or the acceptable format on the same line
</Limit>

Reply With Quote
  #5  
Old March 16th, 2001, 08:19 AM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 13
Send a message via AIM to rod k
Thanks, I'll check into those. Maybe a little more information on what I'm thinking of would help.

I know to ban an IP immediately I'll have to add it to an .htaccess file. Due to experience I know that after a period of time the list can become quite large and I want to avoid the overhead of reading thru that list with each access. What I was envisioning was to transfer that list on a periodic basis from .htaccess to a file that would be read via httpd.conf and doing a restart. This would prevent the list in .htaccess from becoming overly large.

Reply With Quote
  #6  
Old March 16th, 2001, 09:18 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> What I was envisioning was to transfer that list on a periodic basis from .htaccess to a file

Good idea. I suggest the RewriteMap approach. It shouldn't be too difficult to read the deny from line and append each IP to /path/to/deny.txt. In reality, people out there only use the (3) way to append IPs to allow from line instead.

Reply With Quote
  #7  
Old March 16th, 2001, 09:59 AM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 13
Send a message via AIM to rod k
Thanks for your suggestions. I've re-thought things a bit, tho. To make it easier when adding an IP to the deny list I'll add it to both the .htaccess AND the text file simultaneously. Then my cron job will only have to unlink the original .htaccess and copy a base .htaccess (without IPs) and restart apache. No need to parse the .htaccess file for the IPs that way.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > Need help banning IP's


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway