glpi-project / glpi

GLPI is a Free Asset and IT Management Software package, Data center management, ITIL Service Desk, licenses tracking and software auditing.
https://glpi-project.org
GNU General Public License v3.0
4.24k stars 1.29k forks source link

GLPI 10 Beta - Can not import Users from LDAP #10135

Closed roshanroche closed 2 years ago

roshanroche commented 2 years ago

Code of Conduct

Is there an existing issue for this?

Version

GLPI 10 Beta

Bug description

Hi,

LDAP configuration is set up properly, Test is OK. however while clicking on import users no users to be imported. same LDAP setup worked fine on GLPI 9.5.6.

image

Relevant log output

No response

Page URL

No response

Steps To reproduce

No response

Your GLPI setup information

No response

Anything else?

No response

Blank-Vcf commented 2 years ago

same for me, test connexion is ok php-error: [2021-12-16 08:10:41] glpiphplog.CRITICAL: *** Uncaught Exception RuntimeException: Something went wrong searching in LDAP directory in /var/www/html/glpi/src/AuthLDAP.php at lin e 3345 Backtrace : src/AuthLDAP.php:2732 AuthLDAP::searchUserDn() src/AuthLDAP.php:2659 AuthLDAP::ldapImportUserByServerId() front/user.form.php:115 AuthLDAP::forceOneUserSynchronization()

with console: xxxx@xxxxx/var/www/html/glpi# php bin/console glpi:ldap:synchronize_users --ldap-server-id 1 +---------------+---------------+ | Serveurs LDAP | AD (1) | | Filtre LDAP | | | Date de début | | | Date de fin | | +---------------+---------------+ Voulez-vous continuer ? [Yes/no]yes Serveur LDAP "1" en cours de traitement ... PHP Warning (2): ldap_parse_result() expects parameter 2 to be resource, bool given in /var/www/html/glpi/src/AuthLDAP.php at line 1825 PHP Warning: ldap_parse_result() expects parameter 2 to be resource, bool given in /var/www/html/glpi/src/AuthLDAP.php on line 1825 Erreur lors du contact du serveur LDAP "1". xxxx@xxxxx:/var/www/html/glpi# php bin/console glpi:ldap:synchronizeusers --ldap-server-id 2 +---------------+------------+ | Serveurs LDAP | AD(2) | | Filtre LDAP | | | Date de début | | | Date de fin | | +---------------+------------+ Voulez-vous continuer ? [Yes/no]yes Serveur LDAP "2" en cours de traitement ... Erreur lors du contact du serveur LDAP "2".

Blank-Vcf commented 2 years ago

also import user via glpi is showing new user only when expert mode is enable.

cconard96 commented 2 years ago

Please include your GLPI system information from the System tab in Setup > General. You can click the "Copy system information" button on this page and paste it in GitHub here.

Blank-Vcf commented 2 years ago
Informations sur le système, l'installation et la configuration
GLPI 10.0.0-dev (/glpi => /var/www/html/glpi)
Installation mode: TARBALL
Current language:fr_FR

Server
 
Operating system: Linux cco-glpi 5.10.0-9-amd64 #1 SMP Debian 5.10.70-1 (2021-09-30) x86_64
PHP 7.4.26 apache2handler (Core, FFI, PDO, Phar, Reflection, SPL, SimpleXML, Zend OPcache, apache2handler, bz2, calendar, ctype,
    curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, intl, json, ldap, libxml, mbstring, mysqli, mysqlnd,
    openssl, pcre, pdo_mysql, posix, readline, session, shmop, sockets, sodium, standard, sysvmsg, sysvsem, sysvshm, tokenizer, xml,
    xmlreader, xmlwriter, xsl, zip, zlib)
Setup: max_execution_time="30" memory_limit="128M" post_max_size="8M" safe_mode="" session.save_handler="files"
    upload_max_filesize="2M" 
Software: Apache/2.4.51 (Debian) (Apache/2.4.51 (Debian) Server at xxxxxxx Port 80
)
    Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0
Server Software: Debian 11
    Server Version: 10.5.12-MariaDB-0+deb11u1
    Server SQL Mode: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
    Parameters: root@localhost/glpi
    Host info: Localhost via UNIX socket

