# Filter backend roles acquired with LDAP

**URL:** <https://forum.opensearch.org/t/filter-backend-roles-acquired-with-ldap/23593>\
**Category:** Security\
**Tags:** troubleshoot\
**Created:** [February 27, 2025, 6:43am UTC](https://forum.opensearch.org/t/filter-backend-roles-acquired-with-ldap/23593 "2025-02-27T06:43:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![unoume](https://avatars.discourse-cdn.com/v4/letter/u/ea666f/32.png) [@unoume](https://forum.opensearch.org/u/unoume)\
**Post date:** [February 27, 2025, 6:43am UTC](https://forum.opensearch.org/t/filter-backend-roles-acquired-with-ldap/23593/1 "2025-02-27T06:43:05Z")

</div>

Hi,

**Versions** (relevant - OpenSearch/Dashboard/Server OS/Browser):  
OpenSearch and Dashboards - 2.11.0

**Describe the issue** :  
Authorized with LDAP user is able to see all their LDAP groups as backend roles (“View roles and identities”). It would be nice to limit this list only to the groups contained in particular OU which specified in **rolebase** field. For my case it should be `OU=OpenSearch,OU=Security Groups,DC=corp,DC=domain,DC=com`

**Configuration** :

```auto
"authz": {
  "ldap": {
    "http_enabled": true,
    "transport_enabled": true,
    "authorization_backend": {
      "type": "ldap",
      "config": {
        "enable_ssl": false,
        "enable_start_tls": false,
        "enable_ssl_client_auth": false,
        "verify_hostnames": false,
        "hosts": [
          "ldap.corp.domain.com:389"
        ],
        "bind_dn": "CN=OpenSearch,OU=System Services,DC=corp,DC=domain,DC=com",
        "password": "the_password",
        "userbase": "DC=corp,DC=domain,DC=com",
        "usersearch": "(&(sAMAccountName={0})(memberof=CN=Permissions - opensearch,OU=OpenSearch,OU=Security Groups,DC=corp,DC=domain,DC=com)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))",
        "username_attribute": "sAMAccountName",
        "rolebase": "OU=OpenSearch,OU=Security Groups,DC=corp,DC=domain,DC=com",
        "rolesearch": "(member={0})",
        "rolename": "cn"
      }
    }
  }
}

```

I’ve read about exclude\_roles and now I’m thinking about some regex like `^(?!Permissions - opensearch.*)`. But looks like this feature is available since 2.13, and I’m not sure about regex usage possibility.

I also wonder if it possible to use not only english letters in rolebase value?

---

<div class="post-metadata">

**Author:** ![Anthony](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/anthony/32/9939_2.png) [@Anthony](https://forum.opensearch.org/u/Anthony)\
**Post date:** [March 4, 2025, 9:36am UTC](https://forum.opensearch.org/t/filter-backend-roles-acquired-with-ldap/23593/2 "2025-03-04T09:36:10Z")

</div>

@unoume I would recommend to raise a feature request on [github](https://github.com/opensearch-project/OpenSearch/issues)
