Por exemplo, se você tiver esse grupo:
dn: cn=people-admins,ou=groups,dc=example,dc=com
objectClass: groupOfUniqueNames
cn: admins of people group
cn: people-admins
uniqueMember: uid=test1,ou=people,dc=example,dc=com
uniqueMember: uid=test2,ou=people,dc=example,dc=com
você pode imprimir todos os membros com:
ldapsearch -x -LLL -H ldap://127.0.0.1:3000/ -b dc=example,dc=com -s sub '(&(objectClass=inetOrgPerson)(memberof=cn=people-admins,ou=groups,dc=example,dc=com))' -D "cn=admin,dc=example,dc=com" -w admin uid
dn: uid=test1,ou=people,dc=example,dc=com
uid: evgeniy
dn: uid=test2,ou=people,dc=example,dc=com
uid: test2
Atualizar
No meu caso, o ldapsearch não funciona com seus dados de teste, devido a essa configuração:
# Load memberof module
dn: cn=module{0},cn=config
changetype: modify
add: olcModuleLoad
olcModuleLoad: memberof
# Backend memberOf overlay
dn: olcOverlay={0}memberof,olcDatabase={1}hdb,cn=config
changetype: add
objectClass: olcOverlayConfig
objectClass: olcMemberOf
olcOverlay: {0}memberof
olcMemberOfDangling: ignore
olcMemberOfRefInt: TRUE
olcMemberOfGroupOC: groupOfUniqueNames
olcMemberOfMemberAD: uniqueMember
olcMemberOfMemberOfAD: memberOf
Então, altero seus dados de teste para:
dn: cn=bowlers,ou=People,dc=example,dc=com
objectClass: groupOfUniqueNames
cn: bowlers
description: IT security group
uniqueMember: uid=wahab,ou=People,dc=example,dc=com
uniqueMember: uid=sachin,ou=People,dc=example,dc=com
e depois:
ldapsearch -x -LLL -H ldap://127.0.0.1:3000/ -b dc=example,dc=com -s sub '(memberof=cn=bowlers,ou=People,dc=example,dc=com)' -D "cn=admin,dc=example,dc=com" -w admin uid
dn: uid=wahab,ou=People,dc=example,dc=com
uid: wahab
dn: uid=sachin,ou=People,dc=example,dc=com
uid: sachin
para que você tenha que configurar sua memberof
overlay para trabalhar com groupOfNames
ou alterá-la para groupOfUniqueNames