-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Elastic Agent] Allowlist / Blocklist for inputs an Agent supports with Fleet #21000
Comments
Pinging @elastic/ingest-management (Team:Ingest Management) |
A few questions that need to be answered which will affect the design and implementation. Agents:
Kibana side is elastic/kibana#76841 Looping PM @mostlyjason |
we were talking with @ph about this feature and question arised, aside design where should implementation take place, would it be fleet server responsible for specifying these based on some metadata |
@michalpristas Not sure I follow, this should be an Elastic Agent. This feature should also work in standalone even though I don't see a use case there. When enrolled into fleet, the Elastic Agent must report its capabilities. |
i think the question comes to what @ph said a comment above: at what point this should be defined? |
As this is a restriction that should be applied independent of how the agent is run, I don't think it should happen on enroll time. The config seems like a natural place but that becomes a challenge when enrolling as it is overwritten. For designing the feature I would take fleet out of the equation to keep it an independent feature. |
Agree on decoupling the Fleet in elastic/kibana#76841 and Agent implementation. @michalpristas Do you have a proposal how a user would configure the restriction in the YAML? |
If we put in the config that means its set when the agent is started (or restarted)? It could change more often than enrollment since its a runtime setting? Also, we could put it in a section of agent config that is not overwritten by fleet. For example, it could be in Also, I imagine we'd want way to report whether inputs are disabled due to a blocklist, perhaps in our status information to ES? This could be similar to how we report input conditions. |
@mostlyjason what you are proposing I think this is exactly what Ruflin and I had in mind but not explained as good as you. For reporting it could either be status information... or even metadata on the agent? |
Including @jfsiii for awareness. |
here's what i've been thinking about, feedback more than welcome Rule structure
i was considering a bunch of different options but this one seems most straightforward and leaves space for enhancements. Everything is allowed by default with empty ruleset I was also thinking option that will deny everything as soon as any with config
Agent is allowed everything
An agent should only be used for memory collection
An agent should not be allowed to run endpoint
An agent should only be used to collect system metrics but not logs
An agent should only be used to collect system information
An agent should collect only hb pings
Allow system/metrics but deny all other system inputs
I would split implementation into 3 stages possibly
What i mean by more detailed filtering is enabling subset of the stream to be applied
we would enable specifying rule in a way that it not only allows/denies stream based on a when condition but also filters it after applying
where filter is a KV with key specifying path to object we're applying filter for
after applying
it would result in
after applying
it would result in
|
@urso @blakerouse You might be interested in this? This is an interesting syntax, and it's built on top of what we have. I don't want to increase the scope but I certainly see this useful in other places:
Do you see us standardizing on the same syntax or at least same code path? |
I like this I think its very flexible. From this it seems like the end of the ruleset always has the following appended:
At first I was confused on the need for |
Filter is something which came to mind while i was thinking about options and structure and which might be powerful tool in our toolbox but I did not planed to include that into this release it's just something i wanted to raise as a stretch goal with very low priority |
I've played with the syntax in theory you also limit what output is used with something like this: -rule: deny
output: logstash -rule: deny
output: logstash
when: ${ssl} != true Concerning the filter its super powerful but I don't think we need it in the short term, maybe something we can investigate or let the users drive the requirements feature. @mostlyjason @michalpristas I like that you have created an implementation plant in phase, keeping it at the "1st one: rules support on input level" for the first iteration look like a good idea. |
Maybe we should consider adding an optional or even mandatory |
One thing I would like to see is to be able to use this system also for outputs or for example upgrades, see #21096 Taking the proposal, we might be able to extend it like the following:
The above would potentially allow that each rule type could have its own independent implementation and additional params passed in like in the case of upgrade. Not happy with the proposal there yet but maybe something to iterate on? Is there a reason to use @michalpristas Where will these rules be specified to make sure they also still apply after enrolling? @michalpristas Is the rule under |
i was going for when as we have that in spec and it also reads nicely regarding input/output/upgrade i like what @ph suggested above, it allows you to combine rule e.g
which would disable all inputs/outputs not using ssl. upgrade could be defined as (to allow bugfix
to allow minor
or update one major up
edit: endpoint example was indeed other way around |
I missed the part that we might want to add multiple conditions from different types together like your input / output example above. But I wonder if this applies in practice or is just theoretical? On @michalpristas Where will this be specified to work in standalone but also when enrolled into Fleet? |
oh yeah, i planned to have it combining is theoretical |
i think we just need to be careful to evaluate rules before eql gets evaluated as it uses |
This should NOT be configurable through Fleet. This is important as the person setting up the Elastic Agent puts in these restrictions and Fleet should not be able to overwrite these. |
For an implementation stand point, not combining is probably easier to implement, validates and reason about. |
Configuration storage
+100
In case of automated provisioning users might want to have a single file prepared that can be shared. But I presume one can run agent with multiple config files in that case? In standalone case an administrator might even want to maintain the rules in a separate read-only config file, such that users that have write access to the Condition vs when
+1 on using FilterI would say: No. If users provide an invalid configuration according to the configured rules, reject it. Be strict! And report to logs or Fleet UI that some configuration has been rejected (let users see and maybe react). Although In some places we use regular expressions and glob filters. For example the log input. As these match a "regular language", you will have a hard time to write a good |
i like having separate file for this. i can easily imagine using |
When combining I also think that |
As for the rules, I also think a separate file is better. I would be okay with just |
The way I think of this feature is capabilities that the Elastic Agent supports, much less of rules that define what can be in the configuration. From an implementation perspective, we will use "rules" to filter out config blocks which are not supported but this is an implementation detail. Explaining this to a user, I would explain it the way that this Elastic Agent only supports the Elasticsearch output, or that the capabilities this Elastic Agent has is only input type apm and nothing else. So on my end, I would land on For the combination: Already our conversation above shows it is not easy to explain. Lets stay away from it until we have a specific requirement for it. |
@michalpristas Can you take 2-3 mins, add a summary comment with the plan this will help reduce any miscommunication.) |
+1 please consider how we track that an input is blocked. It'd be great to be able to see this in the agent details UI so a user can understand why no data is coming in or why the agent is unhealthy, then fix it. That means we should record it in a way that we can programmatically show the status in the UI |
updated summary Rule structure
Everything is allowed by default with empty ruleset with config
Agent is allowed everything
An agent should only be used for memory collection
An agent should not be allowed to run endpoint
An agent should only be used to collect system metrics but not logs
An agent should only be used to collect system information
An agent should collect only hb pings
Allow system/metrics but deny all other system inputs
I would split implementation into 3 stages possibly
I still need to think about representation of blocked, one thing is that information will be in logs with sufficient details. If input/output/upgrade contains ID this will be returned otherwise as: ${rule_name}-input/output/upgrade-${type}
|
Would it make sense to have this as part of the status reporting API? |
To keep it simple, lets only focus on input for now so we can also circumvent the partial problem. |
Question - are we settled on the name "Allowlist" and "Blocklist" ? - I worry that these names may cause confusion with blocklists and allowlists for other use cases (blocklist of file hashes on endpoint, blocklist of IPs, etc.) Perhaps somethng like Available Integrations/Unavailable Integrations |
@bradenlpreston aside from |
@bradenlpreston Nit: This is about inputs not integrations, just to make sure we are talking about the same thing. In the case of endpoing, the input is the integration but in most cases there are multiple inputs per integration. |
thank you for the clarification @ruflin and @michalpristas |
When an Agent is run with Fleet, today any input that is supported by a package can be run. But there are cases where the administrator of the Agent itself would like to limit the type of inputs that can be run. Few examples:
The Agent needs a way to allow / block list certain inputs when it is run so Fleet cannot send down any configs which contain these inputs or the not allowed inputs are ignored. Which inputs are supported or not supported should also be sent up to Fleet to make Fleet smart around what can be configured and what not.
The text was updated successfully, but these errors were encountered: