Hi,

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://xxx.xx.xxx.xx:389/DC=DOMAIN,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...

In reply to PerlCGI + Apache ldap authentication configuration by vinoth.ree

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.