kubearmor / KubeArmor

Runtime Security Enforcement System. Workload hardening/sandboxing and implementing least-permissive policies made easy leveraging LSMs (BPF-LSM, AppArmor).
https://kubearmor.io/
Apache License 2.0
1.51k stars 345 forks source link

Non K8s KubeArmor Enhancements #1815

Open daemon1024 opened 4 months ago

daemon1024 commented 4 months ago

Extending features to non-k8s

yp969803 commented 4 months ago

/assign

daemon1024 commented 4 months ago

This will be part of LFX Mentorship, We will assignees through LFX/CNCF Process.

yp969803 commented 4 months ago

@daemon1024 i am interested in the issue, can i start looking on it. Btw i am also applying for lfx term3

daemon1024 commented 4 months ago

@yp969803 thanks for your interest. We won't accept any PRs as of now. Happy to have a discussion, would love to have a proposal included in your cover letter.

daemon1024 commented 3 months ago

Hey Folks, Thanks for the interest in the mentorship. We have certain prerequisites which we expect to be included in your application. Please include details or reference to a document for the said prerequisite in your Cover Letter / Mail to the mentors / Submit it in the issue thread / DM Mentors in CNCF Slack by 20 August 11:59PM IST

Following are the details.

Non K8s KubeArmor Enhancements - https://mentorship.lfx.linuxfoundation.org/project/87d64083-e1fa-4aa4-a828-ca24e5ae96b3 Prerequisite:

  1. Setup KubeArmor in Unorchestrated mode on a BPF LSM node - https://docs.kubearmor.io/kubearmor/quick-links/kubearmor_vm
  2. Create a couple of containers using Docker on the same host
  3. Write a script (preferably in Go) to extract list of containers currently running Docker API and replace the container name in the following Policy - https://github.com/kubearmor/KubeArmor/blob/main/examples/kubearmor_containerpolicy.yaml Example
    • Docker container named test
    • Generated Policy will have
    • kubearmor.io/container.name: lb
    • kubearmor.io/container.name: test
  4. Apply these policies using karmor vm policy add and check violations
  5. Bonus: Automatically call the function in your script to add all of these policies

Unorchestrated Containers Guide - https://github.com/kubearmor/KubeArmor/wiki/Support-for-non-orchestrated-containers