iTools - A Beginner's Guide - Installing A Basic Message Board
by Terry Allen
Many people who have decided to run their own web server have usually done so for a variety of reasons. One of the common reasons is to expand an existing website that they have had on an ISP's free webspace as part of their ISP account. The move to being able to run your own scripts & other things on your server is great. Guestbooks are a commonplace script which people go for, as are message boards, which we're covering in this guide. As iTools runs under Mac OSX, which is a highly evolved *nix operating system, we're blessed with numerous things installed by default, including Perl & with iTools' implementation of Apache, a pretty solid webserver which can execute CGI scripts.
In times past, I recommended WWWBoard from Matt's Script Archive, but owing to the number of problems which have surfaced over the years with regard to security, I have instead begun to refer people to the excellent set of replacement scripts which were developed by the London Perlmongers, under the NMS project.
So, our first step today is to visit that website & download the latest version of the WWWBoard script, dropping it into the web directory of your chosen website. If you've read my past guides, you'll remember that I prefer to download the tarball (i.e. files ending with .tar.gz extensions), so grab that version. Once downloaded, navigate to that directory in your terminal, like so (assuming you've downloaded the file into your webserver directory):
# cd /Library/Tenon/WebServer/WebSites/yourdomain.com
We firstly need to expand the tarball using this command:
# tar zxvf wwwboard.tar.gz
Following this, you'll now see a few lines flash up & you'll have expanded the tarball into a directory called wwwboard. Now, navigate into that directory:
# cd wwwboard
Firstly, take a look through the ReadMe file which describes the various settings you can make within the WWWBoard script itself.
The first file you need to set is for the main display page of the message board, namely wwwboard.html. So, in the terminal, you need to set the permissions so that it can be read by anyone & written to by the owner & group (in this case, the webserver). Now, the ReadMe file states that the permissions should be 777, but for just a tiny bit of extra security, I set them at a slightly different setting, so:
# chmod 776 wwwboard.html
You can certainly edit the layour of this page, but there's no need to for the purposes of this guide. Head off to a browser & check that you can view your new page by simply calling up the URL that it should be (i.e. http://yourdomain.com/wwwboard/wwwboard.html) - it should look like this:
Not a great deal to go here, but we must configure the script itself now & also the admin tool, so from the command line, we have to issue this:
# pico wwwboard.pl
Quite near the top of the file, there's a section marked 'User Configuration Section', which is quite short - the variables which need editing are well explained in the ReadMe file, but we only need to edit a few lines for a basic installation - navigate your way down the file, carefully reading the notes along the way & of course refer to the ReadMe file - the lines you need to edit are outlined here, with the changes made, so adjust the settings as appropriate for your server:
$emulate_matts_code = 0;
Once you changed the lines to appear similar to that above, change any other settings you might want to & then Control-X to exit Pico & of course make sure you save the changes you've made. Now it's okay to leave the setting $emulate_matts_code to it's original setting of 1, but you run the risk of some minor security hazards as well as some problems within the original Perl code for the original WWWBoard. Consequently, it's on your own head (as it always should be) if your system isn't up to scratch in the security department.
Now we're ready to move the script into it's new home in your server's CGI-BIN, so off we go:
# mv wwwboard.pl /Library/Tenon/WebServer/cgi-executables/
To allow the script to run correctly as a CGI, we need to set it's permissions correctly too:
# chmod 755 wwwboard.pl
Assuming you've been following along correctly up to here, you should be set to post a message, so, load up the wwwboard.html file in your browser, called from the URL like so:
You should see that exact page we saw earlier, so fill out the form & post a test message, click the 'Post Message' button & Voila! you should see something like this:
Now, click on the link that says NMS WWWBoard Version & you should see the Message Board page updated with your test message, so we're done on that front, but we're really only halfway there, as there's the administration script yet to get working so that you can remove messages etc..., so it's back to the command line for you. Navigate back to the wwwboard directory you have set up & enter this:
# pico wwwadmin.pl
Now, there are very few lines to edit here & you'll notice that we again need to change these lines in that file:
$emulate_matts_code = 0;
Control-x once again & save your file upon exiting, then move the file to your cgi-bin in exactly the same manner as before:
# mv wwwadmin.pl /Library/tenon/WebServer/cgi-executables/
We must set the permissions for this script as well, so:
# cd /Library/tenon/WebServer/cgi-executables/
Now you're pretty much all the way there, with the exception of setting the permissions on the passwd.txt file which is contained within your wwwboard directory, so navigate back into the wwwboard directory & set the permissions:
So, go for it & load up the admin script in your browser like this:
http://yourdomain.com/cgi-bin/wwwadmin.pl - you should see a screen something like this:
Now don't forget to change the password for the board - the initial password, which are outlined in the Admin script's ReadMe are: WebAdmin & WebBoard for the password. That should be your first port of call.
So now you're done, you can delete the messages you may have done some testing with & get on with customising the look & feel of your message board. Good luck with it.
About the only real difficulty with getting WWWBoard running is that you must make sure that both the paths & permissions are correctly set. If you don't, you'll see errors start to appear in your web logs & things won't be working as expected. I'd also suggest that you change the location of the password file in your admin script as well as the actual location of the file, for just a little added security.
Not many traps with WWWBoard, but the main gripe is that it's very difficult to stop people spamming, beause there are no controls to stop people posting & you don't know who's actually posting. There are modification versions of the origina WWWBoard hanging around various locations on the web, which utilise blocking for keywords etc..., but these are not foolproof. You may like to move onto something a little more advanced after experimenting with getting this running.