PHP version (7.4.26) is supported.
Sessions configuration is OK.
Allocated memory is sufficient.
mysqli extension is installed.
Following extensions are installed: dom, fileinfo, json, simplexml.
curl extension is installed.
gd extension is installed.
intl extension is installed.
libxml extension is installed.
zlib extension is installed.
Database engine version (10.5.12) is supported.
The log file has been created successfully.
Write access to /var/www/html/glpi/files/_cache has been validated.
Write access to /var/www/html/glpi/config has been validated.
Write access to /var/www/html/glpi/files/_cron has been validated.
Write access to /var/www/html/glpi/files has been validated.
Write access to /var/www/html/glpi/files/_dumps has been validated.
Write access to /var/www/html/glpi/files/_graphs has been validated.
Write access to /var/www/html/glpi/files/_lock has been validated.
Write access to /var/www/html/glpi/files/_pictures has been validated.
Write access to /var/www/html/glpi/files/_plugins has been validated.
Write access to /var/www/html/glpi/files/_rss has been validated.
Write access to /var/www/html/glpi/files/_sessions has been validated.
Write access to /var/www/html/glpi/files/_tmp has been validated.
Write access to /var/www/html/glpi/files/_uploads has been validated.
Web access to the files directory should not be allowed but this cannot be checked automatically on this instance.
Make sure access to error log file (/glpi/files/_log/php-errors.log) is forbidden; otherwise review .htaccess file and web server configuration.
exif extension is installed.
ldap extension is installed.
openssl extension is installed.
zip extension is installed.
bz2 extension is installed.
Zend OPcache extension is installed.
Following extensions are installed: ctype, iconv, mbstring, sodium.
The directory could not be created in /var/www/html/glpi/marketplace.
Timezones seems loaded in database.

GLPI constants
 
GLPI_ROOT: /var/www/html/glpi
GLPI_CONFIG_DIR: /var/www/html/glpi/config
GLPI_VAR_DIR: /var/www/html/glpi/files
GLPI_MARKETPLACE_DIR: /var/www/html/glpi/marketplace
GLPI_USE_CSRF_CHECK: 1
GLPI_CSRF_EXPIRES: 7200
GLPI_CSRF_MAX_TOKENS: 100
GLPI_USE_IDOR_CHECK: 1
GLPI_IDOR_EXPIRES: 7200
GLPI_ALLOW_IFRAME_IN_RICH_TEXT: 
GLPI_TELEMETRY_URI: https://telemetry.glpi-project.org
GLPI_INSTALL_MODE: TARBALL
GLPI_NETWORK_MAIL: glpi@teclib.com
GLPI_NETWORK_SERVICES: https://services.glpi-network.com
GLPI_MARKETPLACE_ALLOW_OVERRIDE: 1
GLPI_MARKETPLACE_MANUAL_DOWNLOADS: 1
GLPI_USER_AGENT_EXTRA_COMMENTS: 
GLPI_DISABLE_ONLY_FULL_GROUP_BY_SQL_MODE: 1
GLPI_AJAX_DASHBOARD: 1
GLPI_CALDAV_IMPORT_STATE: 0
GLPI_DEMO_MODE: 0
GLPI_DOC_DIR: /var/www/html/glpi/files
GLPI_CACHE_DIR: /var/www/html/glpi/files/_cache
GLPI_CRON_DIR: /var/www/html/glpi/files/_cron
GLPI_DUMP_DIR: /var/www/html/glpi/files/_dumps
GLPI_GRAPH_DIR: /var/www/html/glpi/files/_graphs
GLPI_LOCAL_I18N_DIR: /var/www/html/glpi/files/_locales
GLPI_LOCK_DIR: /var/www/html/glpi/files/_lock
GLPI_LOG_DIR: /var/www/html/glpi/files/_log
GLPI_PICTURE_DIR: /var/www/html/glpi/files/_pictures
GLPI_PLUGIN_DOC_DIR: /var/www/html/glpi/files/_plugins
GLPI_RSS_DIR: /var/www/html/glpi/files/_rss
GLPI_SESSION_DIR: /var/www/html/glpi/files/_sessions
GLPI_TMP_DIR: /var/www/html/glpi/files/_tmp
GLPI_UPLOAD_DIR: /var/www/html/glpi/files/_uploads
GLPI_INVENTORY_DIR: /var/www/html/glpi/files/_inventories
GLPI_NETWORK_REGISTRATION_API_URL: https://services.glpi-network.com/api/registration/
GLPI_MARKETPLACE_PLUGINS_API_URI: https://services.glpi-network.com/api/glpi-plugins/
GLPI_I18N_DIR: /var/www/html/glpi/locales
GLPI_VERSION: 10.0.0-dev
GLPI_SCHEMA_VERSION: 10.0.0-dev@5d5ed159d30f08ffa4fb9065d7c3f64855d5d4e1
GLPI_MARKETPLACE_PRERELEASES: 1
GLPI_MIN_PHP: 7.4.0
GLPI_YEAR: 2021

