All Apps and Add-ons

How does one use an OR ldap query in ldapfilter?

tomcochran
New Member

Example:
Splunk does not like the | in the ldap query

| ldapfilter domain=DIR search="(|(sAMAccountName=$User$)(objectSid=$SID$))" attrs="cn,objectSid"

Also does not work to escape it:

| ldapfilter domain=DIR search="(\|(sAMAccountName=$User$)(objectSid=$SID$))" attrs="cn,objectSid"
0 Karma

javiergn
SplunkTrust
SplunkTrust

Take a look at this: https://tools.ietf.org/search/rfc2254

   If a value should contain any of the following characters

           Character       ASCII value
           ---------------------------
           *               0x2a
           (               0x28
           )               0x29
           \               0x5c
           NUL             0x00

   the character must be encoded as the backslash '\' character (ASCII
   0x5c) followed by the two hexadecimal digits representing the ASCII
   value of the encoded character. The case of the two hexadecimal
   digits is not significant.

   This simple escaping mechanism eliminates filter-parsing ambiguities
   and allows any filter that can be represented in LDAP to be
   represented as a NUL-terminated string. Other characters besides the
   ones listed above may be escaped using this mechanism, for example,
   non-printing characters.

Specifically this:

Other characters besides the ones listed above may be escaped using this mechanism, for example, non-printing characters.

Therefore I would try the following. Please let me know if works as I don't have a test lab to verify:

| ldapfilter domain=DIR search="(\7c(sAMAccountName=$User$)(objectSid=$SID$))" attrs="cn,objectSid"
0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...