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

Handle passing Kubeconfig to plugins (Executor and Sources) #934

Closed
Tracked by #712
pkosiec opened this issue Jan 11, 2023 · 1 comment
Closed
Tracked by #712

Handle passing Kubeconfig to plugins (Executor and Sources) #934

pkosiec opened this issue Jan 11, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@pkosiec
Copy link
Collaborator

pkosiec commented Jan 11, 2023

Acceptance Criteria

Handle Kubeconfig passing for executors:

  • Generate and pass Kubeconfig as a part of Context for each execution of a Kubernetes-related executor.
  • Modify plugin manager to run plugins in a restricted environment.
    • It doesn't influence the way how we run source and executor plugins. Each plugin will be ran in a single subprocess, in a single restricted subdirectory.
  • Ensure already existing plugins support it.
  • Add necessary tests
  • Make sure that plugins works by default in the backward compatible way.
  • Take into account the default k8s Namespace when creating a dedicated kubeconfig
  • Make sure that rbac property is optional
    • If the rbac context is not provided (as a result, rbac.user|group.type is empty), Botkube won't create a temporary Kubeconfig for a given plugin.

Relates to #841 and #840. Depending which tasks will be done earlier, ensure a proper Kubeconfig is passed.

Resources:

Related issues & reason

Notes

Strategy for RBAC isolation:

  1. Dynamically create subdirectories for a given execution
    • Plugins MUST respect a given kubeconfig path
  2. Just start multiple process for all unique RBAC binding:
    • if kubectl is bind to 2 different channels and group strategy is used, we simply start 2 kubectl processes.
    • please check the cost of starting those processes (CPU/Memory)
@pkosiec pkosiec mentioned this issue Jan 11, 2023
5 tasks
@pkosiec pkosiec added enhancement New feature or request needs-triage Relates to issues that should be refined labels Jan 11, 2023
@pkosiec pkosiec added this to Botkube Jan 11, 2023
@mszostok mszostok removed the needs-triage Relates to issues that should be refined label Jan 18, 2023
@mszostok mszostok added this to the v0.19.0 milestone Jan 18, 2023
@pkosiec pkosiec moved this to Todo in Botkube Jan 18, 2023
@josefkarasek josefkarasek moved this from Todo to In Progress in Botkube Mar 17, 2023
@huseyinbabal
Copy link
Contributor

huseyinbabal commented Mar 20, 2023

Modify plugin manager to run plugins in a restricted environment.

So I tried to use chroot for command execution, but it is not doable since,

  • This needs root permissions that means we need to remove less privileged user in Docker file and use root user
  • Once we do that, helm or other vuln tools will probably start to complain about that.
    I proposed to ignore this feature for now since we have only official plugins and do not accept custom ones, wdyt? @mszostok @pkosiec @josefkarasek ?

Kubect Krew Plugin manager has same situation, and whenever I install kubectl plugin, it warns me like "the tool I download that they haven't assessed it, and the risk is your own". Maybe we should use same strategy, instead of escalating Docker's privilege.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

4 participants