-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
kibana_system role missing read permissions for metrics-apm-* and logs-apm-* #170031
Comments
Pinging @elastic/apm-ui (Team:APM) |
It is very surprising to me that the route Either way thanks for bringing this to our attention, and thanks for opening a PR! |
@sqren So I tried to follow the trace where access to other indexes than Keep in mind that it's my first look at kibana source code, so probably someone else should double check this findings. What I found so far:
So it doesn't seem to be necessary to create
Looking at this code, it seems like there is also no way for us to see configuration only for services in the current kibana space (service environment). It would be a nice feature to make Let me know if there is anything else I can do. I can give it a shot at trying to remove those indexes from |
Thank you, @uvNikita! From the Kibana Security team's perspective, we would prefer resolving this issue without having to augment @sqren Could someone from APM investigate further and provide some guidance to @uvNikita? |
Thank you for the writeup @uvNikita. I think you are right, that That being said, I couldn't reproduce the issue. Most likely because I'm using the default setup where metrics are written to @elastic/apm-server Does above sound right, that by default we write to |
@sqren Thanks for looking into it! Yes, we are using |
@uvNikita It looks like we will need your PR and that this cannot be fixed in Kibana. In Lines 13 to 18 in 34bdce9
|
@sqren Good find! |
Related #170031. The internal Elasticsearch client in APM currently takes `apmIndices` as a required argument. This is due to legacy reasons and no longer needed and should therefore be removed. Co-authored-by: Katerina <[email protected]>
Since #170733 is merged does that mean the PR to elasticsearch is still needed? |
Yes. That PR turned out not to have an impact on this problem but the refactor was still an improvement. The original problem will either need to be fixed via changes to documentation, or a change to how agent configurations are retrieved. The problem in a nut shell is that the internal kibana user is querying user configurable indices. This means that if the user changes the indices to something non-standard, we cannot the internal user will not have permissions to query these. |
Opened a PR for fixing this in #173001. This replaces elastic/elasticsearch#101467 |
…s metrics (#173001) Closes: #170031 Replaces: elastic/elasticsearch#101467 **Problem** We need to know if an agent config has been applied at the edge (by APM agents). This is determined by comparing the etag (hash) of the config, with the etag applied at the edges. Previously the agent config itself contained this information (`config.applied_by_agent`) but when running with fleet this will instead be captured in `agent_config` metric documents. Currently the internal kibana user retrieves the `agent_config` metric documents from the APM metric index (`metrics-apm-*` by default). This index is configurable by the end-user so can be changed to something the internal user doesn't have access to. This is a problem. **Solution** This PR replaces the calls made by the internal client with calls made by the authenticated end user (via `APMEventClient`). This approach works for requests made from the browser/UI but doesn't work for background tasks made by fleet. To work around this we only conditionally query the metric index if the `APMEventClient` is available. If `APMEventClient` is not available `applied_by_agent` will be `undefined`
…s metrics (elastic#173001) Closes: elastic#170031 Replaces: elastic/elasticsearch#101467 **Problem** We need to know if an agent config has been applied at the edge (by APM agents). This is determined by comparing the etag (hash) of the config, with the etag applied at the edges. Previously the agent config itself contained this information (`config.applied_by_agent`) but when running with fleet this will instead be captured in `agent_config` metric documents. Currently the internal kibana user retrieves the `agent_config` metric documents from the APM metric index (`metrics-apm-*` by default). This index is configurable by the end-user so can be changed to something the internal user doesn't have access to. This is a problem. **Solution** This PR replaces the calls made by the internal client with calls made by the authenticated end user (via `APMEventClient`). This approach works for requests made from the browser/UI but doesn't work for background tasks made by fleet. To work around this we only conditionally query the metric index if the `APMEventClient` is available. If `APMEventClient` is not available `applied_by_agent` will be `undefined` (cherry picked from commit 58c7958)
…s metrics (elastic#173001) Closes: elastic#170031 Replaces: elastic/elasticsearch#101467 **Problem** We need to know if an agent config has been applied at the edge (by APM agents). This is determined by comparing the etag (hash) of the config, with the etag applied at the edges. Previously the agent config itself contained this information (`config.applied_by_agent`) but when running with fleet this will instead be captured in `agent_config` metric documents. Currently the internal kibana user retrieves the `agent_config` metric documents from the APM metric index (`metrics-apm-*` by default). This index is configurable by the end-user so can be changed to something the internal user doesn't have access to. This is a problem. **Solution** This PR replaces the calls made by the internal client with calls made by the authenticated end user (via `APMEventClient`). This approach works for requests made from the browser/UI but doesn't work for background tasks made by fleet. To work around this we only conditionally query the metric index if the `APMEventClient` is available. If `APMEventClient` is not available `applied_by_agent` will be `undefined` (cherry picked from commit 58c7958)
…s metrics (elastic#173001) Closes: elastic#170031 Replaces: elastic/elasticsearch#101467 **Problem** We need to know if an agent config has been applied at the edge (by APM agents). This is determined by comparing the etag (hash) of the config, with the etag applied at the edges. Previously the agent config itself contained this information (`config.applied_by_agent`) but when running with fleet this will instead be captured in `agent_config` metric documents. Currently the internal kibana user retrieves the `agent_config` metric documents from the APM metric index (`metrics-apm-*` by default). This index is configurable by the end-user so can be changed to something the internal user doesn't have access to. This is a problem. **Solution** This PR replaces the calls made by the internal client with calls made by the authenticated end user (via `APMEventClient`). This approach works for requests made from the browser/UI but doesn't work for background tasks made by fleet. To work around this we only conditionally query the metric index if the `APMEventClient` is available. If `APMEventClient` is not available `applied_by_agent` will be `undefined` (cherry picked from commit 58c7958)
…s metrics (elastic#173001) Closes: elastic#170031 Replaces: elastic/elasticsearch#101467 **Problem** We need to know if an agent config has been applied at the edge (by APM agents). This is determined by comparing the etag (hash) of the config, with the etag applied at the edges. Previously the agent config itself contained this information (`config.applied_by_agent`) but when running with fleet this will instead be captured in `agent_config` metric documents. Currently the internal kibana user retrieves the `agent_config` metric documents from the APM metric index (`metrics-apm-*` by default). This index is configurable by the end-user so can be changed to something the internal user doesn't have access to. This is a problem. **Solution** This PR replaces the calls made by the internal client with calls made by the authenticated end user (via `APMEventClient`). This approach works for requests made from the browser/UI but doesn't work for background tasks made by fleet. To work around this we only conditionally query the metric index if the `APMEventClient` is available. If `APMEventClient` is not available `applied_by_agent` will be `undefined` (cherry picked from commit 58c7958)
Kibana version:
8.10.2
Elasticsearch version:
8.10.2
Original install method (e.g. download page, yum, from source, etc.):
ECK
Describe the bug:
kibana_system
role currently has read permissions fortraces-apm-*
, but missing forlogs-apm-*
andmetrics-apm-*
.APM application in Kibana is configured following these steps: https://www.elastic.co/guide/en/kibana/current/apm-spaces.html
This results in the following error in "Observability -> APM -> Settings -> Agent Configuration" tab: "The list of agent configurations could not be fetched. Your user may not have the sufficient permissions"
Browser Network tab shows the following failing request:
Steps to reproduce:
Alternatively, just check for missing permissions by sending
GET _security/role/kibana_system
Expected behavior:
Should be able to see and create APM agent configuration.
Errors in browser console (if relevant):
Any additional context:
See also Case #01503117
The text was updated successfully, but these errors were encountered: