Hi to all MediaWiki community,
I got a task to configure MediaWiki with LDAP authorization true Windows Server 2019 Active Directory. Please note that it is the first time when I do something that looks like. Before it, I never did any integration with LDAP. I just reed about extensions on the MediaWiki site, read other topics and tried to do my best. I read other topics where was the same issue, but it didn't help me with resolve mine.
I got an issue and I want to ask your help with solving it.
My lab bellow:
CentOS 8.2.2
PostgreSQL 12.3
NGINX 1.14.1
PHP 7.4.8
Windows Server 2019
Active Directory installed
Firewall disabled
Please note that telnet successful from CentOS to WS19 on 389 port
#Connected to 192.168.0.100
#Escape character is '^]' .
As I understood it is mean that telnet to 389 port successful.
When I am trying to login with my domain user I got an error below:
[b932cd5d151b528a1846bc00] /index.php?title=Special:PluggableAuthLogin MWException from line 169 of /var/www/html/mediawiki/extensions/LDAPProvider/src/Client.php: Could not bind to LDAP: (-1) Can't contact LDAP server
#0 /var/www/html/mediawiki/extensions/LDAPProvider/src/Client.php(92): MediaWiki\Extension\LDAPProvider\Client->establishBinding()
#1 /var/www/html/mediawiki/extensions/LDAPProvider/src/Client.php(329): MediaWiki\Extension\LDAPProvider\Client->init()
#2 /var/www/html/mediawiki/extensions/LDAPAuthentication2/src/PluggableAuth.php(77): MediaWiki\Extension\LDAPProvider\Client->canBindAs()
#3 /var/www/html/mediawiki/extensions/PluggableAuth/includes/PluggableAuthLogin.php(30): MediaWiki\Extension\LDAPAuthentication2\PluggableAuth->authenticate()
#4 /var/www/html/mediawiki/includes/specialpage/SpecialPage.php(575): PluggableAuthLogin->execute()
#5 /var/www/html/mediawiki/includes/specialpage/SpecialPageFactory.php(611): SpecialPage->run()
#6 /var/www/html/mediawiki/includes/MediaWiki.php(296): MediaWiki\Special\SpecialPageFactory->executePath()
#7 /var/www/html/mediawiki/includes/MediaWiki.php(900): MediaWiki->performRequest()
#8 /var/www/html/mediawiki/includes/MediaWiki.php(527): MediaWiki->main()
#9 /var/www/html/mediawiki/index.php(44): MediaWiki->run()
#10 {main}
Here is my Localsettings.php config below:
wfLoadExtension( 'LDAPProvider' );
$LDAPProviderDomainConfigs = "/etc/mediawiki/ldapprovider.json";
wfLoadExtension( 'PluggableAuth' );
$wgPluggableAuth_EnableLocalLogin = true;
$wgGroupPermissions['user']['autocreateaccount'] = true;
$wgGroupPermissions['user']['createaccount'] = true;
wfLoadExtension( 'LDAPAuthorization' );
wfLoadExtension( 'LDAPAuthentication2' );
$LDAPAuthentication2UsernameNormalizer = 'strtolower';
$LDAPAuthentication2AllowLocalLogin = true;
Here is my ldapprovider.json config bellow:
{
"lenovo.local": {
"connection": {
"server": "ldap.lenovo.local",
"user": "cn=admin.mediawiki,dc=lenovo,dc=local",
"pass": "P@ssw0rd",
"options": {
"LDAP_OPT_DEREF": 1
},
"port": 389,
"enctype": "clear",
"basedn": "dc=lenovo,dc=local",
"userbasedn": "ou=Users,dc=lenovo,dc=local",
"searchattribute": "uid",
"usernameattribute": "uid",
"realnameattribute": "cn",
"emailattribute": "mail",
"searchstring": "uid=USER-NAME,ou=Users,dc=lenovo,dc=local",
"groupbasedn": "ou=Users,dc=lenovo,dc=local",
"groupobjectclass": "posixgroup",
"groupattribute": "memberuid",
"grouprequest": "MediaWiki\\Extension\\LDAPProvider\\UserGroupsRequest\\Configurable::factory"
}
}
}
As I understood on the ldapprovider.json the "username" and "pass" using to get into Active Directory with these credentials and retrieve information about users in the Active Directory catalog.I created the user "admin.mediawiki" and added him to the admin groups for some reason.
The "ou" is an Organization Unit where located users, groups, or another OU and etc., for a test I indicate a default OU=Users, which created after installing AD and contain a test user.
Could you please help me with this issue or maybe provide working examples of Localsettings.php and ldapprovider.json or there is maybe another FAQ on MediaWiki which I should read.
I can describe everything in more detail in personal correspondence, if you suddenly need any detailed information.
Thank you in advance.
For Russian speakers:
Могу более подробно все описать в личной переписке , если вдруг понадобится какая либо подробная информация.
Заранее спасибо.