|
| 1 | +--- |
| 2 | +layout: default |
| 3 | +title: Anomaly Detection Security |
| 4 | +nav_order: 10 |
| 5 | +parent: Anomaly Detection |
| 6 | +has_children: false |
| 7 | +--- |
| 8 | + |
| 9 | +# Anomaly detection security |
| 10 | + |
| 11 | +You can use the security plugin with anomaly detection to limit non-admin users to specific actions. For example, you might want some users to only be able to create, update, or delete detectors, while others to only view detectors. |
| 12 | + |
| 13 | +All anomaly detection indices are protected as system indices. Only a super admin user or an admin user with a TLS certificate can access system indices. For more information, see [System indices](../../security/configuration/system-indices/). |
| 14 | + |
| 15 | + |
| 16 | +Security for anomaly detection works the same as [security for alerting](../../alerting/security/). |
| 17 | + |
| 18 | +## Basic permissions |
| 19 | + |
| 20 | +As an admin user, you can use the security plugin to assign specific permissions to users based on which APIs they need access to. For a list of supported APIs, see [Anomaly Detection API](../api/). |
| 21 | + |
| 22 | +The security plugin has two built-in roles that cover most anomaly detection use cases: `anomaly_full_access` and `anomaly_read_access`. For descriptions of each, see [Predefined roles](../../security/access-control/users-roles/#predefined-roles). |
| 23 | + |
| 24 | +If these roles don't meet your needs, mix and match individual anomaly detection [permissions](../../security/access-control/permissions/) to suit your use case. Each action corresponds to an operation in the REST API. For example, the `cluster:admin/opendistro/ad/detector/delete` permission lets you delete detectors. |
| 25 | + |
| 26 | +## (Advanced) Limit access by backend role |
| 27 | + |
| 28 | +Use backend roles to configure fine-grained access to individual detectors based on roles. For example, users of different departments in an organization can view detectors owned by their own department. |
| 29 | + |
| 30 | +First, make sure that your users have the appropriate [backend roles](../../security/access-control/). Backend roles usually come from an [LDAP server](../../security/configuration/ldap/) or [SAML provider](../../security/configuration/saml/), but if you use the internal user database, you can use the REST API to [add them manually](../../security/access-control/api/#create-user). |
| 31 | + |
| 32 | +Next, enable the following setting: |
| 33 | + |
| 34 | +```json |
| 35 | +PUT _cluster/settings |
| 36 | +{ |
| 37 | + "transient": { |
| 38 | + "opendistro.anomaly_detection.filter_by_backend_roles": "true" |
| 39 | + } |
| 40 | +} |
| 41 | +``` |
| 42 | + |
| 43 | +Now when users view anomaly detection resources in Kibana (or make REST API calls), they only see detectors created by users who share at least one backend role. |
| 44 | +For example, consider two users: `alice` and `bob`. |
| 45 | + |
| 46 | +`alice` has an analyst backend role: |
| 47 | + |
| 48 | +```json |
| 49 | +PUT _opendistro/_security/api/internalusers/alice |
| 50 | +{ |
| 51 | + "password": "alice", |
| 52 | + "backend_roles": [ |
| 53 | + "analyst" |
| 54 | + ], |
| 55 | + "attributes": {} |
| 56 | +} |
| 57 | +``` |
| 58 | + |
| 59 | +`bob` has a human-resources backend role: |
| 60 | + |
| 61 | +```json |
| 62 | +PUT _opendistro/_security/api/internalusers/bob |
| 63 | +{ |
| 64 | + "password": "bob", |
| 65 | + "backend_roles": [ |
| 66 | + "human-resources" |
| 67 | + ], |
| 68 | + "attributes": {} |
| 69 | +} |
| 70 | +``` |
| 71 | + |
| 72 | +Both `alice` and `bob` have full access to anomaly detection: |
| 73 | + |
| 74 | +```json |
| 75 | +PUT _opendistro/_security/api/rolesmapping/anomaly_full_access |
| 76 | +{ |
| 77 | + "backend_roles": [], |
| 78 | + "hosts": [], |
| 79 | + "users": [ |
| 80 | + "alice", |
| 81 | + "bob" |
| 82 | + ] |
| 83 | +} |
| 84 | +``` |
| 85 | + |
| 86 | +Because they have different backend roles, `alice` and `bob` cannot view each other's detectors and its results. |
0 commit comments