-
Notifications
You must be signed in to change notification settings - Fork 73
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
[Change Proposal] Add support for specifying Elasticsearch privileges #203
Comments
Thanks for putting together directly a proposal. I think there are at least 2 ways to approach this. First as proposed here that the manifest hands over a predefined list of permissions to Fleet and Fleet just adds it to the policy without knowing what is inside. This gives a lot of freedom to the package dev to basically do whatever is needed. The second part is around more "opinionated" config options that do not directly represent the Elasticsearch security permissions. For example the user can only set the following:
With this, we would ensure that data streams are always only have a small subset of the permissions and Fleet would "understand" what permissions were given and could even have special visualisations around it to show what kind of permissions are there / required. I think the first one is easy to implement and gives APM exactly what is needed but I'm not sure if we would benefit long term more from option 2 to keep more control. Opinions? |
I don't see a compelling reason to have an alternative set of privilege names. Fleet could restrict the allowed privileges without coming up with its own mapping -- it would just need to restrict the values that can be specified in Ultimately I think we would be better served by not having such hard-coded restrictions, but instead:
You would know better than me, but I would expect integrations with additional privileges to be uncommon. Since it would be uncommon, this could just be a basic list of the exact Elasticsearch privilege names and a link to https://www.elastic.co/guide/en/elasticsearch/reference/current/security-privileges.html for an explanation of what they mean. |
I don't expect many integrations needing this, hence I consider it advanced usage. Adding a translation layer also means we need to document & keep it up to date, later ES breaking changes may create some headaches for us too. Since more integration developers will be coming it's really important that we prompt the user when installing one with extra privileges for them to inspect. I'm wondering if |
@axw have you considered how this change affects the deployment model of our users? Many operate Elastic Agent on Endpoints that do not have a direct connection to Elasticsearch for security reasons. They send data only through proxies like Logstash or Kafka. We also considering a change to introduce a secure proxy to avoid exposing ES credentials on endpoints. For tail based sampling, this would require APM server to run in centralized trusted environment. Have you considered a local version of tail based sampling that can operate on endpoints without ES access? |
@mostlyjason yes, we have considered this. What we'll be delivering initially will have some restrictions; we may introduce options for other deployment modes later. The alternative is to have centralised APM Servers with trace ID routing, which introduces other complications and costs.
Not necessarily centralised, but yes they do need to have direct access to Elasticsearch for now. Our tail-based sampling is coherent, meaning that all events in the trace are sampled according to the same decision. This either requires all events to go through the same APM Server, or for APM Servers to coordinate. For various reasons that I won't go into here, we have gone with the latter. There are two ways in which we expect APM to be deployed: on trusted hosts for backend services, and as a central service (e.g. ESS) for RUM/untrusted applications. We can later introduce another proxy-type service for this feature, which would take care of reading from Elasticsearch and making that data available to APM Servers. Another option would be to chain servers, with a central or regional server with direct access to Elasticsearch performing the tail-based sampling. |
@ruflin @exekias it sounds like we're aligned in our thinking.
I agree, but I imagine this will take a while to design and implement - and I would like to not have to wait for that to enable tail-based sampling. We shouldn't YOLO security either though. As a compromise, how about the following proposal?
Does this sound reasonable? @jen-huang sound okay from a Fleet perspective? |
Sorry, I miss the context/justification behind this feature (not Elasticsearch expert), so not blocking this initiative. |
Andrew's proposal sounds good to me, I think it makes sense to add this kind of settings to packages. Beyond the change in the spec, something that is not completely clear to me is how |
@jsoriano The way this works in Fleet is that Fleet creates a permission block in the policy. Fleet-server uses this permission block to create the API with these permissions for the Elastic Agent. So the Elastic Agent will always receive only an API key with these permissions. |
This looks reasonable to me, WDYT @jen-huang? Once this go in the spec we would need code handling permissions on the kibana side |
++
Currently Fleet defaults to Once this proposal is closed, please open a corresponding Kibana issue. Thanks! Edit: I accidentally closed this :D |
They should not be default across the board. There's one data stream for which APM needs additional privilegesw. Fleet should consider these to be the maximum set of allowable privileges, but should continue to default to the privileges given today. |
Calling this accepted. I've created implementation issues, will close this once they've been implemented. |
All implementation tasks are complete. I'm going to put together an end-to-end test, and once I've confirmed everything is working well together I'll close this. |
I've manually confirmed the changes are working. The end-to-end test will take a little while longer to put together for unrelated reasons, so I'll close this now. Thanks all! |
In elastic/kibana#94591 and elastic/kibana#97366, Kibana added support for informing fleet-server of the privileges that should be assigned to an agent API Key. There was mention of a pending proposal in one of the PRs for packages to specify privileges ("permissions"):
We would like to do just this in APM Server, to enable servers to periodically refresh and read a single non-sensitive data stream: elastic/apm-server#5490. Specifically, we require the
maintenance
andread
index privileges for thetraces-apm.sampled-*
index pattern. I don't think the proposal was ever made, so I'm proposing it now.The way the Kibana code is written, a
permissions
property would be expected indata_stream/<data_stream>/manifest.yml
, e.g.Given that these permissions are Elasticsearch privileges, I think it might make more sense to define them as such explicitly. e.g.
Implementation issues:
elasticsearch.privileges.indices
to DataStream type package-registry#712The text was updated successfully, but these errors were encountered: