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

no telemetry for host mount FS events #1851

Open
rksharma95 opened this issue Aug 22, 2024 · 0 comments
Open

no telemetry for host mount FS events #1851

rksharma95 opened this issue Aug 22, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@rksharma95
Copy link
Collaborator

Bug Report

General Information

  • Environment description (GKE, VM-Kubeadm, vagrant-dev-env, minikube, microk8s, ...)
    digitalocean managed cluster (reproducible on k3s as well)
    
  • Kernel version (run uname -a)
    6.1.0-21-amd64, Debian GNU/Linux 12 (bookworm), linux
    
  • Orchestration system version in use (e.g. kubectl version, ...)
    Client Version: v1.29.1+k3s1
    Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
    Server Version: v1.30.1
    
  • Link to relevant artifacts (policies, deployments scripts, ...)
  • Target containers/pods

To Reproduce

make sure that file visibility is enabled for test namespace or global default

Ref: https://github.com/kubearmor/KubeArmor/blob/main/getting-started/kubearmor_visibility.md

  1. deploy nginx with host FS mount
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: nginx
  name: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - image: nginx
        imagePullPolicy: Always
        name: nginx
        volumeMounts:
        - mountPath: /sys/kernel/security
          name: sys-kernel-security-path
      volumes:
      - hostPath:
          path: /sys/kernel/security
          type: Directory
        name: sys-kernel-security-path
  1. create ksp
apiVersion: security.kubearmor.com/v1
kind: KubeArmorPolicy
metadata:
  name: ksp-block-host-mount
spec:
  action: Block
  file:
    matchDirectories:
    - dir: /tmp/
      recursive: true
    - dir: /sys/kernel/
      recursive: true
  selector:
    matchLabels:
      app: nginx
  1. watch for kubearmor alerts in a separate terminal
karmor logs
  1. simulate policy violation
POD=$(kubectl get pod -l app=nginx -o name ) \
kubectl exec -it $POD -- bash -c 'cat /sys/kernel/security/lsm'

Expected behavior

  1. an alert should be generated by the kubearmor with Operation: File and Resource: /sys/kernel/security/lsm
  2. with no policy enforced, system logs should be generated for FS access events to /sys/kernel/security/lsm file
@rksharma95 rksharma95 added the bug Something isn't working label Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant