On Wednesday 13 October 2004 06:19, frankieh wrote:
> Bryan Phinney wrote:

> > If anyone else is having this problem and runs Apache to host their own
> > site, I can quickly show you how to do this (add a few lines to
> > httpd2.conf) and you can block these out yourself.
>
> Yup, please do..
>
> I have had about 200 comment spams added to my site in the last couple
> of months.. so I setup my
> router withi a blacklist and I've just been adding the nasty IP to that
> blacklist.

Okay, in the httpd.conf file, add this line somewhere near the top, not within 
the virtual directory line:

SetEnvIfNoCase Referer ".*(casino|gambling|poker|porn|viagra).*" BadReferrer

All on one line, ignore any wrapping from the newsreader.  Add terms as needed 
to block additional referrer blacklisted terms.  This will tell Apache to set 
an environment variable of badreferrer when it receives a request that 
contains the blacklisted term.

Now, within the virtual directory for your blog, site or whatever, add these 
lines:

allow from all
order allow,deny
Deny from env=BadReferrer

Any order, it doesn't matter but Apache will explicitly deny when it sees the 
badreferrer environment variable.

Restart Apache and if you check your access_log, you should see 403 results 
for any request that contains a blacklisted term.  Simply add, as necessary, 
additional terms and they will no longer be allowed access. 

Once you have locked it down, consider sending a polite request to the <insert 
favorite epithet here> and tell him that they might as well give it up and 
they should realize the futility of wasting traffic and go away.

-- 
Bryan Phinney


____________________________________________________
Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com
Join the Club : http://www.mandrakeclub.com
____________________________________________________

Reply via email to