2018-04-20 21:13:37 +02:00
|
|
|
[role="xpack"]
|
|
|
|
[[secure-reporting]]
|
2019-09-25 19:05:48 +02:00
|
|
|
=== Reporting and security
|
2018-04-20 21:13:37 +02:00
|
|
|
|
|
|
|
Reporting operates by creating and updating documents in {es} in response to
|
|
|
|
user actions in {kib}.
|
|
|
|
|
2020-07-18 00:16:11 +02:00
|
|
|
To use {report-features} with {security-features} enabled, you need to
|
|
|
|
<<using-kibana-with-security,configure security in {kib}>>.
|
2018-04-20 21:13:37 +02:00
|
|
|
If you are automatically generating reports with
|
2019-11-26 22:48:59 +01:00
|
|
|
{ref}/xpack-alerting.html[{watcher}], you also need to configure {watcher}
|
2019-12-12 17:49:17 +01:00
|
|
|
to trust the {kib} server's certificate.
|
|
|
|
////
|
|
|
|
For more information, see
|
2018-04-20 21:13:37 +02:00
|
|
|
<<securing-reporting>>.
|
2019-12-12 17:49:17 +01:00
|
|
|
////
|
2018-04-20 21:13:37 +02:00
|
|
|
|
|
|
|
[[reporting-app-users]]
|
2019-12-12 17:49:17 +01:00
|
|
|
To enable users to generate reports, you must assign them the built-in `reporting_user`
|
|
|
|
role. Users will also need the appropriate <<kibana-privileges, {kib} privileges>> to access the objects
|
2019-11-22 00:12:13 +01:00
|
|
|
to report on and the {es} indices.
|
2018-04-20 21:13:37 +02:00
|
|
|
|
2019-12-12 17:49:17 +01:00
|
|
|
[float]
|
|
|
|
[[reporting-roles-management-ui]]
|
|
|
|
=== If you are using the `native` realm
|
|
|
|
|
2020-10-26 15:01:01 +01:00
|
|
|
To assign roles, use the *Roles* UI or <<reporting-roles-user-api, user API>>.
|
2020-06-12 17:14:19 +02:00
|
|
|
This example shows how to use *Roles* page to create a user who has a custom role and the
|
2019-12-12 17:49:17 +01:00
|
|
|
`reporting_user` role.
|
|
|
|
|
2020-10-26 15:01:01 +01:00
|
|
|
. Open the main menu, then click *Stack Management > Roles*.
|
2019-12-12 17:49:17 +01:00
|
|
|
|
2020-06-12 17:14:19 +02:00
|
|
|
. Click *Create role*, then give the role a name, for example, `custom_reporting_user`.
|
2019-12-12 17:49:17 +01:00
|
|
|
|
|
|
|
. Specify the indices and privileges.
|
2018-04-20 21:13:37 +02:00
|
|
|
+
|
2019-12-12 17:49:17 +01:00
|
|
|
Access to data is an index-level privilege, so in *Create role*,
|
|
|
|
add a line for each index that contains the data for the report and give each
|
|
|
|
index `read` and `view_index_metadata` privileges.
|
|
|
|
For more information, see {ref}/security-privileges.html[Security privileges].
|
|
|
|
+
|
|
|
|
[role="screenshot"]
|
|
|
|
image::user/security/images/reporting-privileges-example.png["Reporting privileges"]
|
|
|
|
|
|
|
|
. Add space privileges.
|
|
|
|
+
|
|
|
|
Reporting users typically save searches, create
|
|
|
|
visualizations, and build dashboards. They require a space
|
|
|
|
that provides read and write privileges in
|
2020-09-04 15:13:44 +02:00
|
|
|
*Discover* and *Dashboard*.
|
2019-12-12 17:49:17 +01:00
|
|
|
|
|
|
|
. Save your new role.
|
|
|
|
|
2020-10-26 15:01:01 +01:00
|
|
|
. Open the main menu, then click *Stack Management > Users*, add a new user, and assign the user the built-in
|
2019-12-12 17:49:17 +01:00
|
|
|
`reporting_user` role and your new custom role, `custom_reporting_user`.
|
|
|
|
|
2020-01-07 19:25:00 +01:00
|
|
|
[float]
|
|
|
|
==== With a custom index
|
|
|
|
|
|
|
|
If you are using Reporting with a custom index,
|
|
|
|
the `xpack.reporting.index` setting should begin
|
|
|
|
with `.reporting-*`. The default {kib} system user has
|
|
|
|
`all` privileges against the `.reporting-*` pattern of indices.
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
xpack.reporting.index: '.reporting-custom-index'
|
|
|
|
|
|
|
|
If you use a different pattern for the `xpack.reporting.index` setting,
|
|
|
|
you must create a custom role with appropriate access to the index, similar
|
|
|
|
to the following:
|
|
|
|
|
2020-10-26 15:01:01 +01:00
|
|
|
. Open the main menu, then click *Stack Management > Roles*.
|
2020-06-12 17:14:19 +02:00
|
|
|
. Click *Create role*, then name the role `custom-reporting-user`.
|
2020-01-07 19:25:00 +01:00
|
|
|
. Specify the custom index and assign it the `all` index privilege.
|
2020-10-26 15:01:01 +01:00
|
|
|
. Open the main menu, then click *Stack Management > Users* and create a new user with
|
2020-01-07 19:25:00 +01:00
|
|
|
the `kibana_system` role and the `custom-reporting-user` role.
|
|
|
|
. Configure {kib} to use the new account:
|
|
|
|
[source,js]
|
|
|
|
elasticsearch.username: 'custom_kibana_system'
|
|
|
|
|
2019-12-12 17:49:17 +01:00
|
|
|
[float]
|
|
|
|
[[reporting-roles-user-api]]
|
|
|
|
==== With the user API
|
|
|
|
This example uses the {ref}/security-api-put-user.html[user API] to create a user who has the
|
2020-01-31 22:17:06 +01:00
|
|
|
`reporting_user` role and the `kibana_admin` role:
|
2019-12-12 17:49:17 +01:00
|
|
|
|
2018-04-20 21:13:37 +02:00
|
|
|
[source, sh]
|
|
|
|
---------------------------------------------------------------
|
2018-12-10 21:42:56 +01:00
|
|
|
POST /_security/user/reporter
|
2018-04-20 21:13:37 +02:00
|
|
|
{
|
|
|
|
"password" : "x-pack-test-password",
|
2020-01-31 22:17:06 +01:00
|
|
|
"roles" : ["kibana_admin", "reporting_user"],
|
2018-04-20 21:13:37 +02:00
|
|
|
"full_name" : "Reporting User"
|
|
|
|
}
|
|
|
|
---------------------------------------------------------------
|
|
|
|
|
2019-12-12 17:49:17 +01:00
|
|
|
[float]
|
|
|
|
=== If you are using an external identity provider
|
|
|
|
|
|
|
|
If you are using an external identity provider, such as
|
|
|
|
LDAP or Active Directory, you can either assign
|
2018-04-20 21:13:37 +02:00
|
|
|
roles on a per user basis, or assign roles to groups of users. By default, role
|
|
|
|
mappings are configured in
|
2020-12-08 14:47:07 +01:00
|
|
|
{ref}/mapping-roles.html[`config/role_mapping.yml`].
|
2018-04-20 21:13:37 +02:00
|
|
|
For example, the following snippet assigns the user named Bill Murray the
|
2020-01-31 22:17:06 +01:00
|
|
|
`kibana_admin` and `reporting_user` roles:
|
2019-12-12 17:49:17 +01:00
|
|
|
|
2018-04-20 21:13:37 +02:00
|
|
|
[source,yaml]
|
|
|
|
--------------------------------------------------------------------------------
|
2020-01-31 22:17:06 +01:00
|
|
|
kibana_admin:
|
2018-04-20 21:13:37 +02:00
|
|
|
- "cn=Bill Murray,dc=example,dc=com"
|
|
|
|
reporting_user:
|
|
|
|
- "cn=Bill Murray,dc=example,dc=com"
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
[role="xpack"]
|
|
|
|
[[securing-reporting]]
|
2019-09-25 19:05:48 +02:00
|
|
|
=== Secure the reporting endpoints
|
2018-04-20 21:13:37 +02:00
|
|
|
|
|
|
|
In a production environment, you should restrict access to
|
2020-07-18 00:16:11 +02:00
|
|
|
the reporting endpoints to authorized users. This requires that you:
|
2018-04-20 21:13:37 +02:00
|
|
|
|
2020-07-18 00:16:11 +02:00
|
|
|
. Enable {stack-security-features} on your {es} cluster. For more information,
|
|
|
|
see {ref}/security-getting-started.html[Getting started with security].
|
2020-01-14 18:56:18 +01:00
|
|
|
. Configure TLS/SSL encryption for the {kib} server. For more information, see
|
|
|
|
<<configuring-tls>>.
|
|
|
|
. Specify the {kib} server's CA certificate chain in `elasticsearch.yml`:
|
2018-04-20 21:13:37 +02:00
|
|
|
+
|
2020-01-14 18:56:18 +01:00
|
|
|
--
|
|
|
|
If you are using your own CA to sign the {kib} server certificate, then you need
|
|
|
|
to specify the CA certificate chain in {es} to properly establish trust in TLS
|
|
|
|
connections between {watcher} and {kib}. If your CA certificate chain is
|
|
|
|
contained in a PKCS #12 trust store, specify it like so:
|
|
|
|
|
|
|
|
[source,yaml]
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
xpack.http.ssl.truststore.path: "/path/to/your/truststore.p12"
|
|
|
|
xpack.http.ssl.truststore.type: "PKCS12"
|
|
|
|
xpack.http.ssl.truststore.password: "optional decryption password"
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
Otherwise, if your CA certificate chain is in PEM format, specify it like so:
|
|
|
|
|
|
|
|
[source,yaml]
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
xpack.http.ssl.certificate_authorities: ["/path/to/your/cacert1.pem", "/path/to/your/cacert2.pem"]
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
For more information, see {ref}/notification-settings.html#ssl-notification-settings[the {watcher} HTTP TLS/SSL Settings].
|
|
|
|
--
|
2018-04-20 21:13:37 +02:00
|
|
|
|
|
|
|
. Add one or more users who have the permissions
|
2020-07-18 00:16:11 +02:00
|
|
|
necessary to use {kib} and {report-features}. For more information, see
|
2018-04-20 21:13:37 +02:00
|
|
|
<<secure-reporting>>.
|
|
|
|
|
2020-07-18 00:16:11 +02:00
|
|
|
Once you've enabled SSL for {kib}, all requests to the reporting endpoints
|
2018-04-20 21:13:37 +02:00
|
|
|
must include valid credentials. For example, see the following page which
|
|
|
|
includes a watch that submits requests as the built-in `elastic` user:
|
|
|
|
<<automating-report-generation>>.
|
|
|
|
|
|
|
|
For more information about configuring watches, see
|
2020-07-18 00:16:11 +02:00
|
|
|
{ref}/how-watcher-works.html[How {watcher} works].
|