Skip to content
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] Capabilities feature #21096

Closed
ruflin opened this issue Sep 15, 2020 · 21 comments
Closed

[Elastic Agent] Capabilities feature #21096

ruflin opened this issue Sep 15, 2020 · 21 comments
Labels

Comments

@ruflin
Copy link
Member

ruflin commented Sep 15, 2020

Recently a few features around which capabilities an Agent should support were discussed:

I the future there will be more capabilities which either a user from Fleet or directly the administor of an Agent wants to enforce. Further examples are which output can be used, if a queue can be used, variables etc. For this it would be nice to have a generic capabilities feature in the Elastic Agent that we can extend. This issue is to discuss this feature.

For a system administrator to specify the capabilities the Agent has, I think there are at least 2 ways:

  • Through config file
  • Command line flag on start up

At first, I suggest we start with a capabilities config file. Putting capabilities in a separate config file still allows Fleet to take over the full config file but have the capabilities.yml separate.

The content of the file could look as following:

inputs.allow_list: logfile
inputs.block_list: syslog

# Just an example ...
upgrade.enabled: true
upgrade.bugfix_release: true
upgrade.major_release: false

It would be a flat list of config entries, each describing a capability.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/ingest-management (Team:Ingest Management)

@ruflin
Copy link
Member Author

ruflin commented Sep 15, 2020

@blakerouse @ph @michalpristas Would be great to get your thoughts on this.

@ph
Copy link
Contributor

ph commented Sep 16, 2020

Could we have a unique syntax?

- allow: "inputs.logfile"
- deny: "inputs.syslog"
- allow: "upgrade.enabled"
- allow: "upgrade.bugfix_release"
- deny: "program.endpoint"

@ph
Copy link
Contributor

ph commented Sep 16, 2020

I was suggesting the unique syntax/definition make it behave the same on everything and allow to expose capabilities as we good.

@ruflin
Copy link
Member Author

ruflin commented Sep 16, 2020

@ph Not sure I follow. Would this be in a yaml file?

@ph
Copy link
Contributor

ph commented Sep 16, 2020

@ruflin Just realized I was effectively cut off. What I would like to see is, it is possible to make it a unique syntax for defining capabilities. In the above example, it's a flat Keystore like structure, which is the same for anything vs some items are list vs some items are booleans. But maybe it's not possible.

@blakerouse
Copy link
Contributor

I think we could do something like this. But a note would be there is cases for upgrade.enabled: true there that would still no be true. Setting update.enabled: true but being installed from the DEB/RPM would still not allow upgrading. But setting update.enabled: false would allow disabling upgrade. So it would really only be useful to disable updating.

@ph
Copy link
Contributor

ph commented Sep 16, 2020

@blakerouse Agree on that.

@ruflin
Copy link
Member Author

ruflin commented Sep 17, 2020

So in the deb/rpm case, the config value for upgrade would be compiled into the binary and could not be overwritten? The other option is, that we just ship different defaults for deb/rpm/docker and if a user really wants to change it, he can but it is not supported.

@ph
Copy link
Contributor

ph commented Sep 17, 2020

So in the deb/rpm case, the config value for upgrade would be compiled into the binary and could not be overwritten? The other option is, that we just ship different defaults for deb/rpm/docker and if a user really wants to change it, he can but it is not supported.

I would not make another binary, I think for supportability the binary should always be the same. So we can use different default for DEB/RPM.

@ruflin
Copy link
Member Author

ruflin commented Sep 28, 2020

Thinking more about capabilities, I think there are 2 layers here:

  • Capabilities set on the Agent side: These have to be set on start of the Agent and cannot be changed
  • Capabilities for an Agent set in Fleet: The set of capabilities can be further reduced in Fleet. With this even if an Agent has upgrade capability, it could be disabled for an Agent in Fleet. Or certain inputs for an Agent could be disabled so if a policy for an Agent is modified, certain integrations are not available. I wonder if these capability reductions should also be shipped down to the Agent or if it is a Fleet only feature.

@ph
Copy link
Contributor

ph commented Sep 28, 2020

@ruflin "Capabilities for an Agent set in Fleet", I think the question is to answer is there any security implication for sending them to the Agent or having some "capabilities" executed in fleet allow for some optimization.

@ruflin
Copy link
Member Author

ruflin commented Sep 29, 2020

@ph I'm not sure I follow, sorry :-(

@ph
Copy link
Contributor

ph commented Sep 29, 2020

@ruflin Consider the use case of deploying the Elastic-Agent on a laptop, A user should not be able to prevent "endpoint-security" from running by settings "capabilities". But maybe its already taken care of by the permissions on the file and prevent local user to changes that.

@ruflin
Copy link
Member Author

ruflin commented Sep 29, 2020

Got it. It means this users could restart the Agent and modify the file. We should at least be able to detect such changes in Fleet. I don't think we can fully prevent it.

@ph
Copy link
Contributor

ph commented Sep 29, 2020

@ruflin Yes, maybe having a "compliance" checks that validate expected states or config vs that is on the machine. I was just pushing that problem on your side :)

@ph ph added the v7.12.0 label Oct 14, 2020
@mostlyjason
Copy link

Can you explain how the allowlist and denylist interact when both are present? My initial thought is that an allowlist denies all inputs by default unless they are listed. The denylist is the opposite where all inputs are allowed by default except the ones listed. What is the default if they have both? Furthermore, what takes precedence when there is a conflict? Do we really need to support both?

@ruflin
Copy link
Member Author

ruflin commented Oct 29, 2020

We should probably just start with one, not sure which one. I'm sure there also better syntax options then I proposed so perhaps we can work with conditions we already have instead. This works around the problem of having both. If both exists at the same time, it would probably be an invalid problem to work around the problem.

@ph
Copy link
Contributor

ph commented Oct 29, 2020

@mostlyjason You have raised an excellent point... could we compare that to the firewall case?

In that case, you usually block all and just define allow rules. It's more verbose but it's really explicit and you don't risk to have unwanted things "slip"

@mostlyjason
Copy link

I think in the cloud use case they want to limit the inputs for security reasons, an allowlist is easier to lock down. When someone adds a new input type, we'd have to go back to update the denylist every time, and if we forget it could cause an unintended problem on cloud.

@ruflin
Copy link
Member Author

ruflin commented Jun 15, 2021

@ph Going to close this issue as an initial version of capabilities is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants