| View previous topic :: View next topic |
| Author |
Message |
whoo High Priestess

 Joined: 25 Dec 2004 Posts: 1293
  votes: 19
|
Posted: Sat Apr 02, 2005 0:43 Post subject: whoo's anti-spam techniques in one simple thread |
|
|
8/17/06 Edit: this is NOT a hack or a plugin, however the information in this thread is in keeping with the topic of this area. A few other ideas expressed here use the same approach and of course, we have the same goal - a spam free blog.
---
The code posting below include COMMENTS. They are for informational purposes, NOT to be pasted into files.. If you copy and paste code into your .htaccess, leave out the comments
1. b2evo comes with a blacklist. Update that frequently.
2. Change the URL to your trackback and comments.
Details follow:
A. Rename the /htsrv directory within your b2evolution installation. You may call it ANYTHING you like as long as you do NOT introduce spaces.
B. Edit conf/_advanced.php and change the following variable to match what you renamed htsrv to in step #A. See example below.
| Code: |
* Location of the HTml SeRVices folder.
* @global string $htsrv_subdir
*/
$htsrv_subdir = 'htsrv'; // < -- change this
|
3. Using an .htaccess, fix it so your comments can ONLY be called locally. In other words, you are blocking them from being accessed remotely using a script on another server.
Details below:
here is captsolo's way (pasted from below) (verified to work):
| Code: |
# Fix for comments
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://yourdomain.net/.*$ [NC]
RewriteCond %{REQUEST_URI} ^.*comment_post\.php$
RewriteRule .* - [F]
|
...and mine.. works for me, may not for you..
| Code: |
RewriteCond %{HTTP_REFERER} "!^http://www.domain.org/.*$" [NC]
RewriteCond %{REQUEST_URI} ".*comment_post.php$"
RewriteRule .* - [F]
|
4. If you are interested in blocking referer spam, use an .htaccess to turn spam away by domain name.
Details below:
| Code: |
RewriteCond %{HTTP_REFERER} ^http://(www\.)?.*(-|.)cialis(-|.).*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?.*(-|.)forex(-|.).*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)adultactioncam(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)andrewsaluk(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)sexsearchcom(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)cumfiesta(.*)$ [NC,OR]
RewriteRule ^(.*) http://%{REMOTE_ADDR}/ [R=301,L]
|
5. Use the same .htaccess to turn away all of the spamming domains that are listed here: http://www.candygenius.com/spa...ns_raw.php
in the event the above page doesnt come up for you.. a snapshot of the old page is up at:
http://www.village-idiot.org/p-proxy/search.html
Details below:
| Code: |
RewriteCond %{HTTP:VIA} ^.+pinappleproxy [NC,OR]
|
6. Especially paranoid? Block ALL .info and .biz tlds in your .htaccess. Yes they spam alot.
| Code: |
RewriteCond %{HTTP_REFERER} \.us [NC,OR]
RewriteCond %{HTTP_REFERER} \.info [NC,OR]
|
7. Use a captcha. Details are here: http://forums.b2evolution.net/...ht=captcha
------------------------------------------------
An .htaccess that combines #s 4,5, and 6 above would look like this:
| Code: |
RewriteCond %{HTTP_REFERER} ^http://(www\.)?.*(-|.)cialis(-|.).*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?.*(-|.)forex(-|.).*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)adultactioncam(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)andrewsaluk(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)sexsearchcom(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)cumfiesta(.*)$ [NC,OR]
RewriteCond %{HTTP:VIA} ^.+pinappleproxy [NC,OR]
RewriteCond %{HTTP_REFERER} \.us [NC,OR]
RewriteCond %{HTTP_REFERER} \.info [NC] //
RewriteRule ^(.*) http://%{REMOTE_ADDR}/ [R=301,L]
|
And assumes you have enabled Apache's mod_rewrite in your .htaccess using the following:
| Code: |
RewriteEngine On
RewriteBase /
|
Apache docs on mod_rewrite: http://httpd.apache.org/docs/mod/mod_rewrite.html
Apache docs on using an .htaccess: http://httpd.apache.org/docs/howto/htaccess.html
-----------------
Remember what I said above about the comments within the code. Remove them, and be aware of fancy quotes too. (i think ive fixed them all though)
If something doesnt work after you have tried these things, come back and read this thread before you post .. there's a good chance its already covered in the rest of this thread. _________________
Do you use last.fm?
Try out my nifty badge generator!
Last edited by whoo on Wed Aug 17, 2005 3:36; edited 12 times in total |
|
| Back to top |
|
 |
