joomla / joomla-cms

Home of the Joomla! Content Management System
https://www.joomla.org
GNU General Public License v2.0
4.77k stars 3.65k forks source link

[4.0.0] Core LADP Plugin - The option "host" with value null is expected to be of type "string", but is of type "null". #35216

Closed ChristineWk closed 3 years ago

ChristineWk commented 3 years ago

Steps to reproduce the issue

The following was reported by a Forum de user: https://forum.joomla.de/thread/14122-fehlermeldung-der-admin-anmeldung/?postID=91310#post91310

Expected result

Maybe possibly PR for J 4.0.1

Actual result

After logging back in to the backend, the following message came up:

Call Stack:

The option "host" with value null is expected to be of type "string", but is of type "null".

Call stack

Function Location

1 () JROOT/libraries/vendor/symfony/options-resolver/OptionsResolver.php:1059 2 Symfony\Component\OptionsResolver\OptionsResolver->offsetGet() JROOT/libraries/vendor/symfony/options-resolver/OptionsResolver.php:924 3 Symfony\Component\OptionsResolver\OptionsResolver->resolve() JROOT/libraries/vendor/symfony/ldap/Adapter/AbstractConnection.php:30 4 Symfony\Component\Ldap\Adapter\AbstractConnection->__construct() JROOT/libraries/vendor/symfony/ldap/Adapter/ExtLdap/Adapter.php:41 5 Symfony\Component\Ldap\Adapter\ExtLdap\Adapter->getConnection() JROOT/libraries/vendor/symfony/ldap/Ldap.php:40 6 Symfony\Component\Ldap\Ldap->bind() JROOT/plugins/authentication/ldap/ldap.php:139 7 PlgAuthenticationLdap->onUserAuthenticate() JROOT/libraries/src/Authentication/Authentication.php:177 8 Joomla\CMS\Authentication\Authentication->authenticate() JROOT/libraries/src/Application/CMSApplication.php:819 9 Joomla\CMS\Application\CMSApplication->login() JROOT/libraries/src/Application/AdministratorApplication.php:384 10 Joomla\CMS\Application\AdministratorApplication->login() JROOT/administrator/components/com_login/src/Controller/DisplayController.php:80 11 Joomla\Component\Login\Administrator\Controller\DisplayController->login() JROOT/libraries/src/MVC/Controller/BaseController.php:730 12 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/libraries/src/Dispatcher/ComponentDispatcher.php:146 13 Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch() JROOT/administrator/components/com_login/src/Dispatcher/Dispatcher.php:43 14 Joomla\Component\Login\Administrator\Dispatcher\Dispatcher->dispatch() JROOT/libraries/src/Component/ComponentHelper.php:389 15 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/AdministratorApplication.php:143 16 Joomla\CMS\Application\AdministratorApplication->dispatch() JROOT/libraries/src/Application/AdministratorApplication.php:186 17 Joomla\CMS\Application\AdministratorApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:278 18 Joomla\CMS\Application\CMSApplication->execute() JROOT/administrator/includes/app.php:63 19 require_once() JROOT/administrator/index.php:32

System information (as much as possible)

Joomla! 3.10 to Joomla! 4.0.0

Additional comments

More information from the TE will be submitted tomorrow. Information about Plugin settings are pending.

Any additional relevant information from: @zero24

PhilETaylor commented 3 years ago

The LDAP package has not significantly changed since 2018 https://github.com/joomla-framework/ldap/commits/2.0-dev

zero-24 commented 3 years ago

We are not using the Framework LDAP package but symfony/ldap in 4.0

PhilETaylor commented 3 years ago

I cannot replicate this.

I can login with any LDAP user.

Running LDAP in docker (Documentation)

docker run --rm -p 10389:10389 -p 10636:10636 rroemhild/test-openldap

and then with my configuration

Screenshot 2021-08-18 at 18 11 58

Login with Username: amy Password: amy

Screenshot 2021-08-18 at 18 13 03
PhilETaylor commented 3 years ago

After logging back in to the backend,

Promoted amy to a super admin, then attempted to login to admin - and that worked too.

PhilETaylor commented 3 years ago

Translation

After I made it from 3.10 to Joomla 4.0 yesterday, everything went almost smoothly. However, I was shown the following when I wanted to go to the posts, categories and main entries: the following error message: Class 'JPlatform' not found
After that, I gradually deactivated plugins and components, but the error message persisted.
At some point I logged out and when I wanted to log in again, this error message came up: An error occurred. 0 The option "host" with value null is expected to be of type "string", but is of type "null".

