Forum Moderators: coopster & phranque

Message Too Old, No Replies

Update on Banning Bots script

         

Bluestreak

3:04 am on Jun 10, 2002 (gmt 0)

10+ Year Member



Hey Key_Master and all,

I'm testing a proprietary script that works similar to the script Trap.pl that you gave (but with a ton more features that I really needed) What I'd like to do is see if I can get both scripts to work together.

Here's the issue, I need to have the following code in htaccess in order for trap.pl to work:

<Files ~ "^.*$">
order allow,deny
allow from all
deny from env=ban
</Files>

Now what the proprietary script I have does is add the following code:

<Limit GET POST >
order allow,deny
allow from all
deny from blah blah blah
</Limit>

So both these codes end up in the htaccess file. For the proprietary script, whenever it finds a bad acting bot or crawler it adds a new "Deny from" line with the offending IP.

Ive noticed that one code tends to cancel out the other. Im trying to see if its possible to either merge the code or set it up so they dont cancel each other out.

As an alternative solution, Ive tried to move the trap.pl script to my main subdirectory called MPN, and leave the proprietary at the root. The result is whenever a ban takes place at the root directory, the offender still has access to the MPN directory because the htaccess file there acts separately from the root htaccess.

I guess I want to bake my cake and eat it too. As it stands I can use one or the other but not both.

Is there a solution? Appreciate any help!

Key_Master

3:22 am on Jun 10, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<Limit></Limit> will leave you cgi-bin wide open.

Bluestreak

3:53 am on Jun 10, 2002 (gmt 0)

10+ Year Member



So what do I do? I can change the script to write <Files> instead of <Limit> if thats necessary...

Key_Master

4:03 am on Jun 10, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



trap.pl can be configured to write to the specific directory the immediate .htaccess file is located in. I don't have time to do it myself but maybe somebody else will volunteer.

Other than that, the only solution I can see is to limit your site to one .htaccess file placed in the root directory.

Bluestreak

4:34 am on Jun 10, 2002 (gmt 0)

10+ Year Member



Sorry if I sound like an idiot, but I thought trap.pl already wrote to the immediate directory the htaccess file was in. I assumed all I had to do was just change the root_dir variable from the root directory /home/blah/public_html to /home/blah/public_html/mpn, therefore creating a separate htaccess in that subdirectory

Did I understand you correctly when your suggestion was to consolidate all the htaccess files into one htaccess file in the root directory? That seems to make sense, since the htaccess file in the root works independently from the trap.pl generated htaccess in the subdirectory. Thats why even if your banned in the root, it doesnt reflect that in the trapl.pl subdirectory a well.

I think the solution would be to have trap.pl (when executed) read the htaccess file in the root directory, and whatever ip address that has been banned would be added to its own htaccess file. if Im right let me know, maybe i can get started on finding a solution.

Allen

2:59 pm on Jun 25, 2002 (gmt 0)

10+ Year Member



Hi,

AFAIK, .htaccess effects are recursive (atleast when using <Files ~>), meaning that if you put a .htaccess file in /home/blah/public_html then /home/blah/public_html/mpn is also covered.

You say that one of the code sets in cancelling the other out. The answer here is simple, just remove the two lines:
order allow,deny
allow from all
from the set which is processed second (either below it in the .htaccess or in a subdirectory)

It's basically the 'allow from all' that will be cancelling out the other script (or, in other terms, anything processed before it).

Hope that helps

Allen

Bluestreak

8:35 pm on Jun 27, 2002 (gmt 0)

10+ Year Member



Thanks for the help Allen. Ive been ale to reslve the issue, so I now have the equivalent of a minefield laid out on my site >:-) The rush i get whenever a victim (err visitor) gets trapped is disturbing. I think i need to find another hobby :-)