« ATV trip across Kenosha Pass | Main | Overlay GPS Tracks onto USGS Topographical maps »

July 5, 2005

Installing MT-Blacklist 2.04 beta under Windows XP SP2

MT-Blacklist is a Movable Type plugin to eradicate comment and trackback spam created by Jay Allen. I'm running Movable Type 3.17, so I downloaded the most current version of MT-Blacklist, the 2.04-beta version.

Although the MT-Blacklist_README.txt that is extracted indicates you need to be running "A Unix-based server", this post leads me to believe it will run under Windows XP, as I'm running MT 3.17.

INSTALLATION

Before installing MT-Blacklist, you should first check whether your server supports background tasks. Background tasks are required for use of the Master Blacklist auto-update feature as well as to enhance performance of many slow operations (e.g. despamming and importing other blacklists).

If these things are important to you (and they should be), you should do the following before installing MT-Blacklist:

1) Run the script mt-testbg.cgi which is included in your main MT distribution.

OK. So, to run this script, I go to http://www.peeniewallie.com/mt/mt-testbg.cgi with my Firefox browser.

The results I get are as follows:

If you see only one number below, or if you see two and they match, you should add the line

LaunchBackgroundTasks 0

to the file mt.cfg.
-------------------
[1908]
[-3192]

So, apparently, I passed the test and my server supports background tasks.

2) If your server supports background tasks (i.e. it passes #1), open your mt.cfg and change LaunchBackgroundTasks from 0 to 1.

3) Save and upload mt.cfg.

So, I edited my mt.cfg file as follows:

LaunchBackgroundTasks 1

4) Continue with instructions below.


Extracting Program Files

Program files: Unpack the archive and upload to proper locations as laid out in the archive. You will be creating (or uploading) a 'Blacklist' directory in the MT_DIR/plugin directory.

Static files: mt-blacklist-styles.css and mt-blacklist.js should go in the root of your MT static directory (which is your MT directory unless you've changed it in the mt.cfg file. It's where your MT images and docs directories are) and you will create (or upload) a Blacklist directory in your MT_STATIC_DIR/images directory.

Extras: The contents of the EXTRAS directory is optional. It contains another directory named 3.1 which contains the new header.tmpl file. Upload the file to your MT_DIR/tmpl/cms directory. This will overwrite the default header.tmpl file so you may want to make a backup first.

So, I extracted and copied the files into the correct directories. Because I didn't set up a separate 'static' directory in my mt.cfg, basically this involved the following:

1) copying the images\Blacklist folder under my main MT directory.
2) copying the plugins\Blacklist folder under my main MT directory.
3) copied mt-blacklist-styles.css and mt-blacklist.js into my main MT directory.
4) Renamed my existing tmpl/cms/header.tmpl file to header_old.tmpl
5) Copied in the new tmpl/cms/header.tmpl.


INITIALIZATION

First of all, you should back up your database if you know how. The MT-Blacklist initialization routines modify your MT database by adding a few extra tables. With the exception of the addition of one row to the mt_plugindata table, your current MT tables are not modified at all. However, it is always better to be safe than sorry.

Export the Movable Type entries from within Movable Type

Use Movable Type's Export to back up your database. (Select IMPORT/EXPORT from the Utilities menu in Movable Type.) Here, I prefer to use the Internet Explorer browser so that I can hold down the CTRL key and click on the link that says "Export Entries From Peenie Wallie". It then prompts you for a file name. I saved my backup to E:\_backup\movable_type_exports\peeniewallie_backup_IE_070505.txt. My file size is 1.7 megs. You can open this text file with any text editor and verify that it contains you web site data. (It's somewhat cryptic though, as special characters are masked, etc.)


Backup up the MySQL database

A Simple Database Backup: You can use mysqldump to create a simple backup of your database using the following syntax.

mysqldump -u [username] -p [password] [databasename] > [backupfile.sql]

o [username] - this is your database username
o [password] - this is the password for your database
o [databasename] - the name of your database
o [backupfile.sql] - the file to which the backup should be written.

I wasn’t sure what my database name was, so I searched for my mt.cfg file and opened it.


ObjectDriver DBI::mysql
Database pw
DBUser root
DBHost localhost

So, I ran this from the command prompt:

mysqldump -uroot –pfoxtrot pw > E:\_backup\MySQL_backup\pw_070505.sql

This ran really fast, but created a 1.5 meg file which appears to contain valid SQL for dropping and creating tables, etc. I also found all of the text from my web page in one of the tables named mt_entry. So, although all of my .html files are stored in the folders in Windows Explorer, they’re also stored in the database in the mt_entry table. All of the templates are stored in a table named mt_template.

Run MT-Blacklist Load

run mt-bl-load.cgi

So, I pointed my Firefox browser to http://www.peeniewallie.com/mt/plugins/Blacklist/mt-bl-load.cgi


If it the mt-bl-load.cgi script runs successfully, you should see something like this.

