James, I&#39;m running Koha 3.00.02 which includes the new &lt;auth_by_bind&gt;1&lt;/auth_by_bind&gt; for Active Directory, but I still cannot authenticate against our M$ LDAP.  The Koha OPAC reports &quot;Error: Invalid Username or Password.  Specifically I&#39;m unsure what to do with the &lt;password&gt;&lt;/password&gt; tag because our Microsoft AD LDAP schema has no exposed &quot;userpassword&quot;.   Do I simply use &lt;password = &quot;&quot;&gt;&lt;/password&gt;?   I wish to create and update Koha user records when they login to Koha, so I have:<br>
<br>&lt;ldapserver id=&quot;ldapserver&quot;  listenref=&quot;ldapserver&quot;&gt;<br> &lt;hostname&gt;ldap://<a href="http://ldap.example.com:389">ldap.example.com:389</a>&lt;/hostname&gt;<br> &lt;base&gt;dc=example,dc=com&lt;/base&gt;<br>
 &lt;user&gt;CN=KOHA_LDAP_USER&lt;/user&gt;             &lt;!-- DN, if not anonymous --&gt;<br> &lt;pass&gt;secretpasswd&lt;/pass&gt;          &lt;!-- password, if not anonymous --&gt;<br> &lt;replicate&gt;1&lt;/replicate&gt;       &lt;!-- add new users from LDAP to Koha database --&gt;<br>
 &lt;update&gt;1&lt;/update&gt;             &lt;!-- update existing users in Koha database --&gt;<br> &lt;auth_by_bind&gt;1&lt;/auth_by_bind&gt; &lt;!-- set to 1 to authenticate by binding instead of<br>                                     password comparison, e.g., to use Active Directory --&gt;<br>
 &lt;mapping&gt;             &lt;!-- match koha SQL field names to your LDAP record field names --&gt;<br>                &lt;firstname    is=&quot;givenName&quot;      &gt;&lt;/firstname&gt;<br>                &lt;surname      is=&quot;sn&quot;             &gt;&lt;/surname&gt;<br>
                &lt;address      is=&quot;streetAddress&quot;  &gt;&lt;/address&gt;<br>                &lt;city         is=&quot;l&quot;              &gt;&lt;/city&gt;<br>                &lt;zipcode      is=&quot;postalCode&quot;     &gt;&lt;/zipcode&gt;<br>
                &lt;userid       is=&quot;sAMAccountName&quot; &gt;&lt;/userid&gt;<br>                &lt;password     is=&quot;&quot;           &gt;&lt;/password&gt;<br>                &lt;email        is=&quot;mail&quot;           &gt;&lt;/email&gt;<br>
                &lt;phone        is=&quot;telephoneNumber&quot;&gt;&lt;/phone&gt;<br> &lt;/mapping&gt;<br>&lt;/ldapserver&gt;<br><br>After a failed login attempt, /var/log/koha/koha-error_log :<br><br>[Mon Jul 13 15:56:11 2009] [error] [client] [Mon Jul 13 15:56:11 2009] mainpage.pl: LDAP Auth rejected : invalid password for user &#39;johndoe&#39;. LDAP error #16: LDAP_NO_SUCH_ATTRIBUTE, referer: <a href="http://koha.example.com:8080/cgi-bin/koha/mainpage.pl">http://koha.example.com:8080/cgi-bin/koha/mainpage.pl</a><br>
[Mon Jul 13 15:56:11 2009] [error] [client] [Mon Jul 13 15:56:11 2009] mainpage.pl: # The request referenced an attribute that does not exist, referer: <a href="http://koha.example.com:8080/cgi-bin/koha/mainpage.pl">http://koha.example.com:8080/cgi-bin/koha/mainpage.pl</a><br>
[Mon Jul 13 15:56:11 2009] [error] [client] [Mon Jul 13 15:56:11 2009] mainpage.pl: , referer: <a href="http://koha.example.com:8080/cgi-bin/koha/mainpage.pl">http://koha.example.com:8080/cgi-bin/koha/mainpage.pl</a><br><br>
<br>thank you!<br><br><div class="gmail_quote"><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
   1. Re: FW: Koha 3.0 LDAP Question? (Winter, James)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Fri, 13 Feb 2009 09:52:45 -0500<br>
