I have installed Librenms on Centos 8 Stream.
However I tried to setup AD Auth, but its seems something is not working and cant get what is the problem.
I have followed all steps through Authentication Options - LibreNMS Docs, but I got one exepction and cant login with ad account.
[OK] Composer Version: 2.5.8
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database Schema is current
[OK] SQL Server meets minimum requirements
[OK] lower_case_table_names is enabled
[OK] MySQL engine is optimal
[OK] Database and column collations are correct
[OK] Database schema correct
[OK] MySQl and PHP time match
[OK] Active pollers found
[OK] Dispatcher Service not detected
[OK] Locks are functional
[OK] Python poller wrapper is polling
[OK] Redis is unavailable
[OK] rrd_dir is writable
[OK] rrdtool version ok
/opt/librenms/scripts/auth_test.php -l -d
Authentication Method: active_directory
Reporting disabled by user setting
AD bind anonymous successful
ldap_get_entries(): Argument #2 ($result) must be of type LDAP\Result, bool given {“exception”:“[object] (TypeError(code: 0): ldap_get_entries(): Argument #2 ($result) must be of type LDAP\Result, bool given at /opt/librenms/LibreNMS/Authentication/ActiveDirectoryCommon.php:73)”}
In ActiveDirectoryCommon.php line 73:
ldap_get_entries(): Argument #2 ($result) must be of type LDAP\Result, bool given
Also when I tried with /opt/librenms/scripts/auth_test.php -u [email protected] -d
Authentication Method: active_directory
Reporting disabled by user setting
AD bind anonymous successful
Password:
Authenticate user [email protected]:
Error: LibreNMS\Exceptions\AuthenticationException thrown!
Invalid credentials.
I’m using php8.1 with installed php-ldap the same version.
Does anyone could help?
I set my AD auth up awhile ago and know it took a little bit of finesse to get working below is a bit of a snippet of relevant settings from my config.php for Comparision:
@lzdravkov90 Were you able to resolve this? I’m getting the same error (ldap_get_entries(): Argument #2 ($result) must be of type LDAP\Result) with a first-time LDAP setup on Ubuntu, with the same versions of LibreNMS and PHP.
I managed to connect, but only with the user without @domain.
When I removed my account from the domain group LibreNMS_Administrators, I cant connect which is okay.
Any ideas why I’m able to login only with username withount need to add the domain?
Yes, auth_test.php still returns that error, but atleast the login is sucessuful now.
andrzejmaczka thank you very much for the help. That make sense with the SAMAccountName I will give a look of what you provided for userPrincipalName
Thanks all.
Both are true for me. If I remove group access lines from the config I don’t get the error (but no users are found). I thought for a while yesterday it was because of an issue in the groupFilter function of ActiveDirectoryCommon.php, but if it works for others maybe I was wrong. I messed around with the file some and couldn’t get it working. auth_test.php -u works as expected.