Using PMWiki with UW NetID authentication

Advertisements

I have not been a big fan of wikis – some of the projects I’ve been associated with have used wikis for managing lots of project information, and they always seem subject to the digital equivalent of southern California suburban sprawl – pages proliferate beyond any control, and it’s very hard to keep a grasp on where the current discussion is within all those pages.

But lately I’ve been working on a couple of projects that call for some collaborative editing, so I thought I’d try out using a wiki.

I went looking for a lightweight wiki to install on my UW staff web publishing account. I was hoping to find something that was easy to install and worked within the file system, without requiring the support of a database. I also wanted a wiki that has an active community around it, and one that might have a hope of integrating with UW NetIDs. Doing a completely non-scientific and not comprehensive survey by browsing the Wikipedia article Comparison of wiki software, I decided to try Patrick Michaud’s PMWiki.

After a few hours over three days of tinkering, I now have PMWiki installed and working under UW NetID authentication on staff.washington.edu. My current setup requires everyone who wants to view my wiki to do a UW NetID authentication first, and any editing or authoring of content has that UW NetID recorded as the author. I’ve been very pleased by the quality of the documentation – the install is straightforward, and there’s a great Cookbook full of all sorts of “recipes” for how to accomplish different things with PMWiki.

I make no claim for this being the best wiki in the world, nor do I know if every function will work with the UW NetID stuff, but it’s at least good enough for my current purposes.

At some point we may very well put some instructions on how to accomplish this on the Do It Yourself section of Creating and Publishing Web Pages, but if you’re interested in how I did it, read on.

Basically to install PMWiki, I followed the excellent installation instructions

First I downloaded the latest version of PMWiki into my web publishing space. Working from a terminal window logged into my public_html directory, I used this command:

 wget http://www.pmwiki.org/pub/pmwiki/pmwiki-latest.zip

Then I unzipped the software – the unzip process automatically created a directory named pmwiki-2.1.beta25 and placed all the files and subdirectories within it:

unzip pmwiki-latest.zip

Then, for ease of reference, I created a symbolic link (that’s like an alias) to that directory called pmwiki:

ln -s pmwiki-2.1.beat25 pmwiki

That was enough to get PMWiki running on my account at http://staff.washington.edu/oren/pmwiki/pmwiki.php

Following the instructions on the Initial Setup Tasks page I then started editing (using pico, of course) a config.php file in pmwiki/local to get the configuration options I wanted to start with. I’ve done just the bare minimum of configuration for my purposes – I gave the wiki a title (Oren’s wiki) and gave it an administrative password.

Then, following the instructions for Password Protection by UW NetID, I put a .htaccess file into my pmwiki directory that requires a valid UW NetID login for all users of any part of the wiki – whether viewing or editing.

Then, using the Cookbook recipe for RequireAuthor I changed the config file (pmwiki/local/config.php) to automatically set the author name to the HTTP authenticated user (in this case the UW NetID).

That worked ok yesterday, but overnight a new (more secure) version of PubCookie (the software used by the web servers for UW NetID authentication) went into production, and this morning my wiki couldn’t find any of its formatting information. It turns out that I had to explicitly set the ScriptUrl and PubDirUrl paths to use https instead of plain http.

So in the end, I ended up with a config.php file that looks like this:

&lt?php if (!defined(‘PmWiki’)) exit();
$WikiTitle = “Your wiki name here”;
$DefaultPasswords[‘admin’] = crypt(‘YourPasswordHere’);

# $ScriptUrl is your preferred URL for accessing wiki pages
# $PubDirUrl is the URL for the pub directory.
$ScriptUrl = ‘https://staff.washington.edu/oren/pmwiki/pmwiki.php’;
$PubDirUrl = ‘https://staff.washington.edu/oren/pmwiki/pub/’;

## Require an author name.
$EnablePostAuthorRequired=’1′;

## If no $Author is set, set it to the authenticated user name
if ($action == ‘edit’ && !@$_COOKIE[‘author’]) {
if (@$_SERVER[‘REMOTE_USER’]) {
$Author=@$_SERVER[‘REMOTE_USER’];
setcookie(‘author’,$Author,0,’/’);
}
}
?&gt

2 thoughts on “Using PMWiki with UW NetID authentication”

  1. Thanks Oren! I was having trouble with pmWiki and UW NetID. I changed my config.php file as you indicated and it seems to work.

    Like

  2. This configuration will automatically put the REMOTE_USER into the Author field of an edit, but the field can still be edited by the user.

    You can stop users from editing the Author field from the REMOTE_USER by removing

    “&& !@$_COOKIE[‘author’]”

    from the conditional.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s