mikel Seasoned Poster

Joined: 01 Feb 2004 Posts: 66
        
|
Posted: Sat Apr 02, 2005 4:36 Post subject: |
|
|
Thats great, whoo
thanks.
mikel _________________ Versen Geld geben?
mikelbower |
|
| Back to top |
|
 |
Nate Docs team

 Joined: 28 Jul 2004 Posts: 385
     
|
Posted: Sat Apr 02, 2005 10:58 Post subject: |
|
|
Thanks for this handy tutorial. Can you clarify what directory the .htaccess file should go in?
Thanks. |
|
| Back to top |
|
 |
whoo High Priestess

 Joined: 25 Dec 2004 Posts: 1293
  votes: 19
|
Posted: Sat Apr 02, 2005 11:14 Post subject: |
|
|
sure, nate ..
you may already have one in the "root" directory ( where index.php, mms.php, etc.. is ) of your blog install -- if not, thats where you would want to put it for all of the examples above to work.
a poorly formatted .htaccess is VERY unforgiving. One simple typo can render your site unavailable.
If you happen to mes up, and something "breaks", dont panic, just rename your .htaccess to something else, and take another look at the syntax you're using.
bold formatting == corrections _________________
Do you use last.fm?
Try out my nifty badge generator!
Last edited by whoo on Sat Apr 02, 2005 12:18; edited 1 time in total |
|
| Back to top |
|
 |
kiesow Hooked :)

Joined: 23 Jan 2004 Posts: 255
    
|
Posted: Sat Apr 02, 2005 11:16 Post subject: |
|
|
a short addition for ppl who can't use mod_rewrite.
it's also possible to stop spammer without it.
e.g.
| Code: |
setenvifnocase referer .glamour-models-gone-bad.biz ban
setenvifnocase referer texas-holdem ban
setenvifnocase referer texas-hold-em ban
setenvifnocase referer .free-poker.vpshs.com ban
setenvifnocase referer .world-poker-tour-1998.com ban
# Ban Formmail requests
setenvifnocase Request_URI formmail ban
# Ban .htaccess & .htpasswd requests
setenvifnocase Request_URI \.ht(access|passwd)$ ban
SetEnvIfNoCase Via pinappleproxy ban
<FilesMatch "^.*$">
order allow,deny
deny from env=ban
allow from all
</FilesMatch>
|
|
|
| Back to top |
|
 |
Nate Docs team

 Joined: 28 Jul 2004 Posts: 385
     
|
Posted: Sat Apr 02, 2005 11:45 Post subject: |
|
|
You mentioned _config.php being in the root directory of the blog. Mine is actually in the blogs/conf/ directory. So to further clarify, should the .htaccess file be in the root directory (in my case blogs/) or in the conf/ directory?
I'm asking because if I put the .htaccess code from your #3 above in my blogs/ directory I get an error. If I put it in the conf/ directory things keep running but I'm not sure it's doing anything either.  |
|
| Back to top |
|
 |
whoo ChairWoman

 Joined: 25 Dec 2004 Posts: 1293
  votes: 19
|
Posted: Sat Apr 02, 2005 12:17 Post subject: |
|
|
yes, i apologize.. I was actually looking on my hdd at the files as opposed to on the server.
To clarify:
the root of your blog install is NOT where your _config.php is .. It is where your mms.php, index.php, multiblogs.php, and others are. In fact, a newly unzipped b2evo has a sample.htaccess in the root directory already for you
---
As for the errors, I cant help there without more info. _________________
Do you use last.fm?
Try out my nifty badge generator!
|
|
| Back to top |
|
 |
captsolo Seasoned Poster

Joined: 19 Aug 2003 Posts: 70
       
|
Posted: Tue Apr 05, 2005 14:23 Post subject: |
|
|
Whoo, thanks for a comprehensive guide to spam prevention.
I had problems with part #3 - Apache rewrite engine going mad when it is entered into .htaccess. A fix for that:
| Code: |
# Fix for comments
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://captsolo.net/.*$ [NC]
RewriteCond %{REQUEST_URI} ^.*comment_post\.php$
RewriteRule .* - [F] |
Problems that I had:
1) the fancy quotes around the regexp strings turned into dots when copy/pasting
2) the comments after // were driving apache mad
3) in REQUEST_URI line the regexp should not begin with '*'
Now it works.  _________________ Best regards,
CaptSolo |
|
| Back to top |
|
 |
whoo Forum Mom

 Joined: 25 Dec 2004 Posts: 1293
  votes: 19
|
Posted: Tue Apr 05, 2005 21:11 Post subject: |
|
|
your welcome anytime! and thank you to you guys for helping to make this thread more informational  _________________
Do you use last.fm?
Try out my nifty badge generator!
|
|
| Back to top |
|
 |
frank New Poster

Joined: 24 Jun 2004 Posts: 14
  
|
Posted: Wed Apr 06, 2005 4:32 Post subject: |
|
|
Whoo, Captsolo: Maybe I'm getting confused here but I thought the .htaccess snippets I was using were for blocking referrer spam. Comment spam isn't a problem on my site, it's the .ro and .pl referrer spam coming via a proxy at marketscore.com that are driving my traffic through the roof.
F _________________ www.memetank.net/b2 |
|
| Back to top |
|
 |
frank New Poster

Joined: 24 Jun 2004 Posts: 14
  
|
Posted: Thu Apr 07, 2005 3:09 Post subject: |
|
|
Dear Whoo & Co,
I've come across another way of modifying the .htaccess file to prevent certain domains from making requests (i.e. getting referrers):
| Code: |
<Limit GET>
Order deny,allow
Deny from marketscore.com
Allow from all
</Limit>
|
Seems to have this function. Anyone know whether it would work?
F _________________ www.memetank.net/b2 |
|
| Back to top |
|
 |
whoo Forum Mom

 Joined: 25 Dec 2004 Posts: 1293
  votes: 19
|
|
| Back to top |
|
 |
whoo Forum Minion

 Joined: 25 Dec 2004 Posts: 1293
  votes: 19
