DJabberd AD Authen

Created 2006-06-27 / Edited 2006-11-19

Tags: Perl, Code, SWCA, DJabberd, AD

On Tuesdays I work from home for SWCA (my current employer). This gives me a chance to do code without being interrupted every 15 minutes by random things. Lately I've been working on the code behind our website re-design, which is pretty interesting. Today, however, I took an hour or two to set up a better Jabber server.

Up until now we've been using the more or less "default" jabber server provided by It is horrible to configure... I can generally figure out how to make things work, but couldn't for the life of me get conferencing going.

Then bright and early this morning I gave DJabberd another try. A previous half-hearted attempt had failed, but this time it worked wonderfully! I started with SixApart's example server, and then tweaked from there. It authenticates off of our Active Directory, and automatically adds all users who have logged in once to everyone else's buddy list. Now I only need to get the SSL certs working.

So I'm now doing Active Directory authentication in a couple places. I've made use of the cpan:Authen::Simple::ActiveDirectory module, which is fantastic. Authentication is as easy as:

use Authen::Simple::ActiveDirectory;

# ... given plaintext $user and $pass ...

  my $auth = Authen::Simple::ActiveDirectory->new(
    host => '',
    principal => ''
  if($auth->authenticate($user,$pass)) {
  } else {

Perhaps even cooler is that the minimal interface to cpan:Authen::Simple makes it simple to swap out other authentication methods.