MTBlackList
Question
How can I use a black list to automatically block wiki spammers from using my site in an attempt to increase their Google pagerank?
Answer
Category: Security
The Attach:mt-blacklist.php script uses a black list to help control wiki spam. This list contains hundreds of partial urls (now thousands) that can now be blocked automatically. To use the script, simply copy it into the cookbook/ directory (or local/ in pmwiki1) and then add the line
if ($action=='edit') include_once('cookbook/mt-blacklist.php');
to the local/config.php file.
When activated, mt-blacklist.php checks to see how old its copy of the black list files are and automatically downloads newer versions if out of date. It then scans the message for all of the regular expressions found in the file.
If you do not make changes to the mt-blacklist.php file it will try to put the blacklist files into the same directory where you started php (usually the same place as pmwiki.php). To set the directory for blacklist files find the $arcDir variable and set it to point to the cookbook directory (or the directory containing the mt-blacklist.php file or any other directory you want). Remember that this variable is inside of function check_Blacklist so you must declare any global variable used or it will not work:
global$FarmD
; $arcDir = "$FarmD
/cookbook/";
Black Lists Supported
Movable Type Spam Black List - http://www.jayallen.org/comment_spam/- Removed 10/24/2005- chongqed.org Black List - http://www.chongqed.org/
- MoinMaster - http://moinmaster.wikiwikiweb.de/BadContent?action=raw
Notes and Comments
Version 1.0 - Initial Release
Version 1.1 - 04/28/2005
- Changed to case insensitive search (this should catch a BUNCH more links)
- Added E-mail notification of blocks
- Added compatibility with Cookbook.Blocklist
- Added time delay for "bad" links (tie up the sender for x seconds)
Version 1.2 - 07/19/2005
- Added support for adding other black lists
- Added support for the chongqed.org blacklist
Version 1.21 - 07/20/2005
- Modified report to include number of matched expressions and number of matches.
Version 1.22 - 08/01/2005
- Added archive file path configuration.
Version 1.3 - 08/23/2005
- Improved compatibility with PMWiki 2
- Fixed "Save and Edit" bypass of script
- Fixed error where ok URL's were blocked
Version 1.31- 08/29/2005
- Added improved detection of encrypted strings
Version 1.4 - 10/24/2005
- Removed link to MT-Blacklist
Version 1.5 - 08/21/2006
- Added support for pmwiki-2.1.14 (Thanks John Bittner?)
- Added the MoinMaster Block List
Feedback
2005/07/15: I have communicated to Wendell about this. I was getting wikispam and installed MT-Blacklist, and turned on UrlApprovals at the same time. When I tried to "save" an edited page, some PHP messages about "headers" flashed by. Things seemed to work, though. Wendell couldn't diagnose without going deeper into what I had done, so I'm going to try to stay with UrlApprovals for now, and will check in later to see if anyone else has discovered similar issues. David Ing
2005/08/01: Please note that the archive files are saved in the PARENT of the cookbook directory. This means that you will need to make sure that this directory is writable (or change the base path of the file to a directory that IS writable). Use the $arcDir variable to change the default directory.
2005/08/02: This script seems to check only links inserted into your pages versus Blocklist2 which checks words and IP address.
2005/08/02: It is not clear what is meant by '$lockTime = 10' Change this to the number of seconds to wait - to wait for what?
2005/10/16: In order to get this to work, I had to remove the following line:
- 'MT-Blacklist' => 'http://www.jayallen.org/comment_spam/blacklist.txt',I guess the MT blacklist is out of service, and this give the script hiccoughs. The other blacklist is still working, so the script is worth fixing. Jason Grossman
2006/08/20: Using pmwiki-2.1.14 the message "This post has been blocked by the administrator" was not displaying. To fix this I put
global$MessagesFmt
;$MessagesFmt
[] = $EditMessageFmt;
$MessagesFmt
array, which can be displayed using the (:messages:) markup. [ ] The transition script takes care of moving messages between $EditMessageFmt and $MessagesFmt
as need to preserve correct operation. John Bittner? 08 21 2006 1:10 am CST
See Also
- Cookbook.Blocklist2
- Cookbook.BlackList
- Another page mentions creating a "master" PmWiki. Security page .