Hi Wzuh team,
We plan to audit Kubernetes events with Wazuh following the instruction here
https://wazuh.com/blog/auditing-kubernetes-with-wazuh/ but we're stuck at some points. We would appreciate your help on it.
There are 3 steps to implement it in your blog:
1. Create a webhook listener on the Wazuh server to receive logs from the Kubernetes cluster.
2. Enable auditing on the Kubernetes cluster and configure it to forward audit logs to the Wazuh webhook listener.
3. Create rules on the Wazuh server to alert about audit events received from Kubernetes.
We did the same steps as the instructions but we can't see any alerts for creating and deleting a deployment.
For debugging, we run the custom-webhook script directly and it shows me that requests sent to our Wazuh are timeout.
To understand more about how it works, we print out the content of the request by adding this line to the custom-webhook.py:
Now we run the test command to create and delete a deployment but we can't find anything on our Wazuh side. It means that Wazuh doesn't receive the logs well.
------------------------------------
The second question is that we got another issue when creating the detection rules. We followed the instruction but when testing the rules with the log which is your sample creation log, it showed that there is no alert for it.
{ "kind": "EventList", "apiVersion": "
audit.k8s.io/v1", "metadata": {}, "items": [ { "level": "Metadata", "auditID": "6ae321a6-0735-41a6-a9d9-050f9a75644c", "stage": "ResponseComplete", "requestURI": "/apis/apps/v1/namespaces/default/deployments?fieldManager=kubectl-create&fieldValidation=Strict", "verb": "create", "user": { "username": "minikube-user", "groups": [ "system:masters", "system:authenticated" ] }, "sourceIPs": [ "192.168.132.137" ], "userAgent": "kubectl/v1.25.3 (linux/amd64) kubernetes/434bfd8", "objectRef": { "resource": "deployments", "namespace": "default", "name": "hello-minikube", "apiGroup": "apps", "apiVersion": "v1" }, "responseStatus": { "metadata": {}, "code": 201 }, "requestReceivedTimestamp": "2022-11-08T15:45:13.929428Z", "stageTimestamp": "2022-11-08T15:45:13.946284Z", "annotations": { "
authorization.k8s.io/decision": "allow", "
authorization.k8s.io/reason": "" } } ] }
We hope to see your advice.
Regards.