Testwiki: Difference between revisions

From NURDspace
No edit summary
mNo edit summary
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Inventory
{{Inventory
|InventoryOwner=User:FwD
|Owner=User:FwD
|InventoryStatus=Working
|Status=Unknown
|InventoryHostname=testwiki.nurdspace.lan
|Hostname=testwiki.nurdspace.lan
|InventoryLocation=Proxmox1
|Location=Confusion
|Tool=No
}}
}}
On this VM I'll create a duplicate of the actual [[Wiki]] to test how hooking it up to the [[LDAP]] will turn out.
On this VM I'll create a duplicate of the actual [[Wiki]] to test how hooking it up to the [[LDAP]] will turn out.
Line 21: Line 22:
** Use the [http://www.mediawiki.org/wiki/Extension:LDAP_Authentication/Configuration_Options#Proxied_or_search_based_bind_options read-user] for the lookups and enable [http://www.mediawiki.org/wiki/Extension:LDAP_Authentication/Configuration_Options#Group_options $wgLDAPLowerCaseUsername]
** Use the [http://www.mediawiki.org/wiki/Extension:LDAP_Authentication/Configuration_Options#Proxied_or_search_based_bind_options read-user] for the lookups and enable [http://www.mediawiki.org/wiki/Extension:LDAP_Authentication/Configuration_Options#Group_options $wgLDAPLowerCaseUsername]
** Try [http://www.mediawiki.org/wiki/Extension:LDAP_Authentication/Changelog#v2.0a $wgLDAPLowercaseUsernameScheme] (requires all lowercase users in LDAP, which is currently not the case)
** Try [http://www.mediawiki.org/wiki/Extension:LDAP_Authentication/Changelog#v2.0a $wgLDAPLowercaseUsernameScheme] (requires all lowercase users in LDAP, which is currently not the case)
* Turns out $wgLDAPLowerCaseUsername does more than advertised, it converts input usernames completely to lowercase. However, now the theme starts bugging:
* Turns out $wgLDAPLowerCaseUsername does more than advertised, it converts input usernames completely to lowercase. However, now the skin starts bugging:
  [Sat May 25 15:45:32 2013] [error] [client 192.168.1.9] PHP Strict Standards: Only variables should be passed by reference in /var/www/skins/GuMax.php on line 172, referer: http://testwiki.nurdspace.lan/index.php5?title=Special:UserLogin&returnto=Main+Page
  [Sat May 25 15:45:32 2013] [error] [client 192.168.1.9] PHP Strict Standards:
  Only variables should be passed by reference in /var/www/skins/GuMax.php on line 172,
  referer: http://testwiki.nurdspace.lan/index.php5?title=Special:UserLogin&returnto=Main+Page
* and it still won't log in with a correct userdn:
2013-05-25 15:56:26 testwiki nurdspace_wiki: 2.0d Failed to bind as uid=fwd,ou=people,dc=nurdspace,dc=lan
2013-05-25 15:56:26 testwiki nurdspace_wiki: 2.0d Entering strict.
* With lots of help from [[User:Cha0z97|Cha0z97]] it's now working! Users in the group 'wikiusers' can log in. Admins, bureaucrats and sysops are locally managed.
* Full addition to LocalSettings.php:
#LDAP Auth
require_once( "$IP/extensions/LdapAuthentication/LdapAuthentication.php" );
$wgAuth = new LdapAuthenticationPlugin();
$wgLDAPDebug = 9;
$wgDebugLogGroups['ldap'] = '/tmp/debug.log';
$wgLDAPDomainNames = array( 'nurdspace.lan', );
$wgLDAPServerNames = array( 'nurdspace.lan' => 'ldap.nurdspace.nl', );
$wgLDAPUseLocal = false;
$wgLDAPEncryptionType = array( 'nurdspace.lan' => 'ssl', );
$wgLDAPSearchStrings = array( 'nurdspace.lan' => 'uid=USER-NAME,ou=people,dc=nurdspace,dc=lan', );
$wgLDAPLowerCaseUsername = array( 'nurdspace.lan' => true );
$wgLDAPRequiredGroups = array( 'nurdspace.lan' => array( 'cn=wikiusers,ou=groups,dc=nurdspace,dc=lan', ) );
$wgLDAPGroupUseFullDN = array( "nurdspace.lan"=>false );
$wgLDAPGroupObjectclass = array( "nurdspace.lan"=>"posixGroup" );
$wgLDAPGroupAttribute = array( "nurdspace.lan"=>"memberUid" );
$wgLDAPGroupSearchNestedGroups = array( "nurdspace.lan"=>false );
$wgLDAPGroupNameAttribute = array( "nurdspace.lan"=>"cn" );
$wgLDAPBaseDNs = array( "nurdspace.lan"=>"dc=nurdspace,dc=lan" );
$wgLDAPUseLDAPGroups = array( "nurdspace.lan"=>true );
$wgGroupPermissions['wikiusers']['edit'] = true;
$wgGroupPermissions['admins'] = $wgGroupPermissions['sysop'];
# This hook is called by the LdapAuthentication plugin. It is a configuration hook. Here we
# are specifying what attibute we want to use for a username in the wiki.
# Note that this hook is NOT called on a straight bind.
# The hook calls the function defined below.
$wgHooks['SetUsernameAttributeFromLDAP'][] = 'SetUsernameAttribute';
 
Some settings might not be necessary, such as the wgGroupPermissions and wgHooks. I'll do some experimenting to see if it can be cleaned up.
 
* What needs to be done when installing is execute the .sql file that comes with the LdapAuthenticate extension:
mysql -uwikiuser -pgodver nurdspace_wiki < /var/www/extensions/LdapAuthentication/ldap.sql
* This will create a table that is needed by the extension. I should execute it by itself at first run, however, it does not.
 
 
 
= Todo =
* It seems renaming/merging users can cause some problems. In the testwiki 2 users have disappeared after renaming and merging them.
* While looking for errors regarding the disappearing users I came across some other errors in the Apache logging:
[Wed May 29 18:22:18 2013] [error] [client 192.168.1.103] PHP Notice:  Undefined offset: 0 in /var/www/extensions/
  LdapAuthentication/LdapAuthentication.php on line 1711, referer: http://testwiki.nurdspace.lan/index.php5?title=Special:UserLogin&returnto=Main+Page
[Wed May 29 18:22:18 2013] [error] [client 192.168.1.103] PHP Notice:  Undefined offset: 0 in /var/www/extensions/
  LdapAuthentication/LdapAuthentication.php on line 1712, referer: http://testwiki.nurdspace.lan/index.php5?title=Special:UserLogin&returnto=Main+Page
[Wed May 29 18:22:18 2013] [error] [client 192.168.1.103] PHP Notice:  Undefined offset: 0 in /var/www/extensions/
  LdapAuthentication/LdapAuthentication.php on line 1736, referer: http://testwiki.nurdspace.lan/index.php5?title=Special:UserLogin&returnto=Main+Page
[Wed May 29 18:22:18 2013] [error] [client 192.168.1.103] PHP Notice:  Undefined offset: 1 in /var/www/extensions/
  LdapAuthentication/LdapAuthentication.php on line 1743, referer: http://testwiki.nurdspace.lan/index.php5?title=Special:UserLogin&returnto=Main+Page
[Wed May 29 18:22:18 2013] [error] [client 192.168.1.103] PHP Notice:  Undefined offset: 0 in /var/www/extensions/
  LdapAuthentication/LdapAuthentication.php on line 1711, referer: http://testwiki.nurdspace.lan/index.php5?title=Special:UserLogin&returnto=Main+Page
[Wed May 29 18:22:18 2013] [error] [client 192.168.1.103] PHP Notice:  Undefined offset: 0 in /var/www/extensions/
  LdapAuthentication/LdapAuthentication.php on line 1712, referer: http://testwiki.nurdspace.lan/index.php5?title=Special:UserLogin&returnto=Main+Page
[Wed May 29 18:22:18 2013] [error] [client 192.168.1.103] PHP Notice:  Undefined offset: 0 in /var/www/extensions/
  LdapAuthentication/LdapAuthentication.php on line 1736, referer: http://testwiki.nurdspace.lan/index.php5?title=Special:UserLogin&returnto=Main+Page
[Wed May 29 18:22:18 2013] [error] [client 192.168.1.103] PHP Notice:  Undefined offset: 1 in /var/www/extensions/
  LdapAuthentication/LdapAuthentication.php on line 1743, referer: http://testwiki.nurdspace.lan/index.php5?title=Special:UserLogin&returnto=Main+Page
 
 
 
= Relevant files to get this working =
* /var/www/LocalSettings.php - Mediawiki settings file with added ldap authentication extension stuff
* /tmp/debug.log - debug logging of ldap events from mediawiki (configged by $wgLDAPDebug = 9 and $wgDebugLogGroups['ldap'] = '/tmp/debug.log'
* /var/log/apache2/error.log - php/apache errors
* http://testwiki.nurdspace.lan

Latest revision as of 18:01, 30 September 2016

NURDs Inventory
NoPicture.png
Owner User:FwD
Status Unknown
Hostname testwiki.nurdspace.lan
Location Confusion
Tool No
Tool category

{{{Name}}}Property "Tool Name" (as page type) with input value "{{{Name}}}" contains invalid characters or is incomplete and therefore can cause unexpected results during a query or annotation process. Property "Tool Image" (as page type) with input value "File:{{{Picture}}}" contains invalid characters or is incomplete and therefore can cause unexpected results during a query or annotation process. {{{Picture}}} {{{InventoryOwner}}}Property "Tool Owner" (as page type) with input value "{{{InventoryOwner}}}" contains invalid characters or is incomplete and therefore can cause unexpected results during a query or annotation process. Confusion

On this VM I'll create a duplicate of the actual Wiki to test how hooking it up to the LDAP will turn out.

IP: 192.168.1.223

Status

  • Files copied from the real wiki (/root/filestmp)
  • Files put in /var/www/
  • Database dumped from the real wiki
  • Database put in /root/backup.sql
  • Database and files in place, wiki working (http://testwiki.nurdspace.lan/)
  • Ldap plugin installed and working
  • Current problem: the mediawiki login system converts the first character of the username you feed it to uppercase, possibly due to restrictions on usernames. See /tmp/debug.log for this error (when logging in as 'fwd'):
2013-05-22 21:15:50 testwiki nurdspace_wiki: 2.0d Failed to bind as uid=Fwd,ou=people,dc=nurdspace,dc=lan
  • Possible solutions:
  • Turns out $wgLDAPLowerCaseUsername does more than advertised, it converts input usernames completely to lowercase. However, now the skin starts bugging:
[Sat May 25 15:45:32 2013] [error] [client 192.168.1.9] PHP Strict Standards:
 Only variables should be passed by reference in /var/www/skins/GuMax.php on line 172,
 referer: http://testwiki.nurdspace.lan/index.php5?title=Special:UserLogin&returnto=Main+Page
  • and it still won't log in with a correct userdn:
2013-05-25 15:56:26 testwiki nurdspace_wiki: 2.0d Failed to bind as uid=fwd,ou=people,dc=nurdspace,dc=lan
2013-05-25 15:56:26 testwiki nurdspace_wiki: 2.0d Entering strict.
  • With lots of help from Cha0z97 it's now working! Users in the group 'wikiusers' can log in. Admins, bureaucrats and sysops are locally managed.
  • Full addition to LocalSettings.php:
#LDAP Auth
require_once( "$IP/extensions/LdapAuthentication/LdapAuthentication.php" );
$wgAuth = new LdapAuthenticationPlugin();
$wgLDAPDebug = 9;
$wgDebugLogGroups['ldap'] = '/tmp/debug.log';

$wgLDAPDomainNames = array( 'nurdspace.lan', );
$wgLDAPServerNames = array( 'nurdspace.lan' => 'ldap.nurdspace.nl', );
$wgLDAPUseLocal = false;
$wgLDAPEncryptionType = array( 'nurdspace.lan' => 'ssl', );
$wgLDAPSearchStrings = array( 'nurdspace.lan' => 'uid=USER-NAME,ou=people,dc=nurdspace,dc=lan', );
$wgLDAPLowerCaseUsername = array( 'nurdspace.lan' => true );
$wgLDAPRequiredGroups = array( 'nurdspace.lan' => array( 'cn=wikiusers,ou=groups,dc=nurdspace,dc=lan', ) );
$wgLDAPGroupUseFullDN = array( "nurdspace.lan"=>false );
$wgLDAPGroupObjectclass = array( "nurdspace.lan"=>"posixGroup" );
$wgLDAPGroupAttribute = array( "nurdspace.lan"=>"memberUid" );
$wgLDAPGroupSearchNestedGroups = array( "nurdspace.lan"=>false );
$wgLDAPGroupNameAttribute = array( "nurdspace.lan"=>"cn" );
$wgLDAPBaseDNs = array( "nurdspace.lan"=>"dc=nurdspace,dc=lan" );
$wgLDAPUseLDAPGroups = array( "nurdspace.lan"=>true );
$wgGroupPermissions['wikiusers']['edit'] = true;
$wgGroupPermissions['admins'] = $wgGroupPermissions['sysop'];

# This hook is called by the LdapAuthentication plugin. It is a configuration hook. Here we
# are specifying what attibute we want to use for a username in the wiki.
# Note that this hook is NOT called on a straight bind.
# The hook calls the function defined below.
$wgHooks['SetUsernameAttributeFromLDAP'][] = 'SetUsernameAttribute';

Some settings might not be necessary, such as the wgGroupPermissions and wgHooks. I'll do some experimenting to see if it can be cleaned up.

  • What needs to be done when installing is execute the .sql file that comes with the LdapAuthenticate extension:
mysql -uwikiuser -pgodver nurdspace_wiki < /var/www/extensions/LdapAuthentication/ldap.sql
  • This will create a table that is needed by the extension. I should execute it by itself at first run, however, it does not.


Todo

  • It seems renaming/merging users can cause some problems. In the testwiki 2 users have disappeared after renaming and merging them.
  • While looking for errors regarding the disappearing users I came across some other errors in the Apache logging:
[Wed May 29 18:22:18 2013] [error] [client 192.168.1.103] PHP Notice:  Undefined offset: 0 in /var/www/extensions/
 LdapAuthentication/LdapAuthentication.php on line 1711, referer: http://testwiki.nurdspace.lan/index.php5?title=Special:UserLogin&returnto=Main+Page
[Wed May 29 18:22:18 2013] [error] [client 192.168.1.103] PHP Notice:  Undefined offset: 0 in /var/www/extensions/
 LdapAuthentication/LdapAuthentication.php on line 1712, referer: http://testwiki.nurdspace.lan/index.php5?title=Special:UserLogin&returnto=Main+Page
[Wed May 29 18:22:18 2013] [error] [client 192.168.1.103] PHP Notice:  Undefined offset: 0 in /var/www/extensions/
 LdapAuthentication/LdapAuthentication.php on line 1736, referer: http://testwiki.nurdspace.lan/index.php5?title=Special:UserLogin&returnto=Main+Page
[Wed May 29 18:22:18 2013] [error] [client 192.168.1.103] PHP Notice:  Undefined offset: 1 in /var/www/extensions/
 LdapAuthentication/LdapAuthentication.php on line 1743, referer: http://testwiki.nurdspace.lan/index.php5?title=Special:UserLogin&returnto=Main+Page
[Wed May 29 18:22:18 2013] [error] [client 192.168.1.103] PHP Notice:  Undefined offset: 0 in /var/www/extensions/
 LdapAuthentication/LdapAuthentication.php on line 1711, referer: http://testwiki.nurdspace.lan/index.php5?title=Special:UserLogin&returnto=Main+Page
[Wed May 29 18:22:18 2013] [error] [client 192.168.1.103] PHP Notice:  Undefined offset: 0 in /var/www/extensions/
 LdapAuthentication/LdapAuthentication.php on line 1712, referer: http://testwiki.nurdspace.lan/index.php5?title=Special:UserLogin&returnto=Main+Page
[Wed May 29 18:22:18 2013] [error] [client 192.168.1.103] PHP Notice:  Undefined offset: 0 in /var/www/extensions/
 LdapAuthentication/LdapAuthentication.php on line 1736, referer: http://testwiki.nurdspace.lan/index.php5?title=Special:UserLogin&returnto=Main+Page
[Wed May 29 18:22:18 2013] [error] [client 192.168.1.103] PHP Notice:  Undefined offset: 1 in /var/www/extensions/
 LdapAuthentication/LdapAuthentication.php on line 1743, referer: http://testwiki.nurdspace.lan/index.php5?title=Special:UserLogin&returnto=Main+Page


Relevant files to get this working

  • /var/www/LocalSettings.php - Mediawiki settings file with added ldap authentication extension stuff
  • /tmp/debug.log - debug logging of ldap events from mediawiki (configged by $wgLDAPDebug = 9 and $wgDebugLogGroups['ldap'] = '/tmp/debug.log'
  • /var/log/apache2/error.log - php/apache errors
  • http://testwiki.nurdspace.lan