Welcome, Guest. Please login or register.

Author Topic: Can't get LDAP to work  (Read 2083 times)

janet

  • Newbie
  • *
  • Posts: 5
    • View Profile
Can't get LDAP to work
« on: October 15, 2020, 03:54:09 pm »
Here is an example of what I use for Apache:

  AuthType Basic
  AuthBasicProvider ldap
  AuthName "LDAP Password"
  AuthLDAPUrl "ldaps://ldap/ou=people,dc=company-name,dc=com?uid"
  Require ldap-group cn=networkrw,ou=groups,dc=company-name,dc=com
  AuthLDAPGroupAttributeIsDN off
  AuthLDAPGroupAttribute memberUid

Can anyone help translate that into NeDi speak?

janet

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Can't get LDAP to work
« Reply #1 on: October 15, 2020, 04:39:21 pm »
My problem seems to be that I need to use an anonymous bind.  How do I tell nedi to use nothing for a username and password? I tried '', "", and leaving it blank, but none work.

janet

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Can't get LDAP to work
« Reply #2 on: October 16, 2020, 10:20:11 am »
I did this to html/inc/libldap.php, and then used "anonymous" as my username and password.  I also fixed the email and phone ldapmap variables, as they were mapping incorrectly.   I now have a working LDAP system.

--- html/inc/libldap.php   2020-04-29 04:51:45.000000000 -0700
+++ /var/nedi/html/inc/libldap.php   2020-10-16 01:12:44.033321496 -0700
@@ -81,10 +81,10 @@

    if( $ldap_connection ){
       $fields=array('ldap_login'=>$ldapsrv[5],
-         'ldap_field_email'=>$ldapmap[6],
+         'ldap_field_email'=>$ldapmap[7],
          'ldap_field_realname'=>'sn',
          'ldap_field_firstname'=>'givenname',
-         'ldap_field_phone'=>$ldapmap[7],
+         'ldap_field_phone'=>$ldapmap[8],
          'ldap_field_title'=>'title'
       );
       $fields   = array_filter($fields);
@@ -187,7 +187,7 @@
          }
       }
       // Auth bind
-      if( $login != '' ){
+      if( $login != 'anonymous' ){
          $b = ldap_bind($ds, $login, $password);
       }else{ // Anonymous bind
          $b = ldap_bind($ds);