From: &quot;Winter, James&quot; &lt;<a href="mailto:WinterJ@arcadia.edu">WinterJ@arcadia.edu</a>&gt;<br>
Subject: Re: [Koha] FW: Koha 3.0 LDAP Question?<br>
To: &quot;Barry Cannon&quot; &lt;<a href="mailto:bc@interleaf.ie">bc@interleaf.ie</a>&gt;<br>
Cc: <a href="mailto:koha@lists.katipo.co.nz">koha@lists.katipo.co.nz</a><br>
Message-ID:<br>
        &lt;<a href="mailto:195366CE4CF91245936298EEA68FEA980AE3C41E@BISHOP.arcadia.edu">195366CE4CF91245936298EEA68FEA980AE3C41E@BISHOP.arcadia.edu</a>&gt;<br>
Content-Type: text/plain; charset=&quot;us-ascii&quot;<br>
<br>
Did you comment out the two lines in Auth_with_ldap.pm? If so, it won&#39;t<br>
update or replicate the data. If you didn&#39;t, I would make sure you have<br>
the property names correct. I would start with the required fields<br>
(surname, address, city, branchcode, categorycode).<br>
<br>
<br>
<br>
Try using default values by setting is=&quot;&quot; for those properties and put<br>
text between the tags. &lt;address is=&quot;&quot;&gt;123 Test Street&lt;/address&gt; for<br>
example. If a person is created successfully with default values then<br>
it&#39;s a property name problem. If not, it&#39;s a Koha problem.<br>
<br>
<br>
<br>
James Winter<br>
<br>
215.517.2588<br>
<br>
<br>
<br>
From: Barry Cannon [mailto:<a href="mailto:bc@interleaf.ie">bc@interleaf.ie</a>]<br>
Sent: Friday, February 13, 2009 7:31 AM<br>
To: Winter, James<br>
Cc: <a href="mailto:koha@lists.katipo.co.nz">koha@lists.katipo.co.nz</a><br>
Subject: RE: [Koha] FW: Koha 3.0 LDAP Question?<br>
<br>
<br>
<br>
James,<br>
<br>
                Thanks for this info...I can now authenticate against my<br>
LDAP server with no problems. However, when I start enabling &lt;replicate&gt;<br>
and &lt;update&gt; to try and add the AD users into Koha the replication<br>
doesn&#39;t occur. The authentication still works but the users information,<br>
as per mappings, doesn&#39;t come across into Koha. There are no errors<br>
either?<br>
<br>
<br>
<br>
Does anyone have any suggestions?<br>
<br>
<br>
<br>
Thanks<br>
<br>
Bar<br>
<br>
<br>
<br>
From: Winter, James [mailto:<a href="mailto:WinterJ@arcadia.edu">WinterJ@arcadia.edu</a>]<br>
Sent: 12 February 2009 17:35<br>
To: Barry Cannon<br>
Cc: <a href="mailto:koha@lists.katipo.co.nz">koha@lists.katipo.co.nz</a><br>
Subject: RE: [Koha] FW: Koha 3.0 LDAP Question?<br>
<br>
<br>
<br>
Sure, it took me a while to get it working, but we have it working now.<br>
<br>
<br>
<br>
In our koha-conf.xml, we have this section in the config section<br>
(between &lt;config&gt; and &lt;/config&gt; near the end of the file):<br>
<br>
<br>
<br>
&lt;useldapserver&gt;1&lt;/useldapserver&gt;<br>
<br>
 &lt;ldapserver id=&quot;ldapserver&quot;&gt;<br>
<br>
    &lt;hostname&gt;LDAPSERVERNAMEHERE:389&lt;/hostname&gt;<br>
<br>
    &lt;base&gt;dc=DOMAIN,dc=COM&lt;/base&gt;<br>
