[SOLVED] Testlink 1.9.3 integration with LDAP server

LATEST Official version.
Questions and discussions - NO ISSUES
FOR ISSUES => http://mantis.testlink.org

Moderators: Amaradana, TurboPT, TL Developers

Post Reply
rajsah
TestLink user
Posts: 6
Joined: Tue Jul 17, 2012 8:33 pm

[SOLVED] Testlink 1.9.3 integration with LDAP server

Post by rajsah »

Hello all,

I have been using Testlink 1.9.3 for my project on centOS 6.2. I have been trying to integrate Testlink with LDAP.

Here is the configuration I am using :

$tlCfg->authentication['method'] = 'LDAP';

/** LDAP authentication credentials */
$tlCfg->authentication['ldap_server'] = 'ldaps://LDAP SERVER'; (I even tried without ldaps://)
$tlCfg->authentication['ldap_port'] = '389';
$tlCfg->authentication['ldap_version'] = '3'; // could be '2' in some cases
$tlCfg->authentication['ldap_root_dn'] = 'dc=LDAP SERVER,dc=se';
$tlCfg->authentication['ldap_organization'] = ''; // e.g. '(organizationname=*Traffic)'
$tlCfg->authentication['ldap_uid_field'] = 'uid=MY_LDAP_USERNAME,ou=Users,ou=Internal,o=COMPANY'; // Use 'sAMAccountName' for Active Directory
$tlCfg->authentication['ldap_bind_dn'] = ''; // Left empty for anonymous LDAP binding
$tlCfg->authentication['ldap_bind_passwd'] = 'MY_LDAP_PASSWORD'; // Left empty for anonymous LDAP binding
$tlCfg->authentication['ldap_tls'] = false; // true -> use tls

/** Enable/disable Users to create accounts on login page */
$tlCfg->user_self_signup = TRUE;

Before I mention the issue, let me mention that my DB user ID is same as that of LDAP. So as per my understanding TestLink should allow me to login as my userID is already present in DB and LDAP (though the passwords are different for DB and LDAP).

Now, I am getting following issues:

While I try to access Testlink, I see the login page but is unable to login using neither my LDAP nor my DB password.
HTTPD log shows: [Mon Jul 30 18:01:50 2012] [error] [client 169.144.61.13] File does not exist: /var/www/html/testlink/gui/themes/default/css/custom.css, referer: http://<testlinkserver>/testlink/login.php

Please let me know if my LDAP authentication settings are OK? If so, please let know why I cannot login to the Testlink using my LDAP or DB password.

Appreciate your help here ...

Thanks in advance !!

Regards
Raj
GunnarD

Re: Testlink 1.9.3 integration with LDAP server

Post by GunnarD »

ldap_uid_field shoud be set not the attribute in LDAP which holds your username, if your LDAP is an AD use sAMAccountName.

The only place to set a username is ldap_bind_dn och the belonging password in ldap_bind_passwd, and this is only needed if you need username/password to bind to your ldap server so that you can send ldap querys.

And ldap_server should be the name of your ldap server (no ldaps://).
rajsah
TestLink user
Posts: 6
Joined: Tue Jul 17, 2012 8:33 pm

Re: Testlink 1.9.3 integration with LDAP server

Post by rajsah »

Thanks GunnarD.

However, even if I use as per your suggestions I face the same issue i.e. the testlink login page says that my password is wrong.

I tried to test the connection to ldap server using Apache Directory Studio. The bind username string and password is exactly the same in both Testlink and Apache Directory Studio. However still the problem persists in TestLink.

I am reposting the LDAP setting as below. Please let me know if I am missing something here.
$tlCfg->authentication['method'] = 'LDAP';

/** LDAP authentication credentials */
$tlCfg->authentication['ldap_server'] = 'ecd.company.se';
$tlCfg->authentication['ldap_port'] = '389';
$tlCfg->authentication['ldap_version'] = '3'; // could be '2' in some cases
$tlCfg->authentication['ldap_root_dn'] = 'ou=Users,ou=Internal,o=company';
$tlCfg->authentication['ldap_organization'] = ''; // e.g. '(organizationname=*Traffic)'
$tlCfg->authentication['ldap_uid_field'] = 'uid'; // Use 'sAMAccountName' for Active Directory
$tlCfg->authentication['ldap_bind_dn'] = 'uid=erajdsa,ou=Users,ou=Internal,o=company'; // Left empty for anonymous LDAP binding
$tlCfg->authentication['ldap_bind_passwd'] = '*******'; // Left empty for anonymous LDAP binding
$tlCfg->authentication['ldap_tls'] = false; // true -> use tls

I also tried running a php code for LDAP setting check successfully. The code below searches for the employee and gets the data like email id, ph etc. The string here used for bind is same as that used in testlink...

Code: Select all

<?php
     echo "LDAP Test ..."; 
     // LDAP variables
     $ldaphost ="ecd.COMPANY.se"; // your ldap servers
     $ldapport = 389;                 // your ldap server's port number
    
     // Connecting to LDAP
     $ldapconn = ldap_connect($ldaphost, $ldapport) or die("Could not connect to $ldaphost" );
     
     echo "Connected ..."; 
     $ldapBinding = ldap_bind( $ldapconn,"uid=USERID,ou=Users,ou=Internal,o=company", "PASSWORD" );
         
     echo "Binding...";
     $attributes = array("displayname","mail","employeenumber","mobile");
     $filter = "(&(objectclass=person)(uid=USERID))";
     $result = ldap_search($ldapconn, "uid=USERID,ou=Users,ou=Internal,o=company", $filter, $attributes);
     $entries = ldap_get_entries($ldapconn, $result);
     print $entries[0]['displayname'][0]."#".$entries[0]['mail'][0]."#".$entries[0]['employeenumber'][0]."#".$entries[0]['mobile'][0];
     exit(0); 
?>   
 
But I am still unable to resolve the LDAP issue of Testlink. Could you please help me out. Is there any change to be done in testlink ?
GunnarD

Re: Testlink 1.9.3 integration with LDAP server

Post by GunnarD »

Your settings seems Ok. I have some similarly settings in my installation that works.

You are running your php testscript on the same machine as the testlink installation? Maybe a firewall needs sometweaking.
rajsah
TestLink user
Posts: 6
Joined: Tue Jul 17, 2012 8:33 pm

Re: Testlink 1.9.3 integration with LDAP server

Post by rajsah »

Yes I had run the php testscript from the same machine.

Finally it is working now !! Thanks a lot for guiding on the right path.
Post Reply