vinoth.ree has asked for the wisdom of the Perl Monks concerning the following question:


Sorry if it is OP topic, forgive me! I am implementing a web based service using PerlCGI + Apache +Ldap authentication. I successfully implemented the service with PerlCGI with Apache and able to access the webpage, to allow the access for only authenticated users I am trying to integrate apache with ldap server.

<Directory "/home/xxxxx/apache2/cgi-bin"> AllowOverride None Options +ExecCGI AddHandler cgi-script .cgi .py .pl order allow,deny allow from all AuthName "DOMAIN Active Directory" AuthType Basic AuthBasicProvider ldap AuthLDAPURL "ldap://,dc=com?sAMAccountN +ame?sub?(objectClass=Person)" AuthLDAPBindDN "CN=user_id,DC=DOMAIN,DC=com" AuthLDAPBindPassword "XXXXXXXXXXXXXXXXXX" Require valid-user </Directory>

When I hit the url it prompts for username and password, but its not authenticating successfully.

In error.log I see below error,

[Sun Apr 12 17:06:25.112467 2020] [authnz_ldap:debug] [pid 26287:tid 2 +7] mod_authnz_ldap.c(522): [client xx.xx.xx.xx:53875] AH01691: auth_l +dap authenticate: using URL ldap://xx.xx.xx.xx:389/DC=DOMAIN,dc=com?s +AMAccountName?sub?(objectClass=Person) [Sun Apr 12 17:06:25.593392 2020] [authnz_ldap:info] [pid 26287:tid 27 +] [client xx.xx.xx.xx:53875] AH01695: auth_ldap authenticate: user us +er_id authentication failed; URI / [LDAP: ldap_simple_bind() failed][ +Invalid credentials] [Sun Apr 12 17:06:25.593410 2020] [auth_basic:error] [pid 26287:tid 27 +] [client xx.xx.xx.xx:53875] AH01617: user user_id: authentication fa +ilure for "/": Password Mismatch

It seems the authentication password is wrong, but I am using the same password with ldapsearch it successfully fetches the account details from the ldap server.

ldapsearch -H ldap://xx.xx.xx.xx:389 -x -D "DOMAIN\user_id" -W -b "dc= +DOMAIN,dc=com" -s sub "(&(sAMAccountName=user_id)(objectClass=Person) +)"

Could somebody help me out here. Thanks in advance.

All is well. I learn by answering your questions...