Talk:LDAP hub/2019
Add topic| This page used the Structured Discussions extension to give structured discussions. It has since been converted to wikitext, so the content and history here are only an approximation of what was actually displayed at the time these comments were made. |
Authorization failing?
[edit]I cannot get authorized to the wiki, although it seems the ldap is authenticating my login account. We have our 1.23 version with the old LdapAuthentication set to private with only the specific ldap group configured to have login access. Here is my LocalSettings.php stanza for 1.31:
wfLoadExtension("PluggableAuth");
wfLoadExtension("LDAPProvider");
wfLoadExtension("LDAPGroups");
wfLoadExtension("LDAPAuthentication2");
wfLoadExtension("LDAPAuthorization");
$LDAPProviderDomainConfigProvider = function() {
$config = [
"LDAP" => [
"connection" => [
"server" => "ldap.domain.org",
"port" => "636",
"user" => "cn=authaccount,dc=domain,dc=org",
"pass" => "password-auth",
"basedn" => "ou=People,dc=domain,dc=org",
"groupbasedn" => "ou=Groups,dc=domain,dc=org",
"userbasedn" => "ou=People,dc=domain,dc=org",
"searchattribute" => "uid",
"searchstring" => "",
"usernameattribute" => "uid",
"realnameattribute" => "cn",
"emailattribute" => "Email"
],
"groupsync" => [
"cn=wiki_editors,ou=Groups,dc=domain,dc=org"
],
"userinfo" => [
]
]
];
return new \MediaWiki\Extension\LDAPProvider\DomainConfigProvider\InlinePHPArray( $config );
};
This gives me a login prompt which accepts my username password combo and then returns an error "Fatal exception of type MWException". When I check the ldap logs, I see the following:
Apr 16 14:47:43 pastrami slapd[4356]: conn=2275506 fd=24 ACCEPT from IP=x.y.z.34:58576 (IP=0.0.0.0:636)
Apr 16 14:47:43 pastrami slapd[4356]: conn=2275506 fd=24 TLS established tls_ssf=256 ssf=256
Apr 16 14:47:43 pastrami slapd[4356]: conn=2275506 op=0 BIND dn="cn=authaccount,dc=domain,dc=org" method=128
Apr 16 14:47:43 pastrami slapd[4356]: conn=2275506 op=0 BIND dn="cn=authaccount,dc=domain,dc=org" mech=SIMPLE ssf=0
Apr 16 14:47:43 pastrami slapd[4356]: conn=2275506 op=0 RESULT tag=97 err=0 text=
Apr 16 14:47:43 pastrami slapd[4356]: conn=2275506 op=1 SRCH base="ou=People,dc=domain,dc=org" scope=2 deref=0 filter="(uid=username)"
Apr 16 14:47:43 pastrami slapd[4356]: conn=2275506 op=1 SRCH attr=* memberof
Apr 16 14:47:43 pastrami slapd[4356]: conn=2275506 op=1 SEARCH RESULT tag=101 err=0 nentries=1 text=
Apr 16 14:47:43 pastrami slapd[4356]: conn=2275506 op=2 BIND anonymous mech=implicit ssf=0
Apr 16 14:47:43 pastrami slapd[4356]: conn=2275506 op=2 BIND dn="uid=username,ou=People,dc=domain,dc=org" method=128
Apr 16 14:47:43 pastrami slapd[4356]: conn=2275506 op=2 BIND dn="uid=username,ou=People,dc=domain,dc=org" mech=SIMPLE ssf=0
Apr 16 14:47:43 pastrami slapd[4356]: conn=2275506 op=2 RESULT tag=97 err=0 text=
Apr 16 14:47:43 pastrami slapd[4356]: conn=2275506 op=3 BIND anonymous mech=implicit ssf=0
Apr 16 14:47:43 pastrami slapd[4356]: conn=2275506 op=3 BIND dn="cn=authaccount,dc=domain,dc=org" method=128
Apr 16 14:47:43 pastrami slapd[4356]: conn=2275506 op=3 BIND dn="cn=authaccount,dc=domain,dc=org" mech=SIMPLE ssf=0
Apr 16 14:47:43 pastrami slapd[4356]: conn=2275506 op=3 RESULT tag=97 err=0 text=
Apr 16 14:47:43 pastrami slapd[4356]: conn=2275506 op=4 SRCH base="ou=People,dc=domain,dc=org" scope=2 deref=0 filter="(uid=username)"
Apr 16 14:47:43 pastrami slapd[4356]: conn=2275506 op=4 SRCH attr=* memberof
Apr 16 14:47:43 pastrami slapd[4356]: conn=2275506 op=4 SEARCH RESULT tag=101 err=0 nentries=1 text=
Apr 16 14:47:43 pastrami slapd[4356]: conn=2275506 op=5 UNBIND
Apr 16 14:47:43 pastrami slapd[4356]: conn=2275506 fd=24 closed
For the record, this is what the successful login looks like on the same ldap server with the old 1.23 wiki, with the old LdapAuthentication:
Apr 16 09:27:45 pastrami slapd[4356]: conn=2275479 fd=24 ACCEPT from IP=x.y.z.14:43293 (IP=0.0.0.0:636)
Apr 16 09:27:45 pastrami slapd[4356]: conn=2275479 fd=24 TLS established tls_ssf=256 ssf=256
Apr 16 09:27:45 pastrami slapd[4356]: conn=2275479 op=0 BIND dn="cn=authaccount,dc=domain,dc=org" method=128
Apr 16 09:27:45 pastrami slapd[4356]: conn=2275479 op=0 BIND dn="cn=authaccount,dc=domain,dc=org" mech=SIMPLE ssf=0
Apr 16 09:27:45 pastrami slapd[4356]: conn=2275479 op=0 RESULT tag=97 err=0 text=
Apr 16 09:27:45 pastrami slapd[4356]: conn=2275479 op=1 SRCH base="ou=People,dc=domain,dc=org" scope=2 deref=0 filter="(uid=username)"
Apr 16 09:27:45 pastrami slapd[4356]: conn=2275479 op=1 SRCH attr=* memberof
Apr 16 09:27:45 pastrami slapd[4356]: conn=2275479 op=1 SEARCH RESULT tag=101 err=0 nentries=1 text=
Apr 16 09:27:45 pastrami slapd[4356]: conn=2275479 op=2 BIND anonymous mech=implicit ssf=0
Apr 16 09:27:45 pastrami slapd[4356]: conn=2275479 op=2 BIND dn="uid=username,ou=People,dc=domain,dc=org" method=128
Apr 16 09:27:45 pastrami slapd[4356]: conn=2275479 op=2 BIND dn="uid=username,ou=People,dc=domain,dc=org" mech=SIMPLE ssf=0
Apr 16 09:27:45 pastrami slapd[4356]: conn=2275479 op=2 RESULT tag=97 err=0 text=
Apr 16 09:27:45 pastrami slapd[4356]: conn=2275479 op=3 SRCH base="uid=username,ou=People,dc=domain,dc=org" scope=0 deref=0 filter="(objectClass=posixAccount)"
Apr 16 09:27:45 pastrami slapd[4356]: conn=2275479 op=3 SRCH attr=dn
Apr 16 09:27:45 pastrami slapd[4356]: conn=2275479 op=3 SEARCH RESULT tag=101 err=0 nentries=1 text=
Apr 16 09:27:45 pastrami slapd[4356]: conn=2275479 op=4 BIND anonymous mech=implicit ssf=0
Apr 16 09:27:45 pastrami slapd[4356]: conn=2275479 op=4 BIND dn="cn=authaccount,dc=domain,dc=org" method=128
Apr 16 09:27:45 pastrami slapd[4356]: conn=2275479 op=4 BIND dn="cn=authaccount,dc=domain,dc=org" mech=SIMPLE ssf=0
Apr 16 09:27:45 pastrami slapd[4356]: conn=2275479 op=4 RESULT tag=97 err=0 text=
Apr 16 09:27:45 pastrami slapd[4356]: conn=2275479 op=5 SRCH base="dc=domain,dc=org" scope=2 deref=0 filter="(&(member=uid=username,ou=people,dc=domain,dc=org)(objectClass=\
groupOfNames))"
Apr 16 09:27:45 pastrami slapd[4356]: <= bdb_equality_candidates: (member) not indexed
Apr 16 09:27:45 pastrami slapd[4356]: conn=2275479 op=5 SEARCH RESULT tag=101 err=0 nentries=18 text=
Apr 16 09:27:45 pastrami slapd[4356]: conn=2275479 op=6 UNBIND
Apr 16 09:27:45 pastrami slapd[4356]: conn=2275479 fd=24 closed
I've tried adding the following to the LocalSettings.php file, above the groupsync section, but when I add this the wiki refuses to load and I only get a blank screen:
"authorization" => {
"rules" => {
"groups" => {
"required" => [
"cn=wiki_editors,ou=Groups,dc=domain,dc=org"
],
"excluded" => [
]
}
}
}, 192.150.187.199 (talk) 18:31, 23 April 2019 (UTC)
- Forgot to mention RHEL6, with apache 2.4, php7.0, mariadb5.5
192.150.187.199 (talk) 16:00, 24 April 2019 (UTC)- The "groupsync" section seems to be configured wrong. Please check the documentation on this.
- Also it looks like you are not using Extension:LDAPAuthorization, so you might as well disable it. Osnard (talk) 06:19, 10 May 2019 (UTC)
Possible to write back to LDAP?
[edit]I just switched from LDAPAuthentication (which seems broken on 1.33) to this LDAP stack (LDAPProvider, LDAPAuthentication2, and LDAPUserInfo which seems mandatory), but now in the user preferences my users can't edit their email address and such. I was using the wiki as the main front-end to modify user data, since it's the primary component of my website. Is there any way to let MediaWiki write back to LDAP, so users can modify their Real Name, Email, etc. in the User Preferences? 2A02:908:C70:52C0:65D8:E4DD:A2B9:E82F (talk) 20:57, 4 July 2019 (UTC)
- No, unfortunately writing back into the LDAP resource as it was possible with the old Extension:LDAP Authentication is not implemented in the new stack yet. Osnard (talk) 09:08, 5 July 2019 (UTC)
Group Sync not working
[edit]The site LDAP hub says "LDAPGroups via UserLoadAfterLoadFromSession hook; username and domain".
I do not understand this, how do I call the Hooks from LdapGroups? There is right now no Syncronisation happening.
Extensions installed:
LDAPProvider
Auth_Remoteuser
LDAPAuthorization
LDAPGroups
When should the Hook run? I have no experience with Hooks, is this right?
$wgHooks['UserLoadAfterLoadFromSession'][] = 'SyncUserGroupsAfterLoadSession::callback';
Thanks a lot Victorwiki82 (talk) 08:34, 10 July 2019 (UTC)
- You don't need to wire up the hooks youself. The extension does this. Can you share the domain config (stripped from sensitive data)? Osnard (talk) 12:26, 18 July 2019 (UTC)
Group Sync and User Attributes
[edit]The following discussion is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.
Hello!
My conf is:
HTTPS wiki
Extensions folder:
Auth_remoteuser
LDAPProvider
LDAPAuthorization
LDAPGroups
LDAPUserInfo
LocalSettings.php:
#Auth_remoteuser
wfLoadExtension( 'Auth_remoteuser' );
$wgAuthRemoteuserUserNameReplaceFilter = [
'@DOMAIN.MY$' => '' // mod_krb5 and .htaccess
];
#LDAPAuthorization
wfLoadExtension( 'LDAPAuthorization' ); // breaks autologon by Auth_remoteuser
#LDAPProvider
wfLoadExtension( 'LDAPProvider' );
$LDAPProviderDomainConfigProvider = function() {
$config = [
'domain.my' => [
'connection' => [
"server" => "ldap.domain.my",
"user" => "CN=ldap,OU=unit,DC=domain,DC=my",
"pass" => 'pass',
"options" => [
"LDAP_OPT_DEREF" => 1
],
"basedn" => "dc=domain,dc=my",
"groupbasedn" => "dc=domain,dc=my",
"userbasedn" => "dc=domain,dc=my",
"searchattribute" => "samaccountname",
"searchstring" => "",
"usernameattribute" => "samaccountname",
"realnameattribute" => "cn",
"emailattribute" => "mail"
],
'userinfo' => [
"attributes-map" => [
"realname" => "cn"
]
],
'groupsync' => [
"mechanism" => "mappedgroups",
"mapping" => [
"mygroup" => "OU=unit,DC=domain,DC=my"
]
]
]
];
return new \MediaWiki\Extension\LDAPProvider\DomainConfigProvider\InlinePHPArray( $config );
};
php ShowUserInfo.php --domain domain.my --username user - works perfect
1) Am I right that LDAPGroups, LDAPUserInfo requires LDAPAuthorization?
2) LocalSettings.php not contains wfLoadExtension( 'LDAPGroups' ) and wfLoadExtension( 'LDAPUserInfo ' ) - is it right?
3) How to make work userinfo, groupsync and autologon again?
Thank you! Starws (talk) 06:26, 6 August 2019 (UTC)
- 1) No. LDAPGroups and LDAPUserInfo do not require LDAPAuthorization. They only require LDAP Provider. Group-Sync and Info-Sync will be done periodically when the user session gets initialized.
- 2) No. LDAPGroups as well as LDAPUserInfo need to be loaded explicitly in
LocalSettings.php - 3) Please have a look at the example configuration on LDAP_hub/Migration_from_extension_LDAPAuthentication. It shows how to set up autologon and userinfosync. Regarding groupsync you will need to additionally load LDAPGroups extension and add the required configuration to your domain config (e.g. the JSON file).
- Be aware that stripping the domain from the remote-username in
$wgAuthRemoteuserUserNameReplaceFilteris not required. LDAPAuthorization will take care of this. But you will need to specify the "format". In your case this would probably be$LDAPAuthorizationAutoAuthRemoteUserStringParser = 'username-at-domain';Osnard (talk) 06:58, 6 August 2019 (UTC) - All right.
- 1) OK. I excluded LDAPAuthorization fully.
- 2) LDAPGroups (1.31 and dev master versions) brokes wiki (1.33) after it loaded in Localsettings.php - LDAPGroups is not compatible with the current installed version of LDAPProvider (1.0.0), it requires: 1.0.1. I'll try to update LDAPProvider. Userinfosync by LDAPUserInfo doesn't update info... ( "realname" => "cn")
- 3) Stripping the domain from the remote-username in $wgAuthRemoteuserUserNameReplaceFilter is required for autologon and it works perfect! Starws (talk) 07:18, 6 August 2019 (UTC)
- Regarding 3): Yes, of course. I thought you wanted to use
LDAPAuthorization. I that case you'd not need to create the username yourself. But if you do not useLDAPAuthorizationyou will of course need that. Osnard (talk) 09:47, 6 August 2019 (UTC) - 2) LDAPProvider, LDAPGroups, LDAPUserInfo updated to master version - 1.0.1, 1.0.1, 1.0.0 respectively (wiki works) but nothing changes - autoadd users to a mediawiki group (custom group) not working and realnames too... Is realnames must be at Special:Preferences? Starws (talk) 10:26, 6 August 2019 (UTC)
- What kind of sync-mechanism do you use? "allgroups" or "mappedgroups"? Be aware that "allgroups" requires the groups to exist on the wiki.
- LDAPUserInfo should update the value of "realname" in Special:Preferences, yes.
- The syncing will be made every hour, once the user is logged in. To make sure that that code should be executed, please clear all cookies and log in again. Osnard (talk) 12:20, 6 August 2019 (UTC)
- "mechanism" => "mappedgroups"
- Can you check LocalSettings.php conf above? Maybe I missed smth. Starws (talk) 12:52, 6 August 2019 (UTC)
- Maybe the domain can not be found for the user. For testing, please add to
mediawiki/extensions/LDAPProvider/src/Hook/UserLoadAfterLoadFromSession.phpin line 127 [1]$this->domain = 'mydomain'; return true;. It should look like this protected function findDomainForUser() {$this->domain = 'mydomain'; return true;$userDomainStore = new UserDomainStore(...- You need to replace
mydomainwith the value of what you have defined in the domain config (case sensitive). - https://github.com/wikimedia/mediawiki-extensions-LDAPProvider/blob/master/src/Hook/UserLoadAfterLoadFromSession.php#L127
- There is already a task for this: https://phabricator.wikimedia.org/T214147 Osnard (talk) 12:45, 6 August 2019 (UTC)
- Wow, man, it's works!!! Realname filled correctly. Thank you!!
- How about autoadd users to a group?
- 'groupsync' => [
- "mechanism" => "mappedgroups",
- "mapping" => [
- "mygroup" => "OU=unit,DC=domain,DC=my"
- ] Starws (talk) 03:06, 7 August 2019 (UTC)
- Good to hear. Regarding GroupSync: This looks good. GroupSync uses the same mechanism as UserInfo. So This should work too. The "MappedGroups" mechanism does not need the groups to be available in the local wiki.
- You may be able to find more information by using the debug log:
$wgDebugLogGroups['LDAPGroups'] = '/tmp/LDAPGroups.log';Osnard (talk) 06:14, 7 August 2019 (UTC)- Excuse me again... LDAPGroups extension removes users from a mediawiki groups (e.g. me from the sysop group) and doesn't add them to "mygroup". Conf the same as above.
- Is OU must be the same, as "mygroup"? I.e. "mygroup" => "OU=mygroup,DC=domain,DC=my" Starws (talk) 12:00, 7 August 2019 (UTC)
- Yes, LDAPGroups can also remove group assignments. When using the "allgroups" mechanism you can specify a list of "locally-mamanged" groups that won't be touched by the extension. The "sysop" group is set as default.
- If you use "mappedgroups", you will need to specify one mapping for each group that needs to be assigned. Also for "sysop"
- The OU does not need to match the internal group name when using "mappedgroups". When using "allgroups" it must match and the local group mus exist.
- For examples of "mappedgroups" configuration please see
- Many thanks to Osnard for supporting!
- So, if you configured everything as in the documentation,
php extensions/LDAPProvider/maintenance/ShowUserInfo.php --domain mydomain --username SomeUseroutput is fine, but LDAPUserInfo or LDAPGroups doesn't work: - For LDAPUserInfo you need to add
$this->domain = 'mydomain'; return true;inmediawiki/extensions/LDAPProvider/src/Hook/UserLoadAfterLoadFromSession.phpin line 127 - Source[1]
- For LDAPGroups make sure the next output is not null:
php extensions/LDAPProvider/maintenance/ShowUserGroups.php --domain mydomain --username SomeUser- If null - you need to add
'grouprequest': - 'connection' => [
- ...
- 'grouprequest' => 'MediaWiki\\Extension\\LDAPProvider\\UserGroupsRequest\\UserMemberOf::factory',
- ...
- ]
- Please note, that 'groupsync' requires a DN of the ADGroup and not a DN of the ADOrganizationalUnit. Starws (talk) 10:50, 13 August 2019 (UTC)
Config Issue: LDAPUserInfoModifierRegistry
[edit]Hi,
And I am able to authenticate users and I am being logged in, but the login process returns an error (even though I am logged in):
[aa7620161bb77e16aef3c615] /w/intcomsB/index.php?title=Special:UserLogin&returnto=Special%3AUserLogin ConfigException from line 53 of /var/www/www-mediawiki/mediawiki-1.33.0/includes/config/GlobalVarConfig.php: GlobalVarConfig::get: undefined option: 'LDAPUserInfoModifierRegistry'
I can not see any reference to 'LDAPUserInfoModifierRegistry' does anyone know what I have missed?
Thanks
Joe
Config:
wfLoadExtensions( [
'PluggableAuth',
'LDAPProvider',
'LDAPAuthentication2',
'LDAPAuthorization',
'LDAPUserInfo'
] );
$LDAPProviderCacheTime = 1;
$LDAPAuthentication2UsernameNormalizer = 'strtolower';
$LDAPAuthentication2AllowLocalLogin = false;
$wgPluggableAuth_EnableAutoLogin = false;
$wgPluggableAuth_EnableLocalLogin = false;
$wgPluggableAuth_EnableLocalProperties = true;
$wgPluggableAuth_ButtonLabel = "Log in";
$wgAuthRemoteuserUserName = function() {
$user = '';
if( isset( $_SERVER['REMOTE_USER'] ) ) {
$user = strtolower( $_SERVER['REMOTE_USER'] );
}
return $user;
};
$LDAPProviderDomainConfigProvider = function() {
$config = [
'DOMAINNAME' => [
'connection' => [
"server" => "name.example.org.uk",
"options" => [
"LDAP_OPT_DEREF" => 1
],
"port" => 389,
"enctype" => "clear",
"user" => "DOMAINNAME\SPECIALUSER",
"pass" => "THE PASSWORD",
"basedn" => "dc=example,dc=org,dc=uk",
"groupbasedn" => "dc=example,dc=org,dc=uk",
"userbasedn" => "dc=example,dc=org,dc=uk",
"searchattribute" => "samaccountname",
"searchstring" => "DOMAINNAME\\USER-NAME",
"usernameattribute" => "samaccountname",
"realnameattribute" => "displayname",
"emailattribute" => "mail",
"grouprequest" => "MediaWiki\\Extension\\LDAPProvider\\UserGroupsRequest\\UserMemberOf::factory"
],
'authorization' => [
'rules' => [
]
] ,
'userinfo' => [
'attributes-map' => [
'email' => 'mail',
'realname' => 'displayname'
]
]
]
];
return new \MediaWiki\Extension\LDAPProvider\DomainConfigProvider\InlinePHPArray( $config );
};
195.195.116.101 (talk) 12:18, 8 August 2019 (UTC)
- "user" => "DOMAINNAME\SPECIALUSER", should be "DOMAINNAME\\SPECIALUSER" 213.138.74.76 (talk) 07:14, 9 August 2019 (UTC)
- It seems the error was related to the 'LDAPUserInfo' and the 'userinfo' array - I did not really need them at this time so I could get everything working by just removing them. More experimentation will be needed later in I do start to need them.
- Thanks. 195.195.116.101 (talk) 11:46, 9 August 2019 (UTC)
- This is strange. The variable
$LDAPUserInfoModifierRegistrygets defined by Extension:LDAPUserInfo itself and should therefore never be missing. What PHP version are you using? Osnard (talk) 14:47, 12 August 2019 (UTC)
/CheckLogin.php and /ShowUserGroups.php
[edit]I'm getting error on CheckLogin.php and getting "null" on ShowUserGroups.php:
Command Line
user@userpc:/var/www/wiki$ sudo php extensions/LDAPProvider/maintenance/ShowUserInfo.php --domain solis --username guilherme_bangemann
objectclass =>
0 => sambaSamAccount
1 => shadowAccount
2 => posixAccount
3 => inetOrgPerson
4 => organizationalPerson
5 => person
sambadomainname => SOLIS
displayname => Guilherme Keunecke Bangemann
sambahomedrive => U:
sambakickofftime => 1893463200
sambaprimarygroupsid => S-1-5-21-2804338137-552302570-2244938293-513
sambaacctflags => [XU ]
sambasid => S-1-5-21-2804338137-552302570-2244938293-21792
shadowwarning => 10
shadowinactive => 10
shadowmin => 1
shadowmax => 365
homedirectory => /home/guilherme
loginshell => /bin/bash
gidnumber => 10001
cn => Guilherme Keunecke Bangemann
uidnumber => 10396
sn => Bangemann
givenname => Guilherme Keunecke
departmentnumber => Setor de Infraestrutura
uid => guilherme_bangemann
mail => guilherme_bangemann@solis.com.br
sambantpassword => A7C1B218F8E637AA62F59D31F76DFBCD
sambapwdlastset => 1559650352
shadowlastchange => 18051
userpassword => {CRYPT}$1$wn6dubOY$obSU01DXY2wolpTXxXLEq1
dn => uid=guilherme_bangemann,ou=users,dc=solis,dc=coop,dc=br
user@userpc:/var/www/wiki$ sudo php extensions/LDAPProvider/maintenance/ShowUserGroups.php --domain solis --username guilherme_bangemann
Full DNs:
Short names:
user@userpc:/var/www/wiki$ sudo php extensions/LDAPProvider/maintenance/CheckLogin.php --domain solis --username guilherme_bangemann
Password:userpassword
FAILED
LocalSettings.php
wfLoadExtensions( [
'PluggableAuth',
'LDAPProvider',
'LDAPAuthentication2',
'LDAPAuthorization',
'LDAPUserInfo',
'LDAPGroups'
] );
$LDAPProviderDomainConfigProvider = function() {
$config = [
"solis" => [
"connection" => [
"port" => 389,
"enctype" => "clear",
"server" => "ldapslave.solis.com.br",
"user" => "uid=guilherme_bangemann,ou=users,dc=solis,dc=coop,dc=br",
"pass" => "userpassword",
"options" => [
"LDAP_OPT_DEREF" => 1
],
"basedn" => "dc=solis,dc=coop,dc=br",
"groupbasedn" => "dc=solis,dc=coop,dc=br",
"userbasedn" => "dc=solis,dc=coop,dc=br",
"searchattribute" => "uid",
"searchstring" => "solis\\USER-NAME",
"usernameattribute" => "uid",
"realnameattribute" => "cn",
"emailattribute" => "mail",
"grouprequest" => "MediaWiki\\Extension\\LDAPProvider\\UserGroupsRequest\\GroupMember::factory"
],
"groupsync" => [
"mechanism" => "allgroups",
],
"userinfo" => [
"attributes-map" => [
"realname" => "cn"
]
],
"authorization" => [
"rules" => [
"groups" => [
"required" => [ "ou=users,dc=solis,dc=coop,dc=br" ]
]
]
]
]
];
return new \MediaWiki\Extension\LDAPProvider\DomainConfigProvider\InlinePHPArray( $config );
};
$wgPluggableAuth_EnableAutoLogin = false;
$wgPluggableAuth_EnableLocalLogin = false;
$wgPluggableAuth_EnableLocalProperties = false;
$wgPluggableAuth_ButtonLabel = null;
$wgPluggableAuth_ExtraLoginFields = [];
Guilherme bangemann (talk) 14:49, 17 September 2019 (UTC)
- Please @Osnard could you help me with this problem?
- When I try to login in my wiki, I get the message: Could not authenticate credentials against domain "solis"
- cat debugLDAP-wiki.log
- ----IP: 127.0.0.1
- Start command line script extensions/LDAPProvider/maintenance/CheckLogin.php
- [caches] cluster: APCBagOStuff, WAN: mediawiki-main-default, stash: db-replicated, message: APCBagOStuff, session: APCBagOStuff
- [caches] LocalisationCache: using store LCStoreDB
- [DBConnection] Wikimedia\Rdbms\LoadBalancer::openConnection: calling initLB() before first connection.
- [DBReplication] Wikimedia\Rdbms\LBFactory::getChronologyProtector: using request info {
- "IPAddress": "127.0.0.1",
- "UserAgent": false,
- "ChronologyProtection": false,
- "ChronologyPositionIndex": 0
- }
- [DBConnection] Wikimedia\Rdbms\LoadBalancer::openConnection: connected to database 0 at 'localhost'.
- [DBConnection] Wikimedia\Rdbms\{closure}: closing connection to database 'localhost'.
- IP: 127.0.0.1
- Start command line script extensions/LDAPProvider/maintenance/ShowUserGroups.php
- [caches] cluster: APCBagOStuff, WAN: mediawiki-main-default, stash: db-replicated, message: APCBagOStuff, session: APCBagOStuff
- [caches] LocalisationCache: using store LCStoreDB
- [DBConnection] Wikimedia\Rdbms\LoadBalancer::openConnection: calling initLB() before first connection.
- [DBReplication] Wikimedia\Rdbms\LBFactory::getChronologyProtector: using request info {
- "IPAddress": "127.0.0.1",
- "UserAgent": false,
- "ChronologyProtection": false,
- "ChronologyPositionIndex": 0
- }
- [DBConnection] Wikimedia\Rdbms\LoadBalancer::openConnection: connected to database 0 at 'localhost'.
- [error] [15122d2a2917e2206b29694d] [no req] ErrorException from line 19 of /var/lib/wiki/extensions/LDAPProvider/src/UserGroupsRequest/UserMemberOf.php: PHP Notice: Undefined index: memberof
- #0 /var/lib/wiki/extensions/LDAPProvider/src/UserGroupsRequest/UserMemberOf.php(19): MWExceptionHandler::handleError(integer, string, string, integer, array)
- #1 /var/lib/wiki/extensions/LDAPProvider/src/Client.php(346): MediaWiki\Extension\LDAPProvider\UserGroupsRequest\UserMemberOf->getUserGroups(string)
- #2 /var/lib/wiki/includes/libs/objectcache/BagOStuff.php(159): MediaWiki\Extension\LDAPProvider\Client->MediaWiki\Extension\LDAPProvider\{closure}()
- #3 /var/lib/wiki/extensions/LDAPProvider/src/Client.php(347): BagOStuff->getWithSetCallback(string, integer, Closure)
- #4 /var/lib/wiki/extensions/LDAPProvider/maintenance/ShowUserGroups.php(48): MediaWiki\Extension\LDAPProvider\Client->getUserGroups(string)
- #5 /var/lib/wiki/maintenance/doMaintenance.php(94): MediaWiki\Extension\LDAPProvider\Maintenance\ShowUserGroups->execute()
- #6 /var/lib/wiki/extensions/LDAPProvider/maintenance/ShowUserGroups.php(71): require_once(string)
- #7 {main}
- [error] [15122d2a2917e2206b29694d] [no req] ErrorException from line 59 of /var/lib/wiki/extensions/LDAPProvider/maintenance/ShowUserGroups.php: PHP Warning: Invalid argument supplied for foreach()
- #0 /var/lib/wiki/extensions/LDAPProvider/maintenance/ShowUserGroups.php(59): MWExceptionHandler::handleError(integer, string, string, integer, array)
- #1 /var/lib/wiki/extensions/LDAPProvider/maintenance/ShowUserGroups.php(50): MediaWiki\Extension\LDAPProvider\Maintenance\ShowUserGroups->showValue(MediaWiki\Extension\LDAPProvider\GroupList)
- #2 /var/lib/wiki/maintenance/doMaintenance.php(94): MediaWiki\Extension\LDAPProvider\Maintenance\ShowUserGroups->execute()
- #3 /var/lib/wiki/extensions/LDAPProvider/maintenance/ShowUserGroups.php(71): require_once(string)
- #4 {main}
- [error] [15122d2a2917e2206b29694d] [no req] ErrorException from line 52 of /var/lib/wiki/extensions/LDAPProvider/src/GroupList.php: PHP Warning: Invalid argument supplied for foreach()
- #0 /var/lib/wiki/extensions/LDAPProvider/src/GroupList.php(52): MWExceptionHandler::handleError(integer, string, string, integer, array)
- #1 /var/lib/wiki/extensions/LDAPProvider/src/GroupList.php(32): MediaWiki\Extension\LDAPProvider\GroupList->makeShortNames()
- #2 /var/lib/wiki/extensions/LDAPProvider/maintenance/ShowUserGroups.php(64): MediaWiki\Extension\LDAPProvider\GroupList->getShortNames()
- #3 /var/lib/wiki/extensions/LDAPProvider/maintenance/ShowUserGroups.php(50): MediaWiki\Extension\LDAPProvider\Maintenance\ShowUserGroups->showValue(MediaWiki\Extension\LDAPProvider\GroupList)
- #4 /var/lib/wiki/maintenance/doMaintenance.php(94): MediaWiki\Extension\LDAPProvider\Maintenance\ShowUserGroups->execute()
- #5 /var/lib/wiki/extensions/LDAPProvider/maintenance/ShowUserGroups.php(71): require_once(string)
- #6 {main}
- [DBConnection] Wikimedia\Rdbms\{closure}: closing connection to database 'localhost'.
- IP: 127.0.0.1
- Start command line script extensions/LDAPProvider/maintenance/ShowUserInfo.php
- [caches] cluster: APCBagOStuff, WAN: mediawiki-main-default, stash: db-replicated, message: APCBagOStuff, session: APCBagOStuff
- [caches] LocalisationCache: using store LCStoreDB
- [DBConnection] Wikimedia\Rdbms\LoadBalancer::openConnection: calling initLB() before first connection.
- [DBReplication] Wikimedia\Rdbms\LBFactory::getChronologyProtector: using request info {
- "IPAddress": "127.0.0.1",
- "UserAgent": false,
- "ChronologyProtection": false,
- "ChronologyPositionIndex": 0
- }
- [DBConnection] Wikimedia\Rdbms\LoadBalancer::openConnection: connected to database 0 at 'localhost'.
- [DBConnection] Wikimedia\Rdbms\{closure}: closing connection to database 'localhost'.
- ----
- cat LDAP.log
- ----2019-09-17 17:50:01 guilherme-pc wiki: ldap_connect( $hostname = 'ldap://ldapslave.solis.com.br:389', $port = 389 );
- 2019-09-17 17:50:01 guilherme-pc wiki: # __METHOD__ returns Resource id #198
- 2019-09-17 17:50:01 guilherme-pc wiki: ldap_set_option( $linkID, $option = 17, $newval = 3 );
- 2019-09-17 17:50:01 guilherme-pc wiki: # returns 1
- 2019-09-17 17:50:01 guilherme-pc wiki: ldap_set_option( $linkID, $option = 8, $newval = 0 );
- 2019-09-17 17:50:01 guilherme-pc wiki: # returns 1
- 2019-09-17 17:50:01 guilherme-pc wiki: ldap_set_option( $linkID, $option = 2, $newval = 1 );
- 2019-09-17 17:50:01 guilherme-pc wiki: # returns 1
- 2019-09-17 17:50:01 guilherme-pc wiki: ldap_bind( $linkID, $bindRDN = 'uid=guilherme_bangemann,ou=users,dc=solis,dc=coop,dc=br', $bindPassword = 'XXXX' );
- 2019-09-17 17:50:02 guilherme-pc wiki: # returns 1
- 2019-09-17 17:50:02 guilherme-pc wiki: ldap_bind( $linkID, $bindRDN = 'solis\guilherme_bangemann', $bindPassword = 'XXXX' );
- 2019-09-17 17:50:02 guilherme-pc wiki: # returns
- 2019-09-17 17:50:07 guilherme-pc wiki: ldap_connect( $hostname = 'ldap://ldapslave.solis.com.br:389', $port = 389 );
- 2019-09-17 17:50:07 guilherme-pc wiki: # __METHOD__ returns Resource id #198
- 2019-09-17 17:50:07 guilherme-pc wiki: ldap_set_option( $linkID, $option = 17, $newval = 3 );
- 2019-09-17 17:50:07 guilherme-pc wiki: # returns 1
- 2019-09-17 17:50:07 guilherme-pc wiki: ldap_set_option( $linkID, $option = 8, $newval = 0 );
- 2019-09-17 17:50:07 guilherme-pc wiki: # returns 1
- 2019-09-17 17:50:07 guilherme-pc wiki: ldap_set_option( $linkID, $option = 2, $newval = 1 );
- 2019-09-17 17:50:07 guilherme-pc wiki: # returns 1
- 2019-09-17 17:50:07 guilherme-pc wiki: ldap_bind( $linkID, $bindRDN = 'uid=guilherme_bangemann,ou=users,dc=solis,dc=coop,dc=br', $bindPassword = 'XXXX' );
- 2019-09-17 17:50:07 guilherme-pc wiki: # returns 1
- 2019-09-17 17:50:07 guilherme-pc wiki: ldap_search( $linkID, $baseDN = 'dc=solis,dc=coop,dc=br', $filter = '(uid=guilherme_bangemann)', $attributes = [ '*', 'memberof' ], $attrsonly = , $sizelimit = , $timelimit = , $deref = );
- 2019-09-17 17:50:07 guilherme-pc wiki: # returns Resource id #216
- 2019-09-17 17:50:07 guilherme-pc wiki: ldap_get_entries( $linkID, $resultID );
- 2019-09-17 17:50:07 guilherme-pc wiki: # returns: array (
- 'count' => 1,
- 0 =>
- array (
- 'objectclass' =>
- array (
- 'count' => 6,
- 0 => 'sambaSamAccount',
- 1 => 'shadowAccount',
- 2 => 'posixAccount',
- 3 => 'inetOrgPerson',
- 4 => 'organizationalPerson',
- 5 => 'person',
- ),
- 0 => 'objectclass',
- 'sambadomainname' =>
- array (
- 'count' => 1,
- 0 => 'SOLIS',
- ),
- 1 => 'sambadomainname',
- 'displayname' =>
- array (
- 'count' => 1,
- 0 => 'Guilherme Keunecke Bangemann',
- ),
- 2 => 'displayname',
- 'sambahomedrive' =>
- array (
- 'count' => 1,
- 0 => 'U:',
- ),
- 3 => 'sambahomedrive',
- 'sambakickofftime' =>
- array (
- 'count' => 1,
- 0 => '1893463200',
- ),
- 4 => 'sambakickofftime',
- 'sambaprimarygroupsid' =>
- array (
- 'count' => 1,
- 0 => 'S-1-5-21-2804338137-552302570-2244938293-513',
- ),
- 5 => 'sambaprimarygroupsid',
- 'sambaacctflags' =>
- array (
- 'count' => 1,
- 0 => '[XU ]',
- ),
- 6 => 'sambaacctflags',
- 'sambasid' =>
- array (
- 'count' => 1,
- 0 => 'S-1-5-21-2804338137-552302570-2244938293-21792',
- ),
- 7 => 'sambasid',
- 'shadowwarning' =>
- array (
- 'count' => 1,
- 0 => '10',
- ),
- 8 => 'shadowwarning',
- 'shadowinactive' =>
- array (
- 'count' => 1,
- 0 => '10',
- ),
- 9 => 'shadowinactive',
- 'shadowmin' =>
- array (
- 'count' => 1,
- 0 => '1',
- ),
- 10 => 'shadowmin',
- 'shadowmax' =>
- array (
- 'count' => 1,
- 0 => '365',
- ),
- 11 => 'shadowmax',
- 'homedirectory' =>
- array (
- 'count' => 1,
- 0 => '/home/guilherme',
- ),
- 12 => 'homedirectory',
- 'loginshell' =>
- array (
- 'count' => 1,
- 0 => '/bin/bash',
- ),
- 13 => 'loginshell',
- 'gidnumber' =>
- array (
- 'count' => 1,
- 0 => '10001',
- ),
- 14 => 'gidnumber',
- 'cn' =>
- array (
- 'count' => 1,
- 0 => 'Guilherme Keunecke Bangemann',
- ),
- 15 => 'cn',
- 'uidnumber' =>
- array (
- 'count' => 1,
- 0 => '10396',
- ),
- 16 => 'uidnumber',
- 'sn' =>
- array (
- 'count' => 1,
- 0 => 'Bangemann',
- ),
- 17 => 'sn',
- 'givenname' =>
- array (
- 'count' => 1,
- 0 => 'Guilherme Keunecke',
- ),
- 18 => 'givenname',
- 'departmentnumber' =>
- array (
- 'count' => 1,
- 0 => 'Setor de Infraestrutura',
- ),
- 19 => 'departmentnumber',
- 'uid' =>
- array (
- 'count' => 1,
- 0 => 'guilherme_bangemann',
- ),
- 20 => 'uid',
- 'mail' =>
- array (
- 'count' => 1,
- 0 => 'guilherme_bangemann@solis.com.br',
- ),
- 21 => 'mail',
- 'sambantpassword' =>
- array (
- 'count' => 1,
- 0 => 'A7C1B218F8E637AA62F59D31F76DFBCD',
- ),
- 22 => 'sambantpassword',
- 'sambapwdlastset' =>
- array (
- 'count' => 1,
- 0 => '1559650352',
- ),
- 23 => 'sambapwdlastset',
- 'shadowlastchange' =>
- array (
- 'count' => 1,
- 0 => '18051',
- ),
- 24 => 'shadowlastchange',
- 'userpassword' =>
- array (
- 'count' => 1,
- 0 => '{CRYPT}$1$wn6dubOY$obSU01DXY2wolpTXxXLEq1',
- ),
- 25 => 'userpassword',
- 'count' => 26,
- 'dn' => 'uid=guilherme_bangemann,ou=users,dc=solis,dc=coop,dc=br',
- ),
- )
- 2019-09-17 17:50:12 guilherme-pc wiki: ldap_connect( $hostname = 'ldap://ldapslave.solis.com.br:389', $port = 389 );
- 2019-09-17 17:50:12 guilherme-pc wiki: # __METHOD__ returns Resource id #198
- 2019-09-17 17:50:12 guilherme-pc wiki: ldap_set_option( $linkID, $option = 17, $newval = 3 );
- 2019-09-17 17:50:12 guilherme-pc wiki: # returns 1
- 2019-09-17 17:50:12 guilherme-pc wiki: ldap_set_option( $linkID, $option = 8, $newval = 0 );
- 2019-09-17 17:50:12 guilherme-pc wiki: # returns 1
- 2019-09-17 17:50:12 guilherme-pc wiki: ldap_set_option( $linkID, $option = 2, $newval = 1 );
- 2019-09-17 17:50:12 guilherme-pc wiki: # returns 1
- 2019-09-17 17:50:12 guilherme-pc wiki: ldap_bind( $linkID, $bindRDN = 'uid=guilherme_bangemann,ou=users,dc=solis,dc=coop,dc=br', $bindPassword = 'XXXX' );
- 2019-09-17 17:50:12 guilherme-pc wiki: # returns 1
- 2019-09-17 17:50:12 guilherme-pc wiki: ldap_search( $linkID, $baseDN = 'dc=solis,dc=coop,dc=br', $filter = '(uid=guilherme_bangemann)', $attributes = [ '*', 'memberof' ], $attrsonly = , $sizelimit = , $timelimit = , $deref = );
- 2019-09-17 17:50:12 guilherme-pc wiki: # returns Resource id #214
- 2019-09-17 17:50:12 guilherme-pc wiki: ldap_get_entries( $linkID, $resultID );
- 2019-09-17 17:50:12 guilherme-pc wiki: # returns: array (
- 'count' => 1,
- 0 =>
- array (
- 'objectclass' =>
- array (
- 'count' => 6,
- 0 => 'sambaSamAccount',
- 1 => 'shadowAccount',
- 2 => 'posixAccount',
- 3 => 'inetOrgPerson',
- 4 => 'organizationalPerson',
- 5 => 'person',
- ),
- 0 => 'objectclass',
- 'sambadomainname' =>
- array (
- 'count' => 1,
- 0 => 'SOLIS',
- ),
- 1 => 'sambadomainname',
- 'displayname' =>
- array (
- 'count' => 1,
- 0 => 'Guilherme Keunecke Bangemann',
- ),
- 2 => 'displayname',
- 'sambahomedrive' =>
- array (
- 'count' => 1,
- 0 => 'U:',
- ),
- 3 => 'sambahomedrive',
- 'sambakickofftime' =>
- array (
- 'count' => 1,
- 0 => '1893463200',
- ),
- 4 => 'sambakickofftime',
- 'sambaprimarygroupsid' =>
- array (
- 'count' => 1,
- 0 => 'S-1-5-21-2804338137-552302570-2244938293-513',
- ),
- 5 => 'sambaprimarygroupsid',
- 'sambaacctflags' =>
- array (
- 'count' => 1,
- 0 => '[XU ]',
- ),
- 6 => 'sambaacctflags',
- 'sambasid' =>
- array (
- 'count' => 1,
- 0 => 'S-1-5-21-2804338137-552302570-2244938293-21792',
- ),
- 7 => 'sambasid',
- 'shadowwarning' =>
- array (
- 'count' => 1,
- 0 => '10',
- ),
- 8 => 'shadowwarning',
- 'shadowinactive' =>
- array (
- 'count' => 1,
- 0 => '10',
- ),
- 9 => 'shadowinactive',
- 'shadowmin' =>
- array (
- 'count' => 1,
- 0 => '1',
- ),
- 10 => 'shadowmin',
- 'shadowmax' =>
- array (
- 'count' => 1,
- 0 => '365',
- ),
- 11 => 'shadowmax',
- 'homedirectory' =>
- array (
- 'count' => 1,
- 0 => '/home/guilherme',
- ),
- 12 => 'homedirectory',
- 'loginshell' =>
- array (
- 'count' => 1,
- 0 => '/bin/bash',
- ),
- 13 => 'loginshell',
- 'gidnumber' =>
- array (
- 'count' => 1,
- 0 => '10001',
- ),
- 14 => 'gidnumber',
- 'cn' =>
- array (
- 'count' => 1,
- 0 => 'Guilherme Keunecke Bangemann',
- ),
- 15 => 'cn',
- 'uidnumber' =>
- array (
- 'count' => 1,
- 0 => '10396',
- ),
- 16 => 'uidnumber',
- 'sn' =>
- array (
- 'count' => 1,
- 0 => 'Bangemann',
- ),
- 17 => 'sn',
- 'givenname' =>
- array (
- 'count' => 1,
- 0 => 'Guilherme Keunecke',
- ),
- 18 => 'givenname',
- 'departmentnumber' =>
- array (
- 'count' => 1,
- 0 => 'Setor de Infraestrutura',
- ),
- 19 => 'departmentnumber',
- 'uid' =>
- array (
- 'count' => 1,
- 0 => 'guilherme_bangemann',
- ),
- 20 => 'uid',
- 'mail' =>
- array (
- 'count' => 1,
- 0 => 'guilherme_bangemann@solis.com.br',
- ),
- 21 => 'mail',
- 'sambantpassword' =>
- array (
- 'count' => 1,
- 0 => 'A7C1B218F8E637AA62F59D31F76DFBCD',
- ),
- 22 => 'sambantpassword',
- 'sambapwdlastset' =>
- array (
- 'count' => 1,
- 0 => '1559650352',
- ),
- 23 => 'sambapwdlastset',
- 'shadowlastchange' =>
- array (
- 'count' => 1,
- 0 => '18051',
- ),
- 24 => 'shadowlastchange',
- 'userpassword' =>
- array (
- 'count' => 1,
- 0 => '{CRYPT}$1$wn6dubOY$obSU01DXY2wolpTXxXLEq1',
- ),
- 25 => 'userpassword',
- 'count' => 26,
- 'dn' => 'uid=guilherme_bangemann,ou=users,dc=solis,dc=coop,dc=br',
- ),
- )
- ----
- cat LDAPProvider.log
- ----2019-09-17 17:50:01 guilherme-pc wiki: Setting LDAP_OPT_PROTOCOL_VERSION to 3
- 2019-09-17 17:50:01 guilherme-pc wiki: Setting LDAP_OPT_REFERRALS to 0
- 2019-09-17 17:50:01 guilherme-pc wiki: Setting LDAP_OPT_DEREF to 1
- 2019-09-17 17:50:02 guilherme-pc wiki: MediaWiki\Extension\LDAPProvider\Client::getSearchString: User DN is: 'solis\guilherme_bangemann'
- 2019-09-17 17:50:07 guilherme-pc wiki: Setting LDAP_OPT_PROTOCOL_VERSION to 3
- 2019-09-17 17:50:07 guilherme-pc wiki: Setting LDAP_OPT_REFERRALS to 0
- 2019-09-17 17:50:07 guilherme-pc wiki: Setting LDAP_OPT_DEREF to 1
- 2019-09-17 17:50:07 guilherme-pc wiki: Ran LDAP search for '(uid=guilherme_bangemann)' in 0.0060989856719971 seconds.
- 2019-09-17 17:50:12 guilherme-pc wiki: Setting LDAP_OPT_PROTOCOL_VERSION to 3
- 2019-09-17 17:50:12 guilherme-pc wiki: Setting LDAP_OPT_REFERRALS to 0
- 2019-09-17 17:50:12 guilherme-pc wiki: Setting LDAP_OPT_DEREF to 1
- 2019-09-17 17:50:12 guilherme-pc wiki: Ran LDAP search for '(uid=guilherme_bangemann)' in 0.0033810138702393 seconds.
- ----
- cat PluggableAuth.log
- ----2019-09-17 17:50:41 guilherme-pc wiki: In execute()
- 2019-09-17 17:50:41 guilherme-pc wiki: Getting PluggableAuth singleton
- 2019-09-17 17:50:41 guilherme-pc wiki: Class name: MediaWiki\Extension\LDAPAuthentication2\PluggableAuth
- 2019-09-17 17:50:41 guilherme-pc wiki: Authentication failure.
- 2019-09-17 17:50:41 guilherme-pc wiki: ERROR: Could not authenticate credentials against domain "solis"
- ----
Guilherme bangemann (talk) 17:57, 17 September 2019 (UTC) - ## LOGS
$wgDebugLogFile = "/var/log/wiki/debugLDAP-{$wgDBname}.log";$wgDebugLogGroups['PluggableAuth'] = "/var/log/wiki/PluggableAuth.log";$wgDebugLogGroups['LDAP'] = "/var/log/wiki/LDAP.log";$wgDebugLogGroups['MediaWiki\\Extension\\LDAPProvider\\Client'] = "/var/log/wiki/LDAPProvider.log";$wgDebugLogGroups['LDAPGroups'] = "/var/log/wiki/LDAPGroups.log";$wgDebugLogGroups['LDAPUserInfo'] = "/var/log/wiki/LDAPUserInfo.log";$wgDebugLogGroups['LDAPAuthorization'] = "/var/log/wiki/LDAPAuthorization.log";Guilherme bangemann (talk) 17:58, 17 September 2019 (UTC)- I can see a two things here:
- The search string
"searchstring" => "solis\\USER-NAME",looks odd. This should probably be"searchstring" => "uid=USER-NAME,ou=users,dc=solis,dc=coop,dc=br",. Please also try to unset "searchstring" completely. - You have configured "GroupMember" as "grouprequest", yet I can see from the logs that "UserMemberOf" is used. Therefore no usergroups are being returned. I can not explain this behavior, but it is probably not connected to the "authentication" issue. It would only be an issue when it comes to "authorization" (after "authentication"). Osnard (talk) 06:24, 19 September 2019 (UTC)
- "searchstring" => uid=USER-NAME,ou=users,dc=solis,dc=coop,dc=br OK -- I'll try to unset completely to see the 'return'
- Yes, I saw that now. And thank you! I'll put here the logs. Another question... So the problem it is in Authorization and Authentication? Guilherme bangemann (talk) 11:44, 19 September 2019 (UTC)
- The search string
- Question:
- - Why it's authenticating a new user if it exists? I'll see the Authentication and Authorization configurations page.
- BASH
- ----
guilherme_bangemann@guilherme-pc:/var/www/wiki$ sudo php extensions/LDAPProvider/maintenance/CheckLogin.php -d solis -u guilherme_bangemann Password:********OK- ----
- WIKI
- ----When I try to log on site:
- User guilherme_bangemann not autorized
- ----
- LDAP.log
- ----
2019-09-19 12:04:21 guilherme-pc wiki: ldap_connect( $hostname = 'ldap://ldapslave.solis.com.br:389', $port = 389 ); 2019-09-19 12:04:21 guilherme-pc wiki: # __METHOD__ returns Resource id #212019-09-19 12:04:21 guilherme-pc wiki: ldap_set_option( $linkID, $option = 17, $newval = 3 );2019-09-19 12:04:21 guilherme-pc wiki: # returns 12019-09-19 12:04:21 guilherme-pc wiki: ldap_set_option( $linkID, $option = 8, $newval = 0 );2019-09-19 12:04:21 guilherme-pc wiki: # returns 12019-09-19 12:04:21 guilherme-pc wiki: ldap_set_option( $linkID, $option = 2, $newval = 1 );2019-09-19 12:04:21 guilherme-pc wiki: # returns 12019-09-19 12:04:21 guilherme-pc wiki: ldap_bind( $linkID, $bindRDN = 'uid=guilherme_bangemann,ou=users,dc=solis,dc=coop,dc=br', $bindPassword = 'XXXX' );2019-09-19 12:04:21 guilherme-pc wiki: # returns 12019-09-19 12:04:21 guilherme-pc wiki: ldap_bind( $linkID, $bindRDN = 'uid=guilherme_bangemann,ou=users,dc=solis,dc=coop,dc=br', $bindPassword = 'XXXX' );2019-09-19 12:04:21 guilherme-pc wiki: # returns 12019-09-19 12:04:21 guilherme-pc wiki: ldap_bind( $linkID, $bindRDN = 'uid=guilherme_bangemann,ou=users,dc=solis,dc=coop,dc=br', $bindPassword = 'XXXX' );2019-09-19 12:04:21 guilherme-pc wiki: # returns 12019-09-19 12:04:21 guilherme-pc wiki: ldap_search( $linkID, $baseDN = 'dc=solis,dc=coop,dc=br', $filter = '(uid=guilherme_bangemann)', $attributes = [ '*', 'memberof' ], $attrsonly = , $sizelimit = , $timelimit = , $deref = );2019-09-19 12:04:21 guilherme-pc wiki: # returns Resource id #422019-09-19 12:04:21 guilherme-pc wiki: ldap_get_entries( $linkID, $resultID );2019-09-19 12:04:21 guilherme-pc wiki: # returns: array ( ... )2019-09-19 12:04:21 guilherme-pc wiki: ldap_search( $linkID, $baseDN = 'dc=solis,dc=coop,dc=br', $filter = '(uid=guilherme_bangemann)', $attributes = [ '*', 'memberof' ], $attrsonly = , $sizelimit = , $timelimit = , $deref = );2019-09-19 12:04:21 guilherme-pc wiki: # returns Resource id #552019-09-19 12:04:21 guilherme-pc wiki: ldap_count_entries( $linkiID, $result = 'Resource id #55' );2019-09-19 12:04:21 guilherme-pc wiki: # returns 12019-09-19 12:04:21 guilherme-pc wiki: ldap_get_entries( $linkID, $resultID );2019-09-19 12:04:21 guilherme-pc wiki: # returns: array ( ... )2019-09-19 12:04:21 guilherme-pc wiki: ldap_search( $linkID, $baseDN = 'dc=solis,dc=coop,dc=br', $filter = '(&(objectclass=group)(member=uid=guilherme_bangemann,ou=users,dc=solis,dc=coop,dc=br))', $attributes = [ 'dn' ], $attrsonly = , $sizelimit = , $timelimit = , $deref = );2019-09-19 12:04:21 guilherme-pc wiki: # returns Resource id #632019-09-19 12:04:21 guilherme-pc wiki: ldap_get_entries( $linkID, $resultID );2019-09-19 12:04:21 guilherme-pc wiki: # returns: array ('count' => 0,)- ----
- LDAPProvider.log
- ----
2019-09-19 12:04:21 guilherme-pc wiki: Setting LDAP_OPT_PROTOCOL_VERSION to 3 2019-09-19 12:04:21 guilherme-pc wiki: Setting LDAP_OPT_REFERRALS to 02019-09-19 12:04:21 guilherme-pc wiki: Setting LDAP_OPT_DEREF to 12019-09-19 12:04:21 guilherme-pc wiki: MediaWiki\Extension\LDAPProvider\Client::getSearchString: User DN is: 'uid=guilherme_bangemann,ou=users,dc=solis,dc=coop,dc=br'2019-09-19 12:04:21 guilherme-pc wiki: Ran LDAP search for '(uid=guilherme_bangemann)' in 0.0050511360168457 seconds.2019-09-19 12:04:21 guilherme-pc wiki: MediaWiki\Extension\LDAPProvider\Client::getUserDN: search with array ('base' => 'dc=solis,dc=coop,dc=br','filter' => '(uid=guilherme_bangemann)','attributes' =>array (0 => '*',1 => 'memberof',),)2019-09-19 12:04:21 guilherme-pc wiki: Found user DN: 'uid=guilherme_bangemann,ou=users,dc=solis,dc=coop,dc=br'2019-09-19 12:04:21 guilherme-pc wiki: Ran LDAP search for '(&(objectclass=group)(member=uid=guilherme_bangemann,ou=users,dc=solis,dc=coop,dc=br))' in 0.0033600330352783 seconds.- ----
- PluggableAuth.log
- ----
2019-09-19 12:04:21 guilherme-pc wiki: In execute() 2019-09-19 12:04:21 guilherme-pc wiki: Getting PluggableAuth singleton2019-09-19 12:04:21 guilherme-pc wiki: Class name: MediaWiki\Extension\LDAPAuthentication2\PluggableAuth2019-09-19 12:04:21 guilherme-pc wiki: Authenticated new user: guilherme_bangemann2019-09-19 12:04:21 guilherme-pc wiki: Authorization failure.- ----
Guilherme bangemann (talk) 12:23, 19 September 2019 (UTC)- So, as
CheckLogin.phpreturnsOK, we can assume that authentiation works. Also the error message on the form-based-authentication is "User guilherme_bangemann not authorized". So the the reason must be in the authorization part. - From your config I can see, that you restrict login capability to users from LDAP group
"ou=users,dc=solis,dc=coop,dc=br"(actually, this does not look like a usual group DN). Is this group listed, when you executeShowUserGroups.phpfor that particular user? Osnard (talk) 12:53, 19 September 2019 (UTC) - When I execute
ShowUserGroups.phpfor this user "guilherme_bangemann", returns nothing. (null) php extensions/LDAPProvider/maintenance/ShowUserGroups.php -d solis -u guilherme_bangemannFull DNs:Short names:LocalSettings.php- ----
... "grouprequest" => "MediaWiki\\Extension\\LDAPProvider\\UserGroupsRequest\\GroupMember::factory"],"groupsync" => ["mechanism" => "mappedgroups","mapping" => ["users" => "ou=users,dc=solis,dc=coop,dc=br","mailaliases" => "ou=mailaliases,dc=solis,dc=coop,dc=br","groups" => "ou=groups,dc=solis,dc=coop,dc=br"] ......"authorization" => ["rules" => ["attributes" => [],"groups" => ["required" => [ "ou=users" ]] ...$wgSyncMechanismRegistry = "mappedgroups";$LDAPAuthentication2UsernameNormalizer = 'strtolower';$LDAPAuthentication2AllowLocalLogin = false;$wgAutoAuthRemoteUserStringParser = "domain-backslash-username"; //"username-at-domain";Guilherme bangemann (talk) 14:03, 19 September 2019 (UTC)- When I execute this command
ldapsearch -b dc=solis,dc=coop,dc=br -W -h ldapslave.solis.com.br -D uid=guilherme_bangemann,ou=users,dc=solis,dc=coop,dc=brreturns all LDAP user's, and I saw that has anothers groups, likemailaliasesandgroups - ----
# guilherme_bangemann, users, solis.coop.br dn: uid=guilherme_bangemann,ou=users,dc=solis,dc=coop,dc=brobjectClass: sambaSamAccountobjectClass: shadowAccountobjectClass: posixAccountobjectClass: inetOrgPersonobjectClass: organizationalPersonobjectClass: personsambaDomainName: SOLISdisplayName: Guilherme Keunecke BangemannsambaHomeDrive: U:sambaKickoffTime: **********sambaPrimaryGroupSID: ***********sambaAcctFlags: [** ]sambaSID: **********shadowWarning: 10shadowInactive: 10shadowMin: 1shadowMax: 365homeDirectory: /home/guilhermeloginShell: /bin/bashgidNumber: ******cn: Guilherme Keunecke BangemannuidNumber: ******sn: BangemanngivenName: Guilherme KeuneckedepartmentNumber: Setor de Infraestruturauid: guilherme_bangemannmail: guilherme_bangemann@solis.com.brsambaNTPassword: ******************************sambaPwdLastSet: *************shadowLastChange: ******userPassword:: *********************************************************- ----
Guilherme bangemann (talk) 14:09, 19 September 2019 (UTC) - If
ShowUserGroups.phpreturns nothing it is clear that authorization fails, as you have set a required group. You will probably need to configure a differentgrouprequest. At the moment you haveMediaWiki\\Extension\\LDAPProvider\\UserGroupsRequest\\GroupMember::factory. Please tryMediaWiki\\Extension\\LDAPProvider\\UserGroupsRequest\\GroupUniqueMember::factoryMediaWiki\\Extension\\LDAPProvider\\UserGroupsRequest\\UserMemberOf::factory
- and test each with
ShowUserGroups.php. Osnard (talk) 06:57, 20 September 2019 (UTC) MediaWiki\\Extension\\LDAPProvider\\UserGroupsRequest\\GroupUniqueMember::factory- Return the same thing when I use
GroupMember - ----
MediaWiki\\Extension\\LDAPProvider\\UserGroupsRequest\\UserMemberOf::factory sudo php extensions/LDAPProvider/maintenance/ShowUserGroups.php -d solis -u guilherme_bangemannPHP Notice: Undefined index: memberof in /var/lib/wiki/extensions/LDAPProvider/src/UserGroupsRequest/UserMemberOf.php on line 19Notice: Undefined index: memberof in /var/lib/wiki/extensions/LDAPProvider/src/UserGroupsRequest/UserMemberOf.php on line 19Full DNs:PHP Warning: Invalid argument supplied for foreach() in /var/lib/wiki/extensions/LDAPProvider/maintenance/ShowUserGroups.php on line 59Warning: Invalid argument supplied for foreach() in /var/lib/wiki/extensions/LDAPProvider/maintenance/ShowUserGroups.php on line 59Short names:PHP Warning: Invalid argument supplied for foreach() in /var/lib/wiki/extensions/LDAPProvider/src/GroupList.php on line 52Warning: Invalid argument supplied for foreach() in /var/lib/wiki/extensions/LDAPProvider/src/GroupList.php on line 52- ----
- May be
"groupsync" => [or"authorization" => [?? Or in my config this is OK?
Guilherme bangemann (talk) 18:02, 25 September 2019 (UTC)- Okay, obviously
MemberOfis not the right choice. So it should beGroupMemberorGroupUniqueMember. Can you please give me an example of a "group" object in your LDAP? Full DN and attributes? - BTW: In
authorization.rules.groups.requiredyou should use a full group DN. The value"ou=users"is probably wrong. It should proably be"ou=users,dc=solis,dc=coop,dc=br"Osnard (talk) 07:08, 30 September 2019 (UTC) - FULL DN and attributes examples:
- ----
# felipe_dahmer, users, solis.coop.br dn: uid=felipe_dahmer,ou=users,dc=solis,dc=coop,dc=brsambaDomainName: SOLISdisplayName: Felipe Augusto Dahmeruid: felipe_dahmercn: Felipe Augusto Dahmermail: felipe_dahmer@solis.com.brsn: Dahmer# janete, users, solis.coop.brdn: uid=janete,ou=users,dc=solis,dc=coop,dc=brsambaDomainName: SOLISdisplayName: Janete Beckeruid: janetecn: Janete Beckermail: janete@solis.com.brsn: Becker# solis-pml, mailaliases, solis.coop.brdn: cn=solis-pml,ou=mailaliases,dc=solis,dc=coop,dc=brobjectClass: nisMailAliascn: solis-pml# alerta-ucpel, mailaliases, solis.coop.brdn: cn=alerta-ucpel,ou=mailaliases,dc=solis,dc=coop,dc=brcn: alerta-ucpel# guilherme_bangemann, users, solis.coop.brdn: uid=guilherme_bangemann,ou=users,dc=solis,dc=coop,dc=brsambaDomainName: SOLISdisplayName: Guilherme Keunecke Bangemanncn: Guilherme Keunecke Bangemannsn: Bangemannuid: guilherme_bangemannmail: guilherme_bangemann@solis.com.br# sandroroberto, users, solis.coop.brdn: uid=sandroroberto,ou=users,dc=solis,dc=coop,dc=brsambaDomainName: SOLISdisplayName: Sandro Roberto Thomecn: Sandro Roberto Thomesn: Thomeuid: sandrorobertomail: sandroroberto@solis.com.br# newsletter, users, solis.coop.brdn: uid=newsletter,ou=users,dc=solis,dc=coop,dc=brsambaDomainName: SOLISdisplayName: Newsletter Solisuid: newslettercn: Newsletter Solismail: newsletter@solis.com.brsn: Solis- ----
- ALL ATTRIBUTES to filter:
- ----
# guilherme_bangemann, users, solis.coop.br dn: uid=guilherme_bangemann,ou=users,dc=solis,dc=coop,dc=brobjectClass:sambaDomainName:displayName:sambaHomeDrive:sambaKickoffTime:sambaPrimaryGroupSID:sambaAcctFlags:sambaSID:shadowWarning:shadowInactive:shadowMin:shadowMax:homeDirectory:loginShell:gidNumber:cn:uidNumber:sn:givenName:departmentNumber:uid:mail:sambaNTPassword:sambaPwdLastSet:shadowLastChange:userPassword::Guilherme bangemann (talk) 14:42, 2 October 2019 (UTC)- OK, I changed the code here
sudo vim www/wiki/extensions/LDAPProvider/src/UserGroupsRequest/GroupMember.php - ----LINE 31:
$groups = $this->ldapClient->search("(objectClass=*)",// "(&(objectclass=group)(member=$userDN))",$baseDN, [ $dn ]);- I just put
"(objectClass=*)", - and commented
"(&(objectclass=group)(member=$userDN))", - ----RETURNED ALL FULL DNs of ALL members and ALL short names of them... How can I filter this to just return my
dnand myshort name?: - guilherme_bangemann@guilherme-pc:/var/www/wiki$
sudo php /var/www/wiki/extensions/LDAPProvider/maintenance/ShowUserGroups.php -d solis -u guilherme_bangemann Full DNs:dc=solis,dc=coop,dc=brou=users,dc=solis,dc=coop,dc=brou=groups,dc=solis,dc=coop,dc=brou=computers,dc=solis,dc=coop,dc=bruid=niumar,ou=users,dc=solis,dc=coop,dc=brcn=solis,ou=groups,dc=solis,dc=coop,dc=bruid=taffarel,ou=users,dc=solis,dc=coop,dc=bruid=guilherme_bangemann,ou=users,dc=solis,dc=coop,dc=bruid=sandroroberto,ou=users,dc=solis,dc=coop,dc=bruid=newsletter,ou=users,dc=solis,dc=coop,dc=brShort names:solisusersgroupscomputers...lucas_hornfelipe_dahmerjanetesolis-pmlalerta-ucpelguilherme_bangemannsandroroberto...newsletterGuilherme bangemann (talk) 15:00, 3 October 2019 (UTC)- Okay, so this change made it work? If so, we can assume this to be a bug and put in a configuration option into the extension Osnard (talk) 11:22, 4 October 2019 (UTC)
- It's working. I tried with 2 members of group users. I'll try with another groups and then I'll return here.
- About the "bug", may be a bug, but I can't be sure. Will be good if put in a configuration option into the extension, this would help the others.
- Thank you @Osnard. When I'm sure, I'll close the ticked.. OK? :D
Guilherme bangemann (talk) 15:01, 4 October 2019 (UTC)- Added this to https://phabricator.wikimedia.org/T214146#5551025 Osnard (talk) 08:46, 7 October 2019 (UTC)
- Ok! Thank You!
- I think it's ok from now.. Thank you @Osnard for your attention. Any problem I'll re-open this ticket.
- edit /var/www/wiki/extensions/LDAPProvider/src/UserGroupsRequest/GroupMember.php
- LINE 31:
- ```
$groups = $this->ldapClient->search("(objectClass=*)",// "(&(objectclass=group)(member=$userDN))",$baseDN, [ $dn ]);- ```
- CHANGE "(&(objectclass=group)(member=$userDN))", TO "(objectClass=*)",. Guilherme bangemann (talk) 17:44, 7 October 2019 (UTC)
- This change looks strange. This basically means the you query _all_ LDAP objects (users, groups, etc.) and not just group objects that are assigned to a certain user. Are you sure this search delivers the required information? Osnard (talk) 14:00, 15 December 2020 (UTC)
Connect to german ad
[edit]I´m implementing an connect to a German windows ad. ShowUserInfo and ShowUserGroups are working. When I try CheckLogin, it is asking for the password. After typing in the correct user-password (shown on terminal) the check is FAILED. It should just check if the user is member of domain-users and of course if password OK?
LDAP.log
2019-10-21 14:52:17 wikisrv.company.local naviwiki: ldap_connect( $hostname = 'ldap://dc1.company.local:389', $port = 389 ); 2019-10-21 14:52:17 wikisrv.company.local naviwiki: # __METHOD__ returns Resource id #192 2019-10-21 14:52:17 wikisrv.company.local naviwiki: ldap_set_option( $linkID, $option = 17, $newval = 3 ); 2019-10-21 14:52:17 wikisrv.company.local naviwiki: # returns 1 2019-10-21 14:52:17 wikisrv.company.local naviwiki: ldap_set_option( $linkID, $option = 8, $newval = 0 ); 2019-10-21 14:52:17 wikisrv.company.local naviwiki: # returns 1 2019-10-21 14:52:17 wikisrv.company.local naviwiki: ldap_set_option( $linkID, $option = 2, $newval = 1 ); 2019-10-21 14:52:17 wikisrv.company.local naviwiki: # returns 1 2019-10-21 14:52:17 wikisrv.company.local naviwiki: ldap_bind( $linkID, $bindRDN = 'cn=Administrator,cn=Users,dc=company,dc=local', $bindPassword = 'XXXX' ); 2019-10-21 14:52:17 wikisrv.company.local naviwiki: # returns 1 2019-10-21 14:52:17 wikisrv.company.local naviwiki: ldap_bind( $linkID, $bindRDN = 'uid=Mueller,cn=Domänen-Benutzer,cn=Users,dc=company,dc=local', $bindPassword = 'XXXX' ); 2019-10-21 14:52:17 wikisrv.company.local naviwiki: # returns
Thanks for helping 193.158.60.202 (talk) 15:10, 21 October 2019 (UTC)
- So this just says that the server could not bind with the user
'uid=Mueller,cn=Domänen-Benutzer,cn=Users,dc=company,dc=local'and the given password. Can you confirm that the User-DN was assembles correctly from the given username? Maybe the UserBaseDN is not set correctly. Is the password definitively correct? - I don't think that the Umlaut in "Domänen-Benutzer" is an issue. Osnard (talk) 09:21, 25 October 2019 (UTC)
Auto-creation of a local account failed: Automatic account creation is not allowed
[edit]Hi,
I recently installed Bluespice Free 3.1 and tried to get LDAP Authentication working against an Active Directory.
So far I am able to log in using the account I created at installation, but with the password from AD (Account names are the same).
However, when I try to login with another account, the login form says (in German):
"Auto-creation of a local account failed:
Automatic account creation is not allowed"
Here is my config (relevant parts)
$wgGroupPermissions['*']['createaccount'] = false;
$wgGroupPermissions['*']['autocreateaccount'] = true;
wfLoadExtension( 'PluggableAuth' );
wfLoadExtension( 'LDAPProvider' );
wfLoadExtension( 'LDAPAuthentication2' );
wfLoadExtension( 'LDAPAuthorization' );
$LDAPProviderCacheTime = "1";
$LDAPProviderDomainConfigProvider = function() {
$config = [
'mydomain.com' => [
'connection' => [
"server" => "dc.mydomain.com",
"user" => "binduser@mydomain.com",
"pass" => "password",
"options" => [
"LDAP_OPT_DEREF" => 1
],
"basedn" => "DC=mydomain,DC=com",
"enctype" => "clear",
"port" => "389",
"groupbasedn" => "DC=mydomain,DC=com",
"userbasedn" => "DC=mydomain,DC=com",
"searchattribute" => "samaccountname",
"grouprequest" => "MediaWiki\\Extension\\LDAPProvider\\UserGroupsRequest\\GroupMember::factory",
"searchstring" => "USER-NAME@mydomain.com",
"usernameattribute" => "samaccountname",
"realnameattribute" => "cn",
"emailattribute" => "mail"
],
"authorization" => [
"rules" => [
"groups" => [
"required" => [ "CN=requiredgroup,OU=3,OU=2,OU=1,DC=mydomain,DC=com" ]
]
]
]
]
];
return new \MediaWiki\Extension\LDAPProvider\DomainConfigProvider\InlinePHPArray( $config );
};
$wgDebugLogFile = "/var/www/bluespice/debug-{$wgDBname}.log";
$wgShowExceptionDetails = true;
$wgGroupPermissions['(all)']['autocreateaccount'] = true;
$wgDebugLogGroups['PluggableAuth'] =
$wgDebugLogGroups['LDAP'] =
$wgDebugLogGroups['MediaWiki\\Extension\\LDAPProvider\\Client'] =
$wgDebugLogGroups['LDAPGroups'] =
$wgDebugLogGroups['LDAPUserInfo'] =
$wgDebugLogGroups['LDAPAuthorization'] = '/tmp/LDAP.log';
I would like to emphasize that $wgGroupPermissions['*']['autocreateaccount'] = true; is set and thus auto-account creation to group (all) should be set. However, when checking the "Special:ListGroupRights" page on my wiki, it says group (all) has no rights whatsoever. Is this a peculiarity of BlueSpice?
Also, I can't really seem to get the debug logs for the extensions working somehow (despite setting valid file paths in the wgDebugLogGroups variables, so a pointer on how to set them up to deliver necessary information to debug this would be awesome.
Thanks for reading and your help!
~ Pi 77.87.224.101 (talk) 15:22, 28 October 2019 (UTC)
- This is probably due to the BlueSpice "role-permission-system". You might need to add
$GLOBALS['bsgPermissionConfig']['autocreateaccount'] = [ 'type' => 'global', "roles" => [ 'autocreateaccount' ] ];$GLOBALS['bsgGroupRoles']['*']['autocreateaccount'] = true;- to your
LocalSettings.phpfile. Osnard (talk) 09:14, 1 November 2019 (UTC) - That was exactly it :)
- Thank you very much! 77.87.224.101 (talk) 08:04, 4 November 2019 (UTC)