# Restrict access exclusively to 1 index

**URL:** <https://forum.opensearch.org/t/restrict-access-exclusively-to-1-index/10955>\
**Category:** Security\
**Tags:** discuss, configure\
**Created:** [September 18, 2022, 9:02pm UTC](https://forum.opensearch.org/t/restrict-access-exclusively-to-1-index/10955 "2022-09-18T21:02:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnenderson](https://avatars.discourse-cdn.com/v4/letter/j/87869e/32.png) [@johnenderson](https://forum.opensearch.org/u/johnenderson)\
**Post date:** [September 18, 2022, 9:02pm UTC](https://forum.opensearch.org/t/restrict-access-exclusively-to-1-index/10955/1 "2022-09-18T21:02:27Z")

</div>

Hi, I’m new to using OpenSearch and I’m trying to give permissions inside a function, just for 1 index.  
To make this possible I am creating the following objects:  
1 - Tenant  
2 - Role  
3 - User  
4 - And finally performing the Role Mapping

Would the request below to create the Role be correct?

```auto
{
  "cluster_permissions": ["cluster_monitor"],
  "index_permissions": [{
    "index_patterns": [
      "opensearch_dashboards_sample_data_flights"
    ],
    "dls": "",
    "fls": [],
    "masked_fields": [],
    "allowed_actions": [
      "indices_monitor", "create_index", "crud", "data_access", "indices:data/read/search", "indices:admin/create"
    ]
  }],
  "tenant_permissions": [{
    "tenant_patterns": [
      "{{tenant}}"
    ],
    "allowed_actions": [
      "kibana_all_write"
    ]
  }]
}

```

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [September 19, 2022, 10:10am UTC](https://forum.opensearch.org/t/restrict-access-exclusively-to-1-index/10955/2 "2022-09-19T10:10:56Z")

</div>

@johnenderson It looks correct and it worked in my lab.

---

<div class="post-metadata">

**Author:** ![johnenderson](https://avatars.discourse-cdn.com/v4/letter/j/87869e/32.png) [@johnenderson](https://forum.opensearch.org/u/johnenderson)\
**Post date:** [September 20, 2022, 11:24am UTC](https://forum.opensearch.org/t/restrict-access-exclusively-to-1-index/10955/3 "2022-09-20T11:24:25Z")

</div>

Nice!  
Is there any recommendation on what types of permissions to use? In this case, which ones do I need to include so that it is possible to do everything within the chosen index and still create the Dashboards?  
I’m using OpenSearch managed by AWS, and I have a feeling I might run into some restrictions using this managed service.

---

<div class="post-metadata">

**Author:** ![angelogabeira](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/angelogabeira/32/4248_2.png) [@angelogabeira](https://forum.opensearch.org/u/angelogabeira)\
**Post date:** [September 20, 2022, 2:47pm UTC](https://forum.opensearch.org/t/restrict-access-exclusively-to-1-index/10955/4 "2022-09-20T14:47:20Z")

</div>

@johnenderson  
I managed to allow access to 1 single index including the desired index and the index “.kibana” in the permission, because without it the menu did not appear.  
The other indices, if any, continue to appear but the user receives the forbidden message

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [September 20, 2022, 4:23pm UTC](https://forum.opensearch.org/t/restrict-access-exclusively-to-1-index/10955/5 "2022-09-20T16:23:46Z")

</div>

@johnenderson Documentation doesn’t have a detailed description of all permissions.  
However, you can start with default action groups and predefined roles.

> **[Default action groups](https://opensearch.org/docs/latest/security-plugin/access-control/default-action-groups/)**
>
> Default action groups

> **[Users and roles](https://opensearch.org/docs/latest/security-plugin/access-control/users-roles/)**
>
> Users and roles

> **[Permissions](https://opensearch.org/docs/latest/security-plugin/access-control/permissions/)**
>
> Permissions

If your role will miss any required privilege, OpenSearch will report that in the logs.

---

<div class="post-metadata">

**Author:** ![jinoinfo](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@jinoinfo](https://forum.opensearch.org/u/jinoinfo)\
**Post date:** [July 5, 2024, 9:25am UTC](https://forum.opensearch.org/t/restrict-access-exclusively-to-1-index/10955/6 "2024-07-05T09:25:51Z")

</div>

> [@angelogabeira](#):
>
> because without it the menu did not appear

I am also facing same issue… i have give indices epcis\_index & .kibana. Still getting security exception indices:monitor/settings/get. I have given following index permissions.read  
indices:monitor/settings/get  
indices:monitor/stats

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [August 9, 2024, 10:53am UTC](https://forum.opensearch.org/t/restrict-access-exclusively-to-1-index/10955/7 "2024-08-09T10:53:41Z")

</div>

@jinoinfo Have you tried giving this permission at the cluster level?

---

<div class="post-metadata">

**Author:** ![jinoinfo](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@jinoinfo](https://forum.opensearch.org/u/jinoinfo)\
**Post date:** [August 9, 2024, 1:00pm UTC](https://forum.opensearch.org/t/restrict-access-exclusively-to-1-index/10955/8 "2024-08-09T13:00:55Z")

</div>

> [@pablo](#):
>
> c

If you are asking specific to the issue i mentioned above, it was due to some strange browser cache issue. After clearing the cache it worked fine for me
