Skip to content

Commit 0fd6668

Browse files
committed
feedback 🙏, +step4
1 parent 1d8a4b3 commit 0fd6668

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

troubleshoot/elasticsearch/file-based-recovery.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Before granting a `file` realm user any roles, you need to ensure that those des
5353

5454
{{es}} recommends following the industry's [principle of least privilege](https://en.wikipedia.org/wiki/Principle_of_least_privilege) when granting user permissions. {{es}} follows this guidance itself by [restricting system indices](/deploy-manage/users-roles/cluster-or-deployment-auth/role-structure.md#roles-indices-priv) by default, even from [`superuser` role](/deploy-manage/users-roles/cluster-or-deployment-auth/built-in-roles.md#roles) administrators including the [`elastic` built-in user](/deploy-manage/users-roles/cluster-or-deployment-auth/built-in-users.md).
5555

56-
When recovering {{stack}} {{security-features}}, you might need to temporarily define a custom role with the [`allow_restricted_indices` setting](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-security-put-role) enabled.
56+
The main {{stack}} {{security-features}} rely on the `security` [feature state](/deploy-manage/tools/snapshot-and-restore.md) which is mostly composed of the `.security*` [system indices](elasticsearch://reference/elasticsearch/rest-apis/api-conventions.md#system-indices). When recovering {{stack}} {{security-features}}, you will likely need to temporarily define a custom role with the [`allow_restricted_indices` setting](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-security-put-role) enabled.
5757

5858
For example, to grant all of the privileges of `superuser` role alongside `allow_restricted_indices: true` you can create a new role called `superduperuser` with the following definition:
5959

@@ -214,4 +214,22 @@ You can also add `file` realm users using [{{k8s}} basic authentication secrets]
214214

215215
:::
216216

217-
::::
217+
::::
218+
219+
## Step 4: Recover {{security-features}} [file-realm-recovery-curl]
220+
221+
At this point, the local {{es}} node will accept [Elasticsearch API requests](https://www.elastic.co/docs/reference/elasticsearch/rest-apis) with the created `file` based username and password. Assuming username `admin` was created with password `changeme` and role `superduperuser`, then you could curl the [Get cluster info API](https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-info) from the node's local shell
222+
```bash
223+
curl -X GET -sk -u "admin:changeme" "https://localhost:9200/"
224+
```
225+
226+
:::{{tip}}
227+
The related API requests need to be directed to the local node(s) where `file` has been configured rather than to any cluster-level load balancer or proxy URL.
228+
:::
229+
230+
You can confirm desired `superduperuser` role is applied to your `admin` username with [Authenticate a user API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-security-authenticate)
231+
```bash
232+
curl -X GET -sk -u "admin:changeme" "https://localhost:9200/_security/_authenticate?pretty=true"
233+
```
234+
235+
Now that you have regained recovery access to the cluster you can investigate and recover the {{stack}} {{security-features}} as needed.

0 commit comments

Comments
 (0)