Problems with LDAP_Contacts_backend plugin. The author suggests asking here

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Hey folks, having some problems with the LDAP_Contacts_Backend plugin and hoping someone has had the same issue and over come it.

Nextcloud version (eg, 18.0.2): 20.0.4.0
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04 Server
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.41
PHP version (eg, 7.1): 7.4

The issue you are facing:
While using the command provided by LDAP_contacts_backend I recieve an error in my logs and the LDAP fails to apply the filter. it seems to not matter if I give my own filter/query, or use the default it always displays the same error and doesnt seem to apply my filter/query at all. below are the commands being used:

From within the /var/www/nextcloud folder

sudo -u www-data php occ ldap_contacts:add MyAddressBook --interactive --bindDN=CN=BindUser,OU=Services,DC=example,DC=local --bindPwd=xxxx --base=OU=users,DC=example,DC=local --base=OU=Contacts,DC=example,DC=local filter=&(objectClass=person)

I have also removed the --base options from the command and used the interactive option to set the base OUs but regardless this still errors.

The query/filter I use is:

&(ObjectClass=person)

I have also used

&(objectClass=contact)

Neither of these seem to be applied when the command is run however (see admin log below). instead it tries to apply the following query even when another is specified:

(&(&(objectClass=contact))(|(=*)))

So where am I going wrong?

Additional Info / logs:

Is this the first time you’ve seen this error? (Y/N):
Y

Steps to replicate it:

  1. Fresh Nextcloud installation
  2. Connect to Active Directory Server for Users (samba)
  3. configure LDAP users and groups (successful and all users and groups are listed. in expert options the userid field is replaced with saMAccountName.
  4. Install LDAP_contacts_backend plugin
  5. run command provided by the plugin on server which produces the logs shown.

The output of your Nextcloud log in Admin > Logging:

Symfony\Component\Ldap\Exception\LdapException: Could not complete search with dn "OU=Contacts,DC=example,DC=lan", query "(&(&(objectClass=contact))(|(=*)))" and filters "*". LDAP error was [-7] Bad search filter.

    /var/www/nextcloud/apps/ldap_contacts_backend/lib/Service/LdapQuerent.php - line 75:

    Symfony\Component\Ldap\Adapter\ExtLdap\Query->execute()

    /var/www/nextcloud/apps/ldap_contacts_backend/lib/Service/LdapQuerent.php - line 93:

    OCA\LDAPContactsBackend\Service\LdapQuerent->fetchAll()

    /var/www/nextcloud/apps/ldap_contacts_backend/lib/Service/LdapCardBackend.php - line 63:

    OCA\LDAPContactsBackend\Service\LdapQuerent->find()

    /var/www/nextcloud/apps/ldap_contacts_backend/lib/Service/ContactsAddressBook.php - line 84:

    OCA\LDAPContactsBackend\Service\LdapCardBackend->searchCards()

    /var/www/nextcloud/lib/private/ContactsManager.php - line 52:

    OCA\LDAPContactsBackend\Service\ContactsAddressBook->search()

    /var/www/nextcloud/lib/private/Contacts/ContactsMenu/ContactsStore.php - line 87:

    OC\ContactsManager->search()

    /var/www/nextcloud/lib/private/Contacts/ContactsMenu/Manager.php - line 70:

    OC\Contacts\ContactsMenu\ContactsStore->getContacts()

    /var/www/nextcloud/core/Controller/ContactsMenuController.php - line 61:

    OC\Contacts\ContactsMenu\Manager->getEntries()

    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 169:

    OC\Core\Controller\ContactsMenuController->index()

    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 100:

    OC\AppFramework\Http\Dispatcher->executeController()

    /var/www/nextcloud/lib/private/AppFramework/App.php - line 152:

    OC\AppFramework\Http\Dispatcher->dispatch()

    /var/www/nextcloud/lib/private/Route/Router.php - line 308:

    OC\AppFramework\App::main()

    /var/www/nextcloud/lib/base.php - line 1008:

    OC\Route\Router->match()

    /var/www/nextcloud/index.php - line 37:

    OC::handleRequest()

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'xxx',
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'trusted_domains' => 
  array (
    0 => 'nextcloud.example.local',
    1 => 'cloud.example.local',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '20.0.4.0',
  'overwrite.cli.url' => 'http://nextcloud.example.local',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'exampleadmin',
  'dbpassword' => 'xxx',
  'installed' => true,
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'xxx',
  'mail_domain' => 'example.local',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'xxx',
  'mail_smtpport' => '587',
  'mail_smtpname' => 'xxxx',
  'mail_smtppassword' => xxxx',
  'default_language' => 'de',
  'default_local' => 'de_DE',
  'app.mail.verify-tls-peer' => false,
  'mail_smtpsecure' => 'tls',
  'mail_smtpauthtype' => 'LOGIN',
  'maintenance' => false,
  'skeletondirectory' => '',
);

The output of your Apache/nginx/system log in /var/log/____: I dont have this log

PASTE HERE

Hello, my filter is (&(objectclass=person)(objectclass=user) and now it is wokring.

Hi there,
i just can’t get the whole thing going. I’m using the nextcloud version 22.2.0 and the ldap_contacts_backend version 1.2.0.
My users are in the tree OU = users, dc = example, dc = com and the RDN is the uid.
The following objectClass are defined:
top, person, organizationalPerson, inetOrgPerson, evolutionPerson, mailExtension and posixAccount
The following filter are set:

sudo -u www-data php occ ldap_contacts:add Harbich --interactive --bindDN=CN=admin,DC=example,DC=com --bindPwd='#############' --base=OU=users,DC=example,DC=com --filter='&(objectClass=inetOrgPerson)(objectClass=uid)'

Greetings from Stefan

Hi Stefan,

i may be wrong, but i thought you EITHER use paramater ‘–interactive’ and then add everything in the dialogs following OR specify everything on the command line.
And the syntax of the filter is wrong. Try
–filter=’(&(objectClass=inetOrgPerson)(objectClass=user))’

uid is not a class, but a value of the object.

regards,
jens