Skip to content

Setting up mediawiki with LDAP authentication

Jakob Garde edited this page Jan 27, 2016 · 10 revisions

First, install required packages using:

$ apt-get install mediawiki mediawiki-extensions-base mediawiki-extensions-collection mediawiki-extensions-ldapauth mediawiki-extensions-math mediawiki-math-texvc

Next, create a location entry in your nginx configuration, e.g.

	location /mediawiki {
		alias /srv/mcweb/mediawiki;
	}

Perform the standard mediawiki web-installation by visiting e.g. http://mcstas-01.risoe.dk/mediawiki and generate a LocalSettings.php.

Insert the following lines to enable LDAP auth:

# LDAP
require_once 'extensions/LdapAuthentication/LdapAuthentication.php';
require_once 'includes/AuthPlugin.php';
$wgAuth = new LdapAuthenticationPlugin();
$wgLDAPDomainNames = array(
  'mediawiki_risoe_dk',
);
$wgLDAPServerNames = array(
  'mediawiki_risoe_dk' => 'localhost',
);
$wgLDAPUseLocal = false;
$wgLDAPEncryptionType = array(
  'mediawiki_risoe_dk' => 'clear',
);
$wgLDAPPort = array(
  'mediawiki_risoe_dk' => 389,
);

$wgLDAPSearchAttributes = array(
  'mediawiki_risoe_dk' => 'uid'
);
$wgLDAPBaseDNs = array(
  'mediawiki_risoe_dk' => 'dc=risoe,dc=dk',
);

IMPORTANT!!! On Debian 8, one needs to make a local change to the mediawiki source, see https://www.mediawiki.org/wiki/Topic:Sl9i17el9a1g9tv1 :-(( (rtrim -> trim close to line 600 in mediawiki/extensions/LdapAuthentication/LdapAuthentication.php ) (jaga 20160127: This fix is included in R1_26 (LdapAuthentication-REL1_26-70ab129.tar.gz).) For debugging purposes theses extra localsetting lines are handy:

$wgDebugLogFile = '/srv/mcweb/mediawiki-logfile.log';
$wgDebugLogGroups['ldap'] = '/srv/mcweb/mediawiki-logfile.log';
$wgLDAPDebug = 3;

error_reporting( -1 );
ini_set( 'display_errors', 1 )
Clone this wiki locally