Libraries
 
htmlawed/htmlawed version 1.2.6 in (/var/www/html/glpi/vendor/htmlawed/htmlawed)
phpmailer/phpmailer version 6.5.3 in (/var/www/html/glpi/vendor/phpmailer/phpmailer/src)
simplepie/simplepie version 1.5.6 in (/var/www/html/glpi/vendor/simplepie/simplepie/library)
mpdf/mpdf in (/var/www/html/glpi/vendor/mpdf/mpdf/src)
michelf/php-markdown in (/var/www/html/glpi/vendor/michelf/php-markdown/Michelf)
true/punycode in (/var/www/html/glpi/vendor/true/punycode/src)
iamcal/lib_autolink in (/var/www/html/glpi/vendor/iamcal/lib_autolink)
sabre/dav in (/var/www/html/glpi/vendor/sabre/dav/lib/DAV)
sabre/http in (/var/www/html/glpi/vendor/sabre/http/lib)
sabre/uri in (/var/www/html/glpi/vendor/sabre/uri/lib)
sabre/vobject in (/var/www/html/glpi/vendor/sabre/vobject/lib)
laminas/laminas-i18n in (/var/www/html/glpi/vendor/laminas/laminas-i18n/src)
laminas/laminas-servicemanager in (/var/www/html/glpi/vendor/laminas/laminas-servicemanager/src)
monolog/monolog in (/var/www/html/glpi/vendor/monolog/monolog/src/Monolog)
sebastian/diff in (/var/www/html/glpi/vendor/sebastian/diff/src)
elvanto/litemoji in (/var/www/html/glpi/vendor/elvanto/litemoji/src)
symfony/console in (/var/www/html/glpi/vendor/symfony/console)
scssphp/scssphp in (/var/www/html/glpi/vendor/scssphp/scssphp/src)
laminas/laminas-mail in (/var/www/html/glpi/vendor/laminas/laminas-mail/src/Protocol)
laminas/laminas-mime in (/var/www/html/glpi/vendor/laminas/laminas-mime/src)
rlanvin/php-rrule in (/var/www/html/glpi/vendor/rlanvin/php-rrule/src)
blueimp/jquery-file-upload in (/var/www/html/glpi/vendor/blueimp/jquery-file-upload/server/php)
ramsey/uuid in (/var/www/html/glpi/vendor/ramsey/uuid/src)
psr/log in (/var/www/html/glpi/vendor/psr/log/Psr/Log)
psr/simple-cache in (/var/www/html/glpi/vendor/psr/simple-cache/src)
psr/cache in (/var/www/html/glpi/vendor/psr/cache/src)
league/csv in (/var/www/html/glpi/vendor/league/csv/src)
mexitek/phpcolors in (/var/www/html/glpi/vendor/mexitek/phpcolors/src/Mexitek/PHPColors)
guzzlehttp/guzzle in (/var/www/html/glpi/vendor/guzzlehttp/guzzle/src)
guzzlehttp/psr7 in (/var/www/html/glpi/vendor/guzzlehttp/psr7/src)
glpi-project/inventory_format in (/var/www/html/glpi/vendor/glpi-project/inventory_format/lib/php)
wapmorgan/unified-archive in (/var/www/html/glpi/vendor/wapmorgan/unified-archive/src)
paragonie/sodium_compat in (/var/www/html/glpi/vendor/paragonie/sodium_compat/src)
symfony/cache in (/var/www/html/glpi/vendor/symfony/cache)
html2text/html2text in (/var/www/html/glpi/vendor/html2text/html2text/src)
symfony/dom-crawler in (/var/www/html/glpi/vendor/symfony/dom-crawler)
twig/twig in (/var/www/html/glpi/vendor/twig/twig/src)
twig/string-extra in (/var/www/html/glpi/vendor/twig/string-extra)
symfony/polyfill-ctype not found
symfony/polyfill-iconv not found
symfony/polyfill-mbstring not found
symfony/polyfill-php80 in (/var/www/html/glpi/vendor/symfony/polyfill-php80)
phpCas version 1.3.8 in (/usr/share/php/CAS/source)

LDAP directories
 
Server: 'xxxxxxx', Port: '389', BaseDN: 'xxxxxxx', Connection filter:
        '(&(objectClass=user)(!(objectClass=computer))(!(userAccountControl:1.2.840.113556.1.4.803:=2))(employeeID=*))', RootDN:
        'xxxxxxx', Use TLS: none
