Open hitenmandalia opened 1 year ago
A temporary workaround would be to assign your groups a dummy object class not used by other groups and filter by that too: (ObjectClass=group)(ObjectClass=whateverdummyobjectclassyouchose)
But yes, from what I tested, all that Teampass can resolve for now are enumerations of simple filters that will be ANDed together, no compound filters, no wildcards. The above will produce: (&(ObjectClass=group)(ObjectClass=whateverdummyobjectclassyouchose))
If your teampass groups sit in a subtree from other groups, like cn=standard,dc=teampass,dc=groups,dc=example / cn=trusted,dc=teampass,dc=groups,dc=example, you can add a filter like (dc:dn:=tempass) that will only allow groups that have dc=tempass in their dn.
@Andrei-Paul Thank you for helping point me in the right direction. What I ended up doing is using the extension attributes in AD. I used one extension attribute and gave it the value "teampassgroup". Also I was getting the same issue as with https://github.com/nilsteampassnet/TeamPass/issues/3710. I used a second extension attribute and gave each group a unique integer value. And this fixed the issue for both. so thank you for your input on both.
However, there is now an issue with AD login on the latest version 3.0.7. Whilst I can so LDAP sync's and select users and groups, I cannot log in using an AD account. So hopefully that get looked at soon and fixed.
I also saw your fix for the cronjob which i am also experiencing. However I am not using a dockerfile to build my container as I am using AWS Fargate to run my teampass with an RDS MySQL DB.
@hitenmandalia Posted there a runtime cronjob fix, but since AWS Fargate seems to use a container, that container must be build somewhere using some instructions. I suspect it uses the Dockerfile in a repo, so if the PR is accepted, the build-time fix will work. (never used AWS Fargate, just guessing)
@Andrei-Paul I have built the container manually on my machine rather than using a docker file. However, right now since LDAP login seems to be broken on 3.0.7, ill wait it out before trying it out again.
Just a small comment. Same problem in 3.1.0. By adding som debug lines I discovered that whe passing the parameter for ldap_group_object_filter, the code somehow transforms all the chars after =-sign into "\ascii-code for sign".That is "samaccountname=*" transforms into "samaccountname=\2A". ldap_user_object_filter is not translated in this way, but used directly as it is stated in tp.config, so that one works So this must be a bug of som sort. I think it should be up to the user to escape the chars she wants in the setting according to rfc 2254
I am trying to get the AD group to Role mapping working with Teampass. When using the (ObjectClass=group) filter, i get a very large list of groups returned, although not complete list as our AD has a huge number of groups. When trying to search for just the specific groups i need, I can use the filter (cn=) and it will return me the group in question. However, I have multiple groups which I want to assign to different TeamPass roles, and I cannot get more then one group to appear. I have tried the following filters of which only one works:
(ObjectClass=group) - Works but lists large number of groups. Many groups still missing (cn=) - Works (single group)
(cn=)(cn=) - Doesnt work (2 groups)
(|(cn=)(cn=)) - Doesnt work (using OR filter)
Maybe i am writing the filters wrong, so it would be really appreciated if someone who has this working could reply.
Steps to reproduce
Expected behaviour
I should be able to get all listed groups in AD returned
Actual behaviour
Can only get one group at a time
Server configuration
Operating system: Alpine Linux 3,17
Web server: Nginx
Database: MySQL 8
PHP version: 8.1.18
Teampass version: 3.0.7
Teampass configuration file:
Below is the error when using the non-working filters
Logs
Web server error log
2023/05/04 16:43:59 [error] 16#16: *818 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught ErrorException: ldap_search(): Search: Bad search filter in /var/www/TeamPass/includes/libraries/LdapRecord/Ldap.php:235 Stack trace:
0 [internal function]: LdapRecord\Ldap->LdapRecord{closure}()
1 /var/www/TeamPass/includes/libraries/LdapRecord/Ldap.php(235): ldap_search()
2 /var/www/TeamPass/includes/libraries/LdapRecord/HandlesConnection.php(171): LdapRecord\Ldap->LdapRecord{closure}()
3 /var/www/TeamPass/includes/libraries/LdapRecord/Ldap.php(237): LdapRecord\Ldap->executeFailableOperation()
4 /var/www/TeamPass/includes/libraries/LdapRecord/Query/Builder.php(716): LdapRecord\Ldap->search()
5 /var/www/TeamPass/includes/libraries/LdapRecord/Connection.php(394): LdapRecord\Query\Builder->LdapRecord\Query{closure}()
6 /var/www/TeamPass/includes/libraries/LdapRecord/Connection.php(352): LdapRecord\Connection->runOperationCallback()
7 /var/www/TeamPass/includes/libraries/LdapRecord/Query/Builder.php(718): LdapRecord\Connection->run()
8 /var/www/Tea" while reading response header from upstream, client: 172.17.0.1, server:, request: "POST /sources/roles.queries.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "", referrer: "http:///index.php?page=roles"
Log from the web-browser developer console (CTRL + SHIFT + i)