Loading...
 
Skip to main content

Architecture / Installation


LDAP auth

Hi,

I searched through the forums and have found some info on how to get the LDAP working, however, I still have some issues, and was hoping that someone else has already seen and solved it.

I have a iPlanet LDAP server. It allows LDAP v3. I am using EasyPHP on my WinXP. I have 1.8.2 tikiwiki.

I followed the directions on the webpage:
http://tikiwiki.org/tiki-view_faq.php?faqId=10#60Question

After I activated the LDAP in the php.ini, using EasyPHP's interface, I tried,

ldap://<myldap_server>:389/Question on the addressbar in my browser and it popped up a query window. Does this mean that my ldap server allows anonymous authentication?

Without editing the ldap.php, as mentioned on that FAQ, I see that a valid user/password on ldap, returns me to "Invalid User/Password" Page.

If I edit the ldap.php, and use the username and password of a valid user on ldap, to avoid the anonymous login, I get a blank page.

I tried some other message generation, by duplicating some error reporting in the auth.php and ldap.php, but I see that when I print the $password, it returns a blank string. Is this normal?

Any insights into why the ldap authentication is acting like this for me? I don't have PHP knowledge, but any ideas on what I can try in debugging this would be useful too.

Thanks
Hemang


Hemang,

I had the same problem when trying to auth to windows AD. I followed the same directions on that link and was still getting the blank page when I tried to log in. What I had to do is enable the extension php_ldap.dll in php.ini. Make sure it's the php.ini that tiki is using (I had 2 of these files and was editing the wrong one.) To check where the php.ini file is located you can log in as admin on your tiki site and expand the admin menu and click on phpinfo.

Hope this helps.


Hi tiki-user11,

Thanks for taking time to reply to my query. Since I am using EasyPHP, it has a GUI to activate LDAP, which I had done. After reading your reply, I checked the php.ini too, and it is active in there as well. Before I had activated it, I was also getting blank pages, but after I actived ldap in php.ini, I started getting invalid username/password message on a webpage.

tiki-error.php?error=Invalid+username+or+password

Please keep your suggestions coming. I really appreciate it.

Thanks
Hemang


The default rules in LDAP.php may not like your iPlanet install, I had to edit the LDAP.php file to get authentication working here, but it know happily authenticates using LDAPS to our iPlanet directories. First place I'd check is in your LDAP logs to see what's going on, but otherwise you might try editing:
./lib/pear/Auth/Container/LDAP.php
to make the changes along the same lines as the following:

  1. diff ./lib/pear/Auth/Container/LDAP.php ./lib/pear/Auth/Container/LDAP.php.O

204,206c204,205
> $this->options'url' = 'ldaps://ldap.domain.com:636/';
> $this->options'host' = 'ldap.domain.com';
> $this->options'port' = '636';


< $this->options'host' = 'localhost';
< $this->options'port' = '389';
210,212c209,210
> $this->options'userattr' = 'alias';
> $this->options'useroc' = 'person';
> $this->options'usercn' = 'dn';


< $this->options'userattr' = '';
< $this->options'useroc' = '';
285c283
> $func_params = array($this->conn_id, $search_basedn, $filter, array($this->options'usercn'));


< $func_params = array($this->conn_id, $search_basedn, $filter, array($this->options'userattr'));

We use alias as our unique user friendly user name, but for authentication we need the DN returned. You might need something similait.


Thanks robm873. I am waiting for my IT services folks to tell me if there is any requirements in the iPlanet setup to return "dn" or something else.. When I tried to use your settings for returning "dn", I was still receiving the invalid username/password page.

I tried this experiment: In ldap.php I edited the starting of the function fetchdata

function fetchData($username, $password)
{
if($this->debug)
{
// send some error-checking info
$msg = "User: $username\nPwd: $password\n";
foreach($this->options as $key=>$val)
$msg .= "$key: $val\n";
// why that hardcoded value in auth ?
// I feel like it's a very very nasty thing !!!
// mail("da...@mc...", "test in auth_ldap", $msg);
return PEAR::raiseError("Auth_Container_LDAP: ".$msg, 41, PEAR_ERROR_DIE);
$msg = "";
}


The additional line is in bold above. (I also set the debug variable to be 'true' in line 97 in this ldap.php file)

This causes the tikiwiki to display all the variables it has obtained from tiki, and prints it on the browser, before contacting the ldap server. The text on the browser is

Auth_Container_LDAP: User: myuserid Pwd: host: ldapserver port: 389 scope: sub basedn: dc=domain,dc=com userdn: userattr: uid useroc: person usercn: dn groupdn: groupattr: cn groupoc: groupOfUniqueNames memberattr: uniqueMember memberisdn: adminuser: adminpass: membersisdn:

As seen, the value of Pwd: is empty string. Is this correct? If not, why is the string I entered as password do not appear here?

Thanks

Hi,

just made the your modification to my version of LDAP.php and I see my password in the PWD string:

Auth_Container_LDAP: User: myuserid Pwd: mypasswd url: ldaps://ldap.XXX.com:636/Question host: ldap.XXX.com port: 636 scope: sub basedn: o=XXX,c=an userdn: userattr: alias useroc: person usercn: dn groupdn: groupattr: groupoc: memberattr: memberisdn: adminuser: adminpass: membersisdn:

Thanks robm873 for trying out my test..

I am using tiki 1.8.2. Is that the same version at your end?

Thanks
Hemang

It was I've since upgraded to 1.9rc1 but the changes I made to the LDAP.php files are the same.