Server: 'xxxxxxx', Port: '389', BaseDN: 'DC=xxxxxxx', Connection filter:
        '(&(objectClass=user)(objectCategory=person)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))', RootDN: 'xxxxxxx', Use
        TLS: none
Server: 'xxxxxxx', Port: '389', BaseDN: 'DC=xxxxxxx', Connection filter:
        '(&(objectClass=user)(objectCategory=person)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))', RootDN:
        'xxxxxxx', Use TLS: none

SQL replicas
 
Not active

Notifications
 
Way of sending emails: SMTP+TLS xxxxxxx@smtp.office365.com)

Plugins list
 
    treeview             Name: Arborescence                   Version: 1.9.0      State: Error / to clean
    behaviors            Name: Comportements                  Version: 2.5.0      State: Error / to clean
    accounts             Name: Comptes                        Version: 2.6.0      State: Error / to clean
    datainjection        Name: Data Injection                 Version: 2.9.0      State: Error / to clean
    formcreator          Name: Form Creator                   Version: 2.11.3     State: Error / to clean
    ocsinventoryng       Name: OCS Inventory NG               Version: 1.7.3      State: Error / to clean
    phpsaml              Name: PHP SAML                       Version: 0          State: Error / to clean
    reports              Name: Rapports                       Version: 1.14.1     State: Error / to clean
    dashboard            Name: Tableau de bord                Version: 1.0.2      State: Error / to clean

felipeborela commented 2 years ago

It's exactly the same for me too. LDAP configuration is set up properly, Test is OK. however while clicking on import users no users to be imported. same LDAP setup worked fine on GLPI 9.5.6.

orthagh commented 2 years ago

Hello all,

Could you check the field "Use bind" is set to yes if you are using a dn account for login to your ldap. It can explains the difference with 9.5.x where the option didn't exists.

Blank-Vcf commented 2 years ago

use bind is already set to yes for me on my 3 ldap

roshanroche commented 2 years ago

Hi @orthagh with bind enabled only in the expert mode the users are displayed but cant be imported.. as mentioned above by @Blank-Vcf

[2021-12-21 14:32:40] glpiphplog.CRITICAL: *** Uncaught Exception RuntimeException: Something went wrong searching in LDAP directory in /var/www/html/glpi/src/AuthLDAP.php at line 3345 Backtrace : src/AuthLDAP.php:2732 AuthLDAP::searchUserDn() src/AuthLDAP.php:352 AuthLDAP::ldapImportUserByServerId() src/MassiveAction.php:1168 AuthLDAP::processMassiveActionsForOneItemtype() src/MassiveAction.php:1146 MassiveAction->processForSeveralItemtypes() front/massiveaction.php:59 MassiveAction->process()

[2021-12-21 14:33:10] glpiphplog.CRITICAL: *** Uncaught Exception RuntimeException: Something went wrong searching in LDAP directory in /var/www/html/glpi/src/AuthLDAP.php at line 3345 Backtrace : src/AuthLDAP.php:2732 AuthLDAP::searchUserDn() src/AuthLDAP.php:352 AuthLDAP::ldapImportUserByServerId() src/MassiveAction.php:1168 AuthLDAP::processMassiveActionsForOneItemtype() src/MassiveAction.php:1146 MassiveAction->processForSeveralItemtypes() front/massiveaction.php:59 MassiveAction->process()

and from console the following error

image

orthagh commented 2 years ago

Ok got the error on my side also with an AD connection (openldap connection is working). I'll investigate this afternoon.

orthagh commented 2 years ago

Could you test the fix provided in #10194 ?

roshanroche commented 2 years ago

Hi @orthagh

Thank you.. now i am able to import users from expert mode. however in simple mode still shows no users to import

and in console still the same error

image

Blank-Vcf commented 2 years ago

for me with fix: can manually sync a user and login with it mass sync via glpi gui show no user php console throw the same error in php_errors.log

orthagh commented 2 years ago

Hello.

I redid completly #10194 to fix all places (i think) impacted by the bug. Could you test again the new fix ?

Regards.

Blank-Vcf commented 2 years ago

sync from glpi, ldap is ok with console: sync is still synchronising everything seems ok for me.

husisusi commented 2 years ago

Tested, it works as expected.

Christ125dd commented 2 years ago

Hello, I have the same problem but I have the new version of glpi 10

cedric-anne commented 2 years ago

Hello, I have the same problem but I have the new version of glpi 10

@Christ125dd

Please try with latest nightly build of the master branch, and, if you are able to reproduce, please open a new issue with all requested information.