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

[Agent] Minimizing Elastic-Agent privileges #174

Closed
4 tasks
andrewvc opened this issue Sep 14, 2021 · 22 comments
Closed
4 tasks

[Agent] Minimizing Elastic-Agent privileges #174

andrewvc opened this issue Sep 14, 2021 · 22 comments

Comments

@andrewvc
Copy link
Contributor

Action plan after meeting today with @blakerouse @fntlnz and @justinkambic

There are three use cases for elastic-agent with different security requirements, where we can have three different behaviors.

For docker containers specifically, we need a clear path to running as non-root for two reasons:

  1. It will be flagged by many orgs as insecure,
  2. Some software (synthetics) cannot run as root, so we need consistent guidance, today we need to advise people to run as different users for different use cases.

New Behavior by Use Case

Install command on local machine

  1. Keep running as root
  2. Individual beats can downgrade privileges / setuid as needed (see [Heartbeat] Setuid to regular user / lower capabilities when possible beats#27878 which does this in just heartbeat as an example)

Run in docker with docker run

  1. No need to run as root because we don't run elastic endpoint security, we should recommend running as elastic-agent
  2. We will need to use setcap to add privileges to the elastic-agent binary
  3. Individual beats should downgrade privileges via setcap as needed
  4. If you want to run endpoint then you'll need to run a separate container with
docker run --network agent elastic-agent
docker run --network agent --privileged elastic-endpoint

Run in kubernetes

  1. Run a pod for agent that contains an unprivileged container for elastic-agent, and a privileged container for elastic-endpoint

Tasks:

  • Elastic-agent docs updated to recommend running as regular user
  • Use setcap in elastic-agent docker container to add all required capabilities as inheritable so subprocesses can use privs
  • Modify individual beats to setuid / setcap/ downgrade for the local machine use case
    • Use setcap in subprocesses in container to drop unneeded privileges
@ph ph closed this as completed Mar 9, 2022
This issue is being transferred. Timeline may not be complete until it finishes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants