Security

How to use ldapfilter with ldapsearch to get group names?

kiran331
Builder

Hi

I'm running a ldapsearch for groups to get its members, but I need only the group objects excluding the user objects, I'm trying to to use sAMAccountType to differentiate the groups and users of the parent group but its not working, is there any alternative option?

ldap search i'm using:

|ldapsearch domain="abc" search=(&(objectClass=group)(cn=tt_users))|ldapgroup |table cn member_name|mvexpand member_namemember|ldapfilter search "cn=$member_name$ attrs"sAMAccountType"|search sAMAccountType="Group_Object"|table cn member_name sAMAccountType

0 Karma

BigCosta
Path Finder

Hi!
This code leave only group objects, excluding the user objects.

| ldapsearch search="(&(objectClass=group)(cn=tt_users))" attrs="cn,distinguishedName"
| ldapgroup
| table cn member_name
| mvexpand member_name
| ldapfilter search="(&(objectClass=group)(cn=$member_name$))" attrs="objectSid"

alemarzu
Motivator

Hi there @kiran331

Im not quite sure what you are trying to accomplish, can u elaborate further ?

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...