1

We have a shell script which runs perl program to connect to LDAP server and make entries.

This is the only script which uses ldap. This server is hosting all batch related files and run batch jobs on autosys. So we don't want LDAP authentication on this server. Our only use of ldap is to connect to the LDAP server and update the entries. Some other web application user LDAP authentication which do not concern us now.

Now we are moving our batch servers from Solairs 10 to RHEL 6.6. Old machine has SUNWlldap and we are trying to configure OpenLDAP client on new Linux machine. LDAP server is RHEL 5.11 and is using openldap.

We have installed below rpm's on the new machine.

nss-pam-ldapd-0.7.5-18.2.el6_4.x86_64, 
openldap-2.4.39-8.el6.x86_64, 
pam_ldap-185-11.el6.x86_64, 
apr-util-ldap-1.3.9-3.el6_0.1.x86_64, 
perl-Mozilla-LDAP-1.5.3-4.el6.x86_64, 
compat-openldap-2.3.43-2.el6.x86_64, 
perl-LDAP-0.40-1.el6.noarch.

Configured the client as per the below link:

http://unixadminschool.com/blog/2013/03/rhel-6-implementation-of-ldap-authentication

I have left out certs part. I have searched for the certificates in the old server and but can't found it any where. I don't get how it is connecting without using certs and not sure if we need certs for our purpose.

Below is the script which uses ldap:

$oid001i.pl $input_file $LDAP_Server $LDAP_Port $LDAP_ID $LDAP_PWD $LDAP_UserBaseDN

All these variables are sourced from another file. Below are the contents of the file

LDAP_Server=servername.company.com
LDAP_Port=1389
LDAP_ID="cn=username,cn=users,dc=company,dc=com"
LDAP_PWD="password"
LDAP_UserBaseDN="cn=users,dc=company,dc=com"

Perl code for binding in oid001i.pl:

$ldap = Net::LDAP->new( $LDAP_Server, port=>$LDAP_Port, version => 3);
$mesg = $ldap->bind( $LDAP_ID,password => $LDAP_PWD);
$SearchFor="cn=$cn";
#Perform Search
$mesg = $ldap->search( base   => $LDAP_UserBaseDN, filter => $SearchFor,callback => \&ParseEntry,);

$mesg = $ldap->unbind;   # take down session

When i execute

$perl oid001i.pl input_file server.company.com port "cn=username,cn=users,dc=company,dc=com" password "cn=users,dc=company,dc=com"

We get this error:

Can't call method "bind" on an undefined value at oid001i.pl line 21, <IN> line 1.

I run this command to check the connectivity and got errors:

$ldapsearch -h servername.company.com -p 1389 -LLLx -b 'cn=users,dc=comapany,dc=com' -s base
Cannot connect to the LDAP server

Am i missing something here? Are the certs must to connect to an LDAP server? Is there something else to be done on ldap server side? Any help will be greatly appreciated?

2
  • You LDAP server runs on port 1389? Typically LDAP runs on 389.
    – 84104
    Jun 16, 2016 at 16:29
  • @84104 yes it is running on 1389.
    – Raghav
    Jun 17, 2016 at 10:48

0

You must log in to answer this question.

Browse other questions tagged .