I have a bunch of AlmaLinux machines with SSSD configured to allow LDAP auth and it's working fine.
We have a very huge LDAP directory and some users got multiple entries following this schema.
dn: cn=John Dow,ou=randomgrp,ou=something,o=bla,c=xyz
ou: RANDOMGRP
uid: jdow@RANDOMGRP
uniqueidentifier: 123456
AccredOrder: 3
memberOf: special_group
dn: cn=John Dow,ou=primarygrp,ou=somewhere,o=bla,c=xyz
ou: PRIMARYGRP
uid: jdow
uid: jdow@PRIMARYGRP
uniqueidentifier: 123456
AccredOrder: 1
memberOf: special_group
dn: cn=John Dow,ou=anothergrp,ou=somehow,o=bla,c=xyz
ou: ANOTHERGRP
uid: jdow@ANOTHERGRP
uniqueidentifier: 123456
AccredOrder: 2
memberOf: special_group
This is the result of a ldapsearch query filtered with uniqueIdentifier attribute. OU names can be different obviously, depending of the user.
The first problem I faced is that LDAP is returning the info of those 3 accounts in random order, letting in sometimes jdow, sometimes jdow@ANOTHERGRP or sometimes jdow@RANDOMGRP. I fixed the problem using this filter in my sssd.conf file
ldap_access_filter = (&(memberof=special_group)(accredorder=1))
That only let in users with accredorder set to 1 and it's working fine.
The problem I have now is when the system is querying the LDAP for it's own business. Most of the time it's working fine but as the LDAP is randomly returning one of the 3 accounts, the tool running on the machines got sometimes jdow@ANOTHERGRP as an answer for the UID of the connected user when it was jdow one jour before and it messes up the software.
I don't know if my explanation is clear but is there a way to filter "automatic" queries the system is making? Like a ldapsearch.conf where I could add default filters?
To resume, I need to only get information for account with accredorder attribute set to 1 for all the queries the system would make.
Thanks for your help