You should now remove mt-bl-load.cgi. Failure to do so introduces a major security risk.

CONFIGURATION

Once you've initialized and removed mt-bl-load.cgi, click on the link on the resulting page to configure your setup. There are help links near most options in the configuration and elsewhere throughout the program. Unfortunately, not all of the help documentation has been written yet, so be patient. Most things are self-explanatory.


So, I clicked on the "Start Using MT-Blacklist!" link and it launched the MT-Blacklist.cgi program, but just sort of hung there with an hour glass. Then, I noticed this little message just below:

NOTE: If background tasks are turned on, you first execution of MT-Blacklist may take a long time to initialize while the master blacklist is being downloaded and parsed. Please be patient.

After some time, however, it came back with an Alert that "www.peeniewallie.com/mt/plugins/blacklist/mt-blacklist.cgi could not be found. Please check the name and try again." The only thing I could spot as wrong was the folder name should be "Blacklist" not "blacklist".

I'm not sure why it gave me this error, as I checked the link properties and they were correct (http://www.peeniewallie.com/mt/plugins/Blacklist/mt-blacklist.cgi). So, I just pasted this into my browser, and it launched the MT-Blacklist application.


So, in the top right corner is a pink box that says "MT-BLACKLIST IS INACTIVE. You can activate from the sitewide configuration page."

Unfortunately, for any link that I click on, I get "The directory name is invalid." So, I'm not clear what the deal is. There are all of these '%5C' character strings interspersed into my URL's. So, this is probably a bug that only affects Windows.

But, I figured out that I could hammer in the correct URL to get it to work. So, for instance, this:

http://www.peeniewallie.com/mt/plugins/Blacklist/%5Cmt%5Cplugins%5CBlacklist%5Cmt-blacklist.cgi?__mode=cfg_master

becomes this:

http://www.peeniewallie.com/mt/plugins/Blacklist/mt-blacklist.cgi?__mode=cfg_master

On this screen, I clicked on the "Active" radio button and clicked on "Save Configuration" at the bottom. Unfortunately, it doesn't save my settings though. I just get directed to the bad URL:http://www.peeniewallie.com/mt/plugins/Blacklist/%5Cmt%5Cplugins%5CBlacklist%5Cmt-blacklist.cgi
and get the ubiquituous error "The directory name is invalid."

So, I posted this error on one of the MT-Blacklist forums.

I was directed to this post which points out some known issues with running MT-Blacklist on a Windows server.

According to Tweezerman's (David Phillips') directions, you need to modify the following two Perl modules to get MT-Blacklist to function on a Windows Server.


  • mt\plugins\Blacklist\Blacklist.pl

  • mt\plugins\Blacklist\lib\Blacklist\App.pm

So, I created backup copies of each of these programs, and then modified them as follows:

Blacklist.pl

Change line 43 from this:
return 1 unless ($0 =~ m/($adminscr|$commentscr|$tbscr)/);

to this:
return 1 unless ($scriptname =~ m/($adminscr|$commentscr|$tbscr)/);

and then insert this line immediately before line #43:
my $scriptname = Win32::GetLongPathName($0);

App.pm

Replace line 615:
sub bluri { File::Spec->catdir($_[0]->blpath,$_[0]->blscript) }

with these lines:
sub bluri {
my $uri = File::Spec->catdir($_[0]->blpath,$_[0]->blscript);
$uri =~ s!\\!/!g;
$uri;}

Save the two programs, and MT-Blacklist should now work correctly under windows.

To launch it, run the mt/plugins/Blacklist/mt-lacklist.cgi program. If it works, you should see something like this.

In the top right corner is a pink box that says "MT-BLACKLIST IS INACTIVE. You can activate from the sitewide configuration page."

Click on the link to go to the sitewide configuration page and click on the "Active" radio button for the "MT-Blacklist Master Switch" and then click on the "Save Configuration" link at the bottom of the page.

To verify that it is working, click on BLACKLIST LOG under the Utils & Info menu, and you should see something like this.

Whoo hoo! It's working. It's blocking those r@t b@stards hawking the "texas-holdem" poker games! Yeah!

Many thanks to Jay Allen at Six Apart and JayAllen.org for creating this excellent plug-in and to David Phillips(Tweezerman) of The Tweezer's Edge for forcing it to run under Windows XP.

If you have problems, I would suggest logging them at the MT-Blacklist installation/upgrade forum.

My Environment:
O/S: Windos XP Professional SP2
Web Server: Internet Information Services(IIS) 5.1
Database: MySQL 2.9004
Scripts: ActivePerl 5.8.6.811
Blog: Movable Type 3.17
Plugins: MT-Blacklist 2.04 beta
NoFollow 3.17


Update: After checking the activity log, I found some MT-Blacklist error messages in the log that I believe were related to the installation of SpamLookup.

Posted by Peenie Wallie on July 5, 2005 at 9:21 PM