Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds documentation for permission that provides access to system indexes #4849

Merged
merged 25 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c77bac7
fix#4736 system index permission
cwillum Aug 22, 2023
f37d69e
fix#4736 system index permission
cwillum Aug 22, 2023
abc33d3
fix#4736 system index permission
cwillum Aug 22, 2023
f2b57de
fix#4736 system index permission
cwillum Aug 22, 2023
13b0589
fix#4736 system index permission
cwillum Aug 24, 2023
f75599c
fix#4736 system index permission
cwillum Aug 24, 2023
887ff13
fix#4736 system index permission
cwillum Aug 24, 2023
8cad753
Merge branch 'main' into fix#4736-permissionable-sys-indexes
cwillum Aug 29, 2023
4b1494a
fix#4736 system index permission
cwillum Aug 29, 2023
548c739
fix#4736 system index permission
cwillum Aug 29, 2023
4953ef5
fix#4736 system index permission
cwillum Aug 30, 2023
7662f64
fix#4736 system index permission
cwillum Aug 30, 2023
ec6972d
Fixes some wordings around system index permission access and usage (…
DarshitChanpura Aug 31, 2023
72e2cc1
fix#4736 system index permission
cwillum Sep 5, 2023
063c27c
fix#4736 system index permission
cwillum Sep 5, 2023
c76426a
Changes the feature flag key and updates some text (#4953)
DarshitChanpura Sep 6, 2023
c959b64
fix#4736 system index permission
cwillum Sep 7, 2023
ba37dc1
fix#4736 system index permission
cwillum Sep 7, 2023
771a8b0
fix#4736 system index permission
cwillum Sep 8, 2023
3e96bd9
fix#4736 system index permission
cwillum Sep 8, 2023
bcaee4f
fix#4736 system index permission
cwillum Sep 11, 2023
798eecb
fix#4736 system index permission
cwillum Sep 11, 2023
35268a2
fix#4736 system index permission
cwillum Sep 11, 2023
e7e7208
fix#4736 system index permission
cwillum Sep 11, 2023
0caa394
fix#4736 system index permission
cwillum Sep 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions _security/access-control/permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,47 @@ Rather than individual permissions, you can often achieve your desired security
{: .tip }


## System index permissions

System index permissions are unique among other permissions in that they extend some traditional admin-only accessibility to non-admin users. These permissions give normal users the ability to modify any system index specified in the role or roles to which they are mapped. The exception to this is the security system index, `.opendistro_security`, which is used to store Security's configuration YAML files and remains accessible only to admins with an admin certificate.
cwillum marked this conversation as resolved.
Show resolved Hide resolved

Along with standard index permissions, you specify system index permissions in the 'roles.yml' configuration file under 'index_permissions' (See [roles.yml]({{site.url}}{{site.baseurl}}/security/configuration/yaml/#rolesyml). You do this by specifying `system:admin/system_index` in the role's `allowed_actions` section and adding the system index in the `index_patterns` section.
cwillum marked this conversation as resolved.
Show resolved Hide resolved

For example, the system index permission that gives a user permission to modify the system index that stores configurations for the Alerting plugin is defined by the index pattern `.opendistro-alerting-config` and its allowed action is defined as `system:admin/system_index`. The following role shows how this system index permission is configured along with other attributes:
cwillum marked this conversation as resolved.
Show resolved Hide resolved

```yml
alerting-role:
reserved: true
hidden: false
cluster_permissions:
- "cluster:admin/opendistro/alerting/alerts/ack"
- "cluster:admin/opendistro/alerting/alerts/get"
index_permissions:
- index_patterns:
- ".opendistro-alerting-config"
- allowed_actions:
- "system:admin/system_index"
```

The permission prefix `.opendistro` also works with the wildcard to extend its reach of access. This can be useful, but it should be used with caution to avoid giving unintentional access to system indexes. When specifying system indexes for roles, keep the following considerations in mind:

* Specifying the full name of a system index limits access to that index alone: `.opendistro-alerting-config`.
cwillum marked this conversation as resolved.
Show resolved Hide resolved
* Specifying the prefix and a partial name for a system index provides access to all system indexes that begin with the name: `.opendistro-anomaly-detector*`.
* Using `.*` is effectively the same as specifying the prefix with wildcard, as described in the previous point. This gives access to all system indexes that begin with a `.`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using * is allowed, there is no requirement for a special case with .*. The following index pattern is the shortest way to give a user full access to all - including system indices - on the cluster.

  index_permissions:
    - index_patterns:
        - '*'
      allowed_actions:
        - '*'
        - 'system:admin/system_index'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peternied Thanks for pointing this out. I've reworded the points above to bring guidance in line with this clarification. Is the additional wildcard necessary under allowed_actions only when you want to specify all system indexes under index_patterns?
One other nitpick. Are values for this configuration wrapped in single quotes or double quotes? Or doesn't it matter? I've seen both.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Quotes Single vs Double]
Just looked this up from from the spec. Generally we shouldn't use quotes, however, special characters like * and : should be quoted.

Generally single quote style is what we should use in our docs as double quotes are used for interpolation eg \n becomes the newline character inside double quotes.

Don't want to think about it, you can interactively use yaml-formatter, or we can look at added a formatter as part of this project.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the additional wildcard necessary under allowed_actions only when you want to specify all system indexes under index_patterns?

@DarshitChanpura can you confirm?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peternied "YAML formatter": a thing of beauty. Thanks.

* Entering the wildcard `*` by itself does not give access to any indexes.

Use extreme caution when using the wildcard to configure access to system indexes. We highly recommend thinking ahead and anticipating the range of access that you will be extending to users before updating your configuration files.
Copy link
Member

@peternied peternied Sep 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extreme caution, this feels a little dramatic, is this inline with other risky operations in the access control system?

Note; I'd rather educate users that they could test the pattern by using GET /_cat/indices/.kibana* which returns all the indices associated with that index pattern (in this case any index starting with .kibana), which has the resulting output of the following indices, at least on my test cluster.

green open .kibana_1 XmTePICFRoSNf5O5uLgwRw 1 1 220 0 468.3kb 232.1kb
green open .kibana_2 XmTePICFRoSNf5O5uLgwRw 1 1 220 0 468.3kb 232.1kb
green open .kibana_3 XmTePICFRoSNf5O5uLgwRw 1 1 220 0 468.3kb 232.1kb

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peternied Good perspective on that. I removed that caution (seemed redundant, anyhow) and replaced it with a "tip" about using the GET /_cat/indices/<index> operation to verify your index pattern. Thank you for that.

{: .warning }


cwillum marked this conversation as resolved.
Show resolved Hide resolved
### Enabling system index permissions

Users that have the permission [`restapi:admin/roles`]({{site.url}}{{site.baseurl}}/security/access-control/api/#access-control-for-the-api) are able to map system index permissions to all users in the same way they would for a cluster or index permission in the `roles.yml` file. However, to preserve some control over this permission, the system index permission feature is disabled by default and allows administrators to enable this feature by setting the configuration `plugins.security.system_indices.additional_control.enabled` to `true`. For more information about this setting, see [Enabling user access to system indexes]({{site.url}}{{site.baseurl}}/security/configuration/yaml/#enabling-user-access-to-system-indexes).

Keep in mind that an admin user who enables this feature necessarily accepts the risks involved with giving normal users access to system indexes, which may contain sensitive information and configurations essential to a cluster's health. An admin user should also take precautions when assigning `restapi:admin/roles` to users because this permission gives a user not only the ability to assign the system index permission to another user but, equally, the ability to self-assign access to any system index.
cwillum marked this conversation as resolved.
Show resolved Hide resolved
{: .warning }


## Cluster permissions

These permissions are for the cluster and can't be applied granularly. For example, you either have permissions to take snapshots (`cluster:admin/snapshot/create`) or you don't. The cluster permission, therefore, cannot grant a user privileges to take snapshots of a select set of indexes while preventing the user from taking snapshots of others.
Expand Down
14 changes: 14 additions & 0 deletions _security/configuration/yaml.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,20 @@ An authentication cache for the Security plugin exists to help speed up authenti
plugins.security.cache.ttl_minutes: 60
```

### Enabling user access to system indexes

Mapping a system permission to a user allows that user to modify the system index specified in the permission's name. (The one exception is the Security plugin's [system index]({{site.url}}{{site.baseurl}}/security/configuration/system-indices/)). The `plugins.security.system_indices.additional_control.enabled` setting provides a way for administrators to make this permission available for or hidden from role mapping.

When set to `true`, the feature is enabled and users with access to modify roles can add an index pattern and the allowed action `system:admin/system_index` to a role.

```yml
plugins.security.system_indices.additional_control.enabled: true
```
When set to `false`, the permission is disabled and only admins with an admin certificate can make changes to system indexes. By default, the setting is `false` for a new cluster.
cwillum marked this conversation as resolved.
Show resolved Hide resolved

To learn more about system index permissions, see [System index permissions]({{site.url}}{{site.baseurl}}/security/access-control/permissions/#system-index-permissions) in Permissions documentation.
cwillum marked this conversation as resolved.
Show resolved Hide resolved


### Password settings

If you want to run your users' passwords against some validation, specify a regular expression (regex) in this file. You can also include an error message that loads when passwords don't pass validation. The following example demonstrates how to include a regex so OpenSearch requires new passwords to be a minimum of eight characters with at least one uppercase, one lowercase, one digit, and one special character.
Expand Down