-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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 privileges to kibana_system to support APM service maps #50051
Adds privileges to kibana_system to support APM service maps #50051
Conversation
Pinging @elastic/es-security (:Security/Authorization) |
Hey @ogupte, the If I understand correctly, I'm not familiar with the details of the |
@kobelb In order to make this feature work, we use the task manager to schedule a task runner (runs every minute) which queries APM transactions and spans (covered by |
Alerting is using the task-manager to run jobs that internally use Elasticsearch API Keys so that the background jobs run as the end-user which scheduled them. This allows us quite a bit of flexibility in regard to the data-indices that the background job can read from and index into without requiring that the |
In our implementation kibana schedules the job when it starts, there is no end-user who kicks it off. As for the |
Granting the |
@kobelb take a look at the service maps PR for Kibana: elastic/kibana#50844 |
@kobelb I'm also working on a background task that collects telemetry about the data profile of our customers, e.g. how many transactions or services are stored/retained. This will likely run into the same issue; there's no user that would kick this off either, and to expect the user to click a button so Elastic can collect telemetry doesn't sound useful. How would you recommend solving this? |
I see that there is an I am also leaning towards only granting the |
Apologies for the wall of text. I've included quite a bit of "history" and ancillary content here to make sure we're all on the same page. There are two general categories of indices:
System-indices are used by the various systems within the Elastic Stack to store data. These indices should never be accessed directly by end-users, and all indirect access to these indices should go through an API provided by an application within the Elastic Stack. Data-indices store data which has been ingested into the Elastic Stack. These indices are accessed directly by end-users and can be accessed by the standard Elasticsearch document and search APIs. PrivilegesEnd-users should not have Elasticsearch privileges to access system-indices. Instead, end-users should have either cluster privileges which allow them to use dedicated Elasticsearch REST APIs, for example the Security APIs for indirectly manipulating the End-users should have Elasticsearch privileges to access data-indices. This allows users to utilize DLS to restrict which documents a user can access, and FLS to restrict the fields a user can access. Data ingestion and privilegesHistorically, all data was ingested by applications like Logstash before being inserted into data-indices and end users of Kibana could just read the documents from the data-indices. This requires Logstash itself to have permission to write to the data indices, and it requires user intervention to configure the user and role that Logstash uses. End-users are then assigned roles which allow them to read from the data-indices that Logstash ingests data into. A similar situation applies to APM Server, which ingests documents into data-indices. The user must create a user and role that the APM Server will use for writing documents into Elasticsearch. This requires user-intervention, and the Using Kibana to transform dataKibana's list of responsibilities continues to grow, and Kibana has started to do its own data transformation. Examples of this are Alerting, SIEM's detection engine, Endpoint's alerts and now APM's service maps. In these situations, the transformation at a very high-level reads from existing documents in data-indices does some transformation and then stores the results in Elasticsearch. During this transformation, we need to ensure that we don't break the existing privileges model. Alerting does this by using Elasticsearch's API keys to run the transformation using the identity of the user which scheduled the alert. This ensures that the end-user themselves is able to read from the source data-indices, their DLS/FLS is respected, and that they are authorized to write the results to Elasticsearch. This differs from the previous ingest workflow by not requiring a specific user be configured in a .yml file somewhere, and instead gets the user's consent when the alert itself is created. This approach also ensures that a user is unable to "escalate their privileges" to get access to data they previously wouldn't have access to. If a hard-fast requirement of APM's implementation of service maps is that the job is automatically ran by Kibana on start-up, then Alerting's approach will not work. However, we still need explicit "user consent" and we can potentially utilize the approach that Albert brought up where a username/password is provided in the |
Do you have any additional documentation regarding the "source data" that you'd like to derive this telemetry data from, and how it will be consumed? |
@kobelb I'm running some queries on the data indices ( |
ff65136
to
80f737d
Compare
kibana_system to support APM service maps in kibana
80f737d
to
005d0e0
Compare
Hey @ogupte, this PR is still adding privileges to the |
Since our discussion, the design changed to address the security concern of potentially leaking user data. We did this by making the |
If I understand correctly, the end-user themselves has privileges to read from the |
Yes, this is accurate. The implementation to make it work like this adds a quite of bit of complexity to an already complex task. In retrospect, we're considering abandoning the background task in favor of doing all queries at runtime without any persistence. The platform just isn't able to support the data transformations we need in a way that doesn't also interrupt the user flow. Closing for now. |
Addresses elastic/kibana#48996 by giving the kibana_system reserved role privileges to create and write to index
apm-service-connections
and read fromapm-*
indices.