Grant users access to secured resourcesedit

You can use role-based access control to grant users access to secured resources. The roles that you set up depend on your organization’s security requirements and the minimum privileges required to use specific features.

Typically you need the create the following separate roles:

  • setup role for setting up index templates and other dependencies
  • monitoring role for sending monitoring information
  • writer role for publishing events collected by APM Server
  • reader role for Kibana users who need to view and create visualizations that access APM Server data

X-Pack security provides built-in roles that grant a subset of the privileges needed by APM Server users. When possible, use the built-in roles to minimize the affect of future changes on your security strategy.

Grant privileges and roles needed for setupedit

Important

Setting up APM Server is an admin-level task that requires extra privileges. As a best practice, grant the setup role to administrators only, and use a less restrictive role for event publishing.

Administrators who set up APM Server typically need to load mappings, dashboards, and other objects used to index data into Elasticsearch and visualize it in Kibana.

To grant users the required privileges:

  1. Create a setup role, called something like apm_setup, that has the following privileges:

    PrivilegesWhy needed?

    monitor

    Send monitoring data to the cluster

    manage on apm-* indices

    Set up aliases used by ILM

    Omit any privileges that aren’t relevant in your environment.

    Note

    These instructions assume that you are using the default name for APM Server indices. If you are using a custom name, modify the privileges to match your index naming pattern.

  2. Assign the setup role, along with the following built-in roles, to users who need to set up APM Server:

    RolesWhy needed?

    kibana_user

    Load dependencies, such as example dashboards, if available, into Kibana

    ingest_admin

    Set up index templates and, if available, ingest pipelines

    ingest_admin

    Set up ingest pipelines

    Omit any roles that aren’t relevant in your environment.

Grant privileges and roles needed for monitoringedit

X-Pack security provides built-in users and roles for monitoring. The privileges and roles needed depend on the method used to collect monitoring data.

Internal collectionedit

For internal collection, X-Pack security provides the apm_system built-in user and apm_system built-in role for sending monitoring information. You can use the built-in user, or create a user who has the privileges needed to send monitoring information.

If you use the apm_system user, make sure you set the password.

If you don’t use the apm_system user:

  1. Create a monitoring role, called something like apm_monitoring, that has the following privileges:

    PrivilegesWhy needed?

    monitor

    Send monitoring info

    kibana_user

    Use Kibana

  2. Assign the monitoring role, along with the following built-in role, to users who need to monitor APM Server:

    RoleWhy needed?

    monitoring_user

    Use Stack Monitoring in Kibana to monitor APM Server

Metricbeat collectionedit

For Metricbeat collection, X-Pack security provides the remote_monitoring_user built-in user, and the remote_monitoring_collector and remote_monitoring_agent built-in roles for collecting and sending monitoring information. You can use the built-in user, or create a user who has the privileges needed to collect and send monitoring information.

If you use the remote_monitoring_user user, make sure you set the password.

If you don’t use the remote_monitoring_user user:

  1. Create a user on the production cluster who will collect and send monitoring information.
  2. Assign the following roles to the user:

    RoleWhy needed?

    remote_monitoring_collector

    Collect monitoring metrics from APM Server

    remote_monitoring_agent

    Send monitoring data to the monitoring cluster

  3. Assign the following role to users who will view the monitoring data in Kibana:
RoleWhy needed?

monitoring_user

Use Stack Monitoring in Kibana to monitor APM Server

Grant privileges and roles needed for publishingedit

Users who publish events to Elasticsearch need to create and read from APM Server indices. To minimize the privileges required by the writer role, you can use the setup role to pre-load dependencies. Then turn off setup options in the APM Server config file before running APM Server to publish events. For example:

setup.template.enabled: false

To grant the required privileges:

  1. Create a writer role, called something like apm_writer, that has the following privileges (this list assumes the setup options shown earlier are set to false):

    PrivilegesWhy needed?

    index on apm-* indices

    Index events into Elasticsearch

    create_index on apm-* indices

    Create daily indices when connecting to clusters that do not support ILM

  2. Assign the writer role to users who will index events into Elasticsearch.

Grant privileges and roles needed to read APM Server dataedit

Kibana users typically need to view dashboards and visualizations that contain APM Server data. These users might also need to create and edit dashboards and visualizations.

To grant users the required privileges:

  1. Assign the following built-in roles to users who need to read APM Server data:

    RolesWhy needed?

    kibana_user and apm_user

    Use the APM UI

    admin

    Read and update APM Agent configuration via Kibana

Learn more about users and rolesedit

Want to learn more about creating users and roles? See Securing the Elastic Stack. Also see: