nilsteampassnet / TeamPass

Collaborative Passwords Manager
https://www.teampass.net
1.63k stars 532 forks source link

Problem when logging in or validating using Active Directory LDAP #4080

Open naranma opened 4 months ago

naranma commented 4 months ago
### Steps to reproduce 1. I'm using 'Active Directory' in the 'LDAP server type' option. 2. Afterwards, I tried to log in through the login screen or in the user test on the LDAP panel. ### Expected behaviour The user must log in. ### Actual behaviour The user is unable to log in. ### The issue was fixed The issue was fixed by changing from OpenLDAP to ActiveDirectory. File on line 30: ```teampass/vendor/teampassclasses/ldapextra/src/ActiveDirectoryExtra.php``` from ```use LdapRecord\Models\OpenLDAP\User;``` to ```use LdapRecord\Models\ActiveDirectory\User;``` ### Server configuration **Operating system**: Ubuntu 22.04 **Web server:** Apache2 **Database:** MySql 5.7 **PHP version:** 8.2 **Teampass version:** 3.1.1 ### Logs #### Web server error log ``` PHP Fatal error: Uncaught Error: Call to a member function isEnabled() on null in /var/www/teampass/vendor/te ampassclasses/ldapextra/src/ActiveDirectoryExtra.php:132 Stack trace: #0 /var/www/teampass/sources/ldap.queries.php(170): TeampassClasses\\LdapExtra\\ActiveDirectoryExtra->userIsEnabled() #1 {m ain} thrown in /var/www/teampass/vendor/teampassclasses/ldapextra/src/ActiveDirectoryExtra.php on line 132, referer: https://.../index.php?page=ldap --- PHP Fatal error: Uncaught Error: Call to a member function isEnabled() on null in /var/www/teampass/vendor/teampassclasses/ldapextra/src/ActiveDirectoryExtra.php:132 Stack trace: #0 /var/www/teampass/sources/identify.php(1185): TeampassClasses\\LdapExtra\\ActiveDirectoryExtra->userIsEnabled() #1 /var/www/teampass/sources/identify.php(2283): authenticateThroughAD() #2 /var/www/teampass/sources/identify.php(323): identifyDoLDAPChecks() #3 /var/www/teampass/sources/identify.php(157): identifyUser() #4 /var/www/teampass/sources/identify.php(189): handleAuthAttempts() #5 {main} thrown in /var/www/teampass/vendor/teampassclasses/ldapextra/src/ActiveDirectoryExtra.php on line 132, referer: https://... --- PHP Fatal error: Uncaught Error: Call to a member function groups() on null in /var/www/teampass/vendor/teampassclasses/ldapextra/src/ActiveDirectoryExtra.php:101 Stack trace: #0 /var/www/teampass/sources/identify.php(1265): TeampassClasses\\LdapExtra\\ActiveDirectoryExtra->getUserADGroups() #1 /var/www/teampass/sources/identify.php(2283): authenticateThroughAD() #2 /var/www/teampass/sources/identify.php(323): identifyDoLDAPChecks() #3 /var/www/teampass/sources/identify.php(157): identifyUser() #4 /var/www/teampass/sources/identify.php(189): handleAuthAttempts() #5 {main} thrown in /var/www/teampass/vendor/teampassclasses/ldapextra/src/ActiveDirectoryExtra.php on line 101, referer: https://... ```
Jugurtha13 commented 4 months ago

Hello,

I have the same problem If you have a solution, I'd love to hear from you

[Thu Feb 29 17:41:50.184133 2024] [php:error] [pid 2017] [client 10.0.15.28:58671] PHP Fatal error: Uncaught Error: Call to a member function isEnabled() on null in /var/www/html/TeamPass-3.1.1/vendor/teampassclasses/ldapextra/src/ActiveDirectoryExtra.php:132\nStack trace:\n#0 /var/www/html/TeamPass-3.1.1/sources/ldap.queries.php(170): TeampassClasses\\LdapExtra\\ActiveDirectoryExtra->userIsEnabled()\n#1 {main}\n thrown in /var/www/html/TeamPass-3.1.1/vendor/teampassclasses/ldapextra/src/ActiveDirectoryExtra.php on line 132, referer: https://teampass.aspserveur.local/index.php?page=ldap

Thx

naranma commented 4 months ago

The issue was fixed

The issue was fixed by changing from OpenLDAP to ActiveDirectory.

File on line 30: teampass/vendor/teampassclasses/ldapextra/src/ActiveDirectoryExtra.php

from use LdapRecord\Models\OpenLDAP\User; to use LdapRecord\Models\ActiveDirectory\User;

I tested the latest version in the repository, version 3.1.1, and it worked.

Commit: 380c0f6 Link: https://github.com/nilsteampassnet/TeamPass/tree/380c0f6553a739a5d02797223b4e69654f2a7d22

Zip File: https://github.com/nilsteampassnet/TeamPass/archive/380c0f6553a739a5d02797223b4e69654f2a7d22.zip

Updating is required via the link: https://your_site/install/upgrade.php

Jugurtha13 commented 4 months ago

Great, it works, I've been pulling my hair out for 2 days. Many thanks