So maybe an upgrade issue, but certainly not an issue out of the box.

As you cannot login you will need to access the db directly and check the settings for the LDAP. (Or enable the Joomla Authentication plugin and login with a known good joomla user/pass)

You need to check the settings in the db #__extensions table, look for plg_authentication_ldap in the name and look at the params, for reference mine are:

{"host":"host.docker.internal","port":10389,"use_ldapV3":1,"negotiate_tls":0,"ignore_reqcert_tls":1,"no_referrals":1,"auth_method":"search","base_dn":"ou=people,dc=planetexpress,dc=com","search_string":"uid=[search]","users_dn":"cn=[username],dc=planetexpress,dc=com","username":"admin","password":"GoodNewsEveryone","ldap_fullname":"displayName","ldap_email":"mail","ldap_uid":"uid","ldap_debug":1}

made pretty for viewing:

{
  "host": "host.docker.internal",
  "port": 10389,
  "use_ldapV3": 1,
  "negotiate_tls": 0,
  "ignore_reqcert_tls": 1,
  "no_referrals": 1,
  "auth_method": "search",
  "base_dn": "ou=people,dc=planetexpress,dc=com",
  "search_string": "uid=[search]",
  "users_dn": "cn=[username],dc=planetexpress,dc=com",
  "username": "admin",
  "password": "GoodNewsEveryone",
  "ldap_fullname": "displayName",
  "ldap_email": "mail",
  "ldap_uid": "uid",
  "ldap_debug": 1
}
zero-24 commented 3 years ago

Thanks for checking @PhilETaylor will report your findings back to him when I'm back at my desk later today. So it might be solved by going to the settings and check and save the configurations again.

PhilETaylor commented 3 years ago

as we have no details other than it was an upgrade, I can only assume.

What I have proved is that the feature - when correctly configured (to a known LDAP server) correctly works as advertised.

..... and that @wilsonge probably did not need to tag the framework ldap package 2 days ago :)

wilsonge commented 3 years ago

We decided removing the package at the last minute would probably annoy someone in an extension somewhere even if it wasn't used by core. It was a discussion in the last 24 hours.

Linus1964 commented 3 years ago

Hallo @PhilETaylor

do you mean the file? Sorry, I'm only a user and don't really know about databases etc..

<?xml version="1.0" encoding="utf-8"?>

plg_authentication_ldap Joomla! Project November 2005 (C) 2005 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt admin@joomla.org www.joomla.org 3.0.0 PLG_LDAP_XML_DESCRIPTION ldap.php language/en-GB/plg_authentication_ldap.ini language/en-GB/plg_authentication_ldap.sys.ini
zero-24 commented 3 years ago

meinst du die Datei? Sorry, ich bin nur Anwender und kenne mich nicht wirklich mit Datenbanken etc. aus.

Please run the following on the database (phpmyadmin) to get what @PhilETaylor requested (please replace #__ with your database prefix you can find in the configuration.php.

select params from `#__extensions` where `element` = 'ldap' and `type` = 'plugin';
Linus1964 commented 3 years ago

i entered it exactly like this, but can't find it.

zero-24 commented 3 years ago

Where did you enter it? You have to replace #__ with your database prefix ;-)

Linus1964 commented 3 years ago

yes I have also done so:

select params from *****_extensions where element = 'ldap' and type = 'plugin';

zero-24 commented 3 years ago

and where did you entered that command? It should be in phpmyadmin on the database that your joomla 3.10 site runs

Linus1964 commented 3 years ago

I entered the command in the phpmyadmin on the database. And it is the Joomla 4.0

zero-24 commented 3 years ago

Hmm please send me a database dump to tobias.zulauf@community.joomla.org and I can take a look into it to extract the data Phil is looking for,

Linus1964 commented 3 years ago

Thanks for your help! This is all a bit much for me right now. I can't really follow the requirements or I have to read up first. I'll give up for now.

Regards, Linus.

PhilETaylor commented 3 years ago

I can replicate this only when LDAP Plugin is enabled AND if I dont provide a value for the LDAP server address. Therefore I believe this is the root issue - maybe Joomla should validate it, maybe it could be put down to user error?

Screenshot 2021-08-19 at 18 49 43
PhilETaylor commented 3 years ago

https://github.com/joomla/joomla-cms/pull/35233 will prevent people locking themselves out of Joomla and will allow other authentication methods to run even if LDAP is unconfigured.

zero-24 commented 3 years ago

Thnaks @PhilETaylor