|
Posted: Thu Apr 07, 2005 5:57 Post subject: |
|
|
here is a pretty good working example of an .htaccess
hopefully this will clear up general questions about how things work..
| Code: |
## Standard stuff
DirectoryIndex index index.html index.php index.cgi
RemoveHandler .pl
## Image redirects
Redirect permanent /newestpost.png http://www.village-idiot.org/stat-thingy/newestpost.php
Redirect permanent /newestpost10.png http://www.village-idiot.org/stat-thingy/newestpost10.php
Redirect permanent /whoo.jpg http://www.village-idiot.org/piccys/whoo.php
## User agents and Ips I dont like
SetEnvIf User-Agent ^BDFetch keep_out
SetEnvIf User-Agent ^curl keep_out
SetEnvIf User-Agent ^Wget keep_out
SetEnvIf User-Agent ^lwp keep_out
SetEnvIf User-Agent "Fetch\ API\ Request" keep_out
SetEnvIfNoCase User-Agent ".*\(compatible; MSIE 6\.0; Windows NT 5\.2; \.NET CLR 1\.1\.4322\)" keep_out
SetEnvIf Referer "^XXXX:" keep_out
order allow,deny
allow from all
deny from env=keep_out
deny from 82.55.69.126
## 403 file
<Files 403.shtml>
order allow,deny
allow from all
</Files>
## No .htacccess reading
<Files ~ "^\.ht">
Order allow,deny
Deny from all
Satisfy All
</Files>
## No reading my phpBB templates either
<Files ~ "\.tpl$">
Order allow,deny
Deny from all
Satisfy All
</Files>
## Enabling mod_rewrite
RewriteEngine On
RewriteBase /
## WordPress Stuff
RewriteRule ^archives/category/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed.php?category_name=$1&feed=$2 [QSA]
RewriteRule ^archives/category/?(.*) /index.php?category_name=$1 [QSA]
RewriteRule ^archives/author/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed.php?author_name=$1&feed=$2 [QSA]
RewriteRule ^archives/author/?(.*) /index.php?author_name=$1 [QSA]
RewriteRule ^archives/([0-9]{4})?/?([0-9]{1,2})?/?([0-9]{1,2})?/?([_0-9a-z-]+)?/?([0-9]+)?/?$ /index.php?year=$1&monthnum=$2&day=$3&name=$4&page=$5 [QSA]
RewriteRule ^archives/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([_0-9a-z-]+)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed.php?year=$1&monthnum=$2&day=$3&name=$4&feed=$5 [QSA]
RewriteRule ^archives/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([_0-9a-z-]+)/idiot/?$ /idiot.php?year=$1&monthnum=$2&day=$3&name=$4 [QSA]
RewriteRule ^feed/?([_0-9a-z-]+)?/?$ /wp-feed.php?feed=$1 [QSA]
RewriteRule ^comments/feed/?([_0-9a-z-]+)?/?$ /wp-feed.php?feed=$1&withcomments=1 [QSA]
## Comments only called from this server
RewriteCond %{HTTP_REFERER} "!^http://www.village-idiot.org/.*$" [NC]
RewriteCond %{REQUEST_URI} ".*vi-comment.php$"
RewriteRule .* - [F]
## I'm so tricky
RewriteCond %{REQUEST_URI} idiot\.php
RewriteCond %{REQUEST_METHOD} ^POST$
RewriteCond %{HTTP_USER_AGENT} ^Mozilla
RewriteRule ^.*$ - [F]
## Bad referers and pinapple start here
## Get the pinapple proxy first
RewriteCond %{HTTP:VIA} ^.+pinappleproxy [NC,OR]
## Bad TLDs not covered above
RewriteCond %{HTTP_REFERER} \.us [NC,OR]
RewriteCond %{HTTP_REFERER} \.info [NC,OR]
## Everyone else I hate
RewriteCond %{HTTP_REFERER} ^(.*)poker(.*)$ [OR]
RewriteCond %{HTTP_REFERER} ^(.*)adultactioncam(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)andrewsaluk(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)sexsearchcom(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)cumfiesta(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)welivetogether(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)bignaturals(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)firsttimeauditions(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)mikesapartment(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)terashells(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)milfhunter(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)inthevip(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)12.163.72.13(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)boysfirsttime(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)gradfinder(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)passions(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)outpersonals(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)iwantu(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)covert-call(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(.*)ro7kalbe(.*)$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?.*(-|.)texas-hold-em(-|.).*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?.*(-|.)isacommie(-|.).*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?.*(-|.)loan(-|.).*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?.*(-|.)ambien(-|.).*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?.*(-|.)cialis(-|.).*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?.*(-|.)forex(-|.).*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://miriam.camfun24.com$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://viagra.cn.mediavisor.com$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?.*(-|.)anal(-|.).*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?.*(-|.)pus*y(-|.).*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?.*(-|.)casino(-|.).*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?.*(-|.)teen(-|.).*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?.*(-|.)tits(-|.).*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?.*(-|.)tramadol(-|.).*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?houseofsevengables.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?.*(-|.)musicbox1(-|.).*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)*.dvdcopying.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)*.musicbox1.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?camgirlslive.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?latinonakedgirl.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?jardimed.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?1stcall.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?zoker9.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?dvd-squeeze.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?dvdsqueeze.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?alt.com.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?angeles2.com.*$ [NC]
## Where I want them to go
RewriteRule ^(.*) http://%{REMOTE_ADDR}/ [R=301,L]
|
Notice that you can have multiple sets of conditions that follow different rules.
ONE thing to remember is that the longer your list gets, the more work the server has to do.. and will slow down your server. Thats why its best to combine things.. the pinapple proxy thing kills off a whole ton of work for your server. I removed atleast 20 domains off my longer list after I added that. _________________
Do you use last.fm?
Try out my nifty badge generator!
|
|
| Back to top |
|
 |
whoo Boss Lady

 Joined: 25 Dec 2004 Posts: 1293
  votes: 19
|
Posted: Sun Apr 10, 2005 13:43 Post subject: |
|
|
yes, that does the same thing that the corresponding mod_rewrite rules do in the first post, your just applying it differently
cheers! _________________
Do you use last.fm?
Try out my nifty badge generator!
|
|
| Back to top |
|
 |
Bryce I New Poster

Joined: 06 Jan 2005 Posts: 7
  
|
Posted: Wed Apr 13, 2005 13:48 Post subject: |
|
|
| Thanks for this excellent information, whoo. |
|
| Back to top |
|
 |
|