<br>
    &lt;user&gt; CN=[USER THAT CAN BROWSE ACTIVE DIRECTORY],OU=[OU OF USER<br>
(MULTIPLE ENTRIES IF NESTED OU)],DC=DOMAIN,DC=COM &lt;/user&gt;    &lt;!-- DN, if<br>
not anonymous --&gt;<br>
<br>
    &lt;pass&gt;[PASSWORD OF USER]&lt;/pass&gt;&lt;!-- password, if not anonymous --&gt;<br>
<br>
    &lt;replicate&gt;0&lt;/replicate&gt;   &lt;!-- add new users from LDAP to Koha<br>
database --&gt;<br>
<br>
    &lt;update&gt;0&lt;/update&gt;         &lt;!-- update existing users in Koha<br>
database --&gt;<br>
<br>
    &lt;mapping&gt;                  &lt;!-- match koha SQL field names to your<br>
LDAP record field names --&gt;<br>
<br>
          &lt;!--&lt;cardnumber is=&quot;&quot; &gt;&lt;/cardnumber&gt;--&gt;<br>
<br>
      &lt;!--&lt;firstname    is=&quot;givenname&quot;      &gt;&lt;/firstname&gt;--&gt;<br>
<br>
      &lt;!--&lt;surname      is=&quot;sn&quot;             &gt;&lt;/surname&gt;--&gt;<br>
<br>
      &lt;!--&lt;address              is=&quot;&quot;   &gt; &lt;/address&gt;--&gt;<br>
<br>
      &lt;!--&lt;city                 is=&quot;&quot;                           &gt;<br>
&lt;/city&gt;--&gt;<br>
<br>
      &lt;!--&lt;zipcode              is=&quot;&quot;           &gt;&lt;/zipcode&gt;--&gt;<br>
<br>
      &lt;!--&lt;branchcode is =&quot;&quot;&gt;MAIN&lt;/branchcode&gt;--&gt;<br>
<br>
      &lt;userid       is=&quot;samAccountName&quot; &gt;&lt;/userid&gt;<br>
<br>
      &lt;password     is=&quot;&quot;   &gt;&lt;/password&gt;<br>
<br>
      &lt;!--&lt;email        is=&quot;mail&quot;           &gt;&lt;/email&gt;--&gt;<br>
<br>
      &lt;!--&lt;categorycode is=&quot;employeetype&quot;   &gt; &lt;/categorycode&gt;--&gt;<br>
<br>
      &lt;!--&lt;phone                is=&quot;&quot;&gt;&lt;/phone&gt;--&gt;<br>
<br>
    &lt;/mapping&gt;<br>
<br>
&lt;/ldapserver&gt;<br>
<br>
<br>
<br>
Most of the attributes are commented out because we populate our users<br>
in Koha from a different system and they only log in using their AD<br>
password. We don&#39;t want to add new users or update existing users.<br>
<br>
<br>
<br>
Then in Auth_with_ldap.pm at line 102 (thanks to this thread<br>
<a href="http://lists.koha.org/pipermail/koha-devel/2008-September/008355.html" target="_blank">http://lists.koha.org/pipermail/koha-devel/2008-September/008355.html</a>)<br>
<br>
<br>
<br>
Change these lines:<br>
<br>
<br>
<br>
      my $userldapentry = $search-&gt;shift_entry;<br>
<br>
        my $cmpmesg = $db-&gt;compare( $userldapentry,<br>
attr=&gt;&#39;userpassword&#39;, value =&gt; $password );<br>
<br>
        if ($cmpmesg-&gt;code != 6) {<br>
<br>
                warn &quot;LDAP Auth rejected : invalid password for user<br>
&#39;$userid&#39;. &quot; . description($cmpmesg);<br>
<br>
                return 0;<br>
<br>
        }<br>
<br>
<br>
<br>
To this:<br>
<br>
<br>
<br>
      my $userldapentry = $search-&gt;shift_entry;<br>
<br>
<br>
<br>
        my $dbuser = Net::LDAP-&gt;new( [$prefhost] );<br>
<br>
        $res = $dbuser-&gt;bind( $userldapentry, password =&gt; $password );<br>
<br>
        unless ( $db &amp;&amp; ! $res-&gt;code ) {<br>
<br>
                warn &quot;LDAP Auth rejected : invalid password for user<br>
&#39;$userid&#39;&quot;;<br>
<br>
                return 0;<br>
<br>
        }<br>
<br>
<br>
<br>
We had an additional problem with the Auth_with_ldap.pm automatically<br>
updating the card number with the user&#39;s login. We have existing cards<br>
with specific numbers that we&#39;re importing, so I had to disable a couple<br>
of other lines (lines 116 and 117 in Auth_with_ldap.pm, before the first<br>
edit.)<br>
<br>
<br>
<br>
#($config{update}   ) and my $c2 =<br>
&amp;update_local($userid,$password,$borrowernumber,\%borrower) || &#39;&#39;;<br>
<br>
                #($cardnumber eq $c2) or warn &quot;update_local returned<br>
cardnumber &#39;$c2&#39; instead of &#39;$cardnumber&#39;&quot;;<br>
<br>
<br>
<br>
Hopefully this helps.<br>
<br>
<br>
<br>
James Winter<br>
<br>
215.517.2588<br>
<br>
<br>
<br>
From: Barry Cannon [mailto:<a href="mailto:bc@interleaf.ie">bc@interleaf.ie</a>]<br>
Sent: Thursday, February 12, 2009 12:06 PM<br>
To: Winter, James<br>
Subject: RE: [Koha] FW: Koha 3.0 LDAP Question?<br>
<br>
<br>
<br>
Yes, I am using Active Directory. Do you have any tips?<br>
<br>
<br>
<br>
From: Winter, James [mailto:<a href="mailto:WinterJ@arcadia.edu">WinterJ@arcadia.edu</a>]<br>
Sent: 12 February 2009 17:06<br>
To: Barry Cannon<br>
Subject: RE: [Koha] FW: Koha 3.0 LDAP Question?<br>
<br>
<br>
<br>
Are you using Active Directory?<br>
<br>
<br>
<br>
James Winter<br>
<br>
215.517.2588<br>
<br>
<br>
<br>
From: <a href="mailto:koha-bounces@lists.katipo.co.nz">koha-bounces@lists.katipo.co.nz</a><br>
[mailto:<a href="mailto:koha-bounces@lists.katipo.co.nz">koha-bounces@lists.katipo.co.nz</a>] On Behalf Of Barry Cannon<br>
Sent: Thursday, February 12, 2009 9:17 AM<br>
To: <a href="mailto:koha@lists.katipo.co.nz">koha@lists.katipo.co.nz</a><br>
Subject: [Koha] FW: Koha 3.0 LDAP Question?<br>
<br>
<br>
<br>
I have been trying to configure LDAP and have a couple of questions:<br>
<br>
<br>
<br>
The Wiki says: There are two parts of the KOHA_CONF file (default<br>
location: /etc/koha.xml) relevant to LDAP authentication: the<br>
configuration stanza itself, and the &quot;switch&quot; line that enables or<br>
disables LDAP. The switch appears in the main &lt;config&gt; section, 0 for<br>
&quot;off&quot; and 1 for &quot;on&quot;,....<br>
<br>
<br>
<br>
Should I take this to mean the koha-conf.xml file? There is no koha.xml<br>
file on our installed server? If it is this file, do I simply add the<br>
LDAP server options in the config file.<br>
<br>
<br>
<br>
I have assumed that is what is needed but I can&#39;t figure out where to go<br>
from there? Is there an Admin tool to configure/test the LPAD<br>
authentication?<br>
<br>
<br>
<br>
Thanks<br>
<br>
Barry<br>
<br>
<br>
<br>
<br>
<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://lists.katipo.co.nz/pipermail/koha/attachments/20090213/87c6d6cd/attachment.htm" target="_blank">http://lists.katipo.co.nz/pipermail/koha/attachments/20090213/87c6d6cd/attachment.htm</a><br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
Koha mailing list<br>
<a href="mailto:Koha@lists.katipo.co.nz">Koha@lists.katipo.co.nz</a><br>
<a href="http://lists.katipo.co.nz/mailman/listinfo/koha" target="_blank">http://lists.katipo.co.nz/mailman/listinfo/koha</a><br>
<br>
<br>
End of Koha Digest, Vol 40, Issue 35<br>
************************************<br>
</blockquote><br></div><br>