Home
Blog
Tech How To
Jobs

Integrate MediaWiki with Open LDAP

First make sure you have php4-ldap. If you get a blank screen after logging in, please check to make sure php4-ldap exists. You'll need to bounce apache after the package is installed

  # aptitude is a nicer front end on apt-get
  sudo aptitude install php4-ldap
  sudo /usr/sbin/apache2ctl graceful

Then download LdapAuthentication.php from here and put it in /usr/share/mediawiki/



Next edit /etc/mediawiki1.5/LocalSettings.php and add the following to the end of the file. Don't forget the change the root dc settings (change example, org, localhost to your settings)

  require_once( 'LdapAuthentication.php' );
  $wgAuth = new LdapAuthenticationPlugin();
  $wgLDAPDomainNames = array( "example.org" );
  $wgLDAPServerNames = array( "example.org"=>"localhost"  );
  $wgLDAPSearchAttributes = array( "example.org"=>"uid" );
  $wgLDAPBaseDNs = array( "example.org"=>"dc=example,dc=org" );
  $wgLDAPUseSSL = false;
  $wgLDAPUseLocal = false;
  $wgLDAPAddLDAPUsers = false;
  $wgLDAPUpdateLDAP = false;
  $wgLDAPMailPassword = false;
  $wgLDAPRetrievePrefs = false;
  $wgMinimalPasswordLength = 1;

Finally you'll need to add a WikiSysop user to LDAP. Which is a little tricky because WikiSysop isn't a real user.

  dn: ou=applications,dc=example,dc=org
  objectClass: top
  objectClass: organizationalUnit
  ou: applications
  
  dn: uid=WikiSysop,ou=applications,dc=example,dc=org
  uid: WikiSysop
  cn: WikiSysop
  userPassword: secrete
  objectClass: shadowAccount
  objectClass: simpleSecurityObject
  objectClass: applicationProcess

Now try to log in. No need to bounce anything it should just work!