Open myugan opened 2 months ago
Hey @myugan, Can you share how are trying to violate it and what's the output you see? The configuration looks good to me.
Additionally can you run which sleep
in the ubuntu pod and check what's the binary name?
Hello @daemon1024, I have verified that the binary of sleep appears to be correct, and I even attempted to replace it with another binary file, but it did not block either. Is there a method to display the complete debug message in order to understand why it is not blocking the action according to the policy? Additionally, the output is not appearing in the karmor logs
Can we check if the Pod has apparmor annotation? Can you share the Pod/Deployment spec?
There is no annotation in the pod. Here is the manifest file.
apiVersion: v1
kind: Pod
metadata:
name: ubuntu
labels:
os: ubuntu
spec:
containers:
- image: ubuntu
command:
- "sleep"
- "604800"
imagePullPolicy: IfNotPresent
name: ubuntu
restartPolicy: Always
I have checked the Pod annotation, and it says the policy is enabled as well.
...[SNIP]...
cni.projectcalico.org/containerID: 08d1ca3a983909decb7b3a73c041105a48b6fbc70fdc69311acca739be8033ba
cni.projectcalico.org/podIP: 192.168.94.9/32
cni.projectcalico.org/podIPs: 192.168.94.9/32
kubearmor-policy: enabled
kubearmor-visibility: process,file,network,capabilities
Got the same issue, any idea @daemon1024 ?
apiVersion: security.kubearmor.com/v1
kind: KubeArmorPolicy
metadata:
name: ksp-ubuntu-net-icmp-block
namespace: default
spec:
selector:
matchLabels:
os: ubuntu-util
network:
matchProtocols:
- protocol: icmp
action:
Block
It seems like you have kubearmor in audit mode, not block. I'm my case I'm having the same issue, but I configured the policy in block mode using annotations:
Policy definiton:
apiVersion: security.kubearmor.com/v1
kind: KubeArmorPolicy
metadata:
name: ksp-mysql-block
namespace: default
spec:
message: "Block /var/lib/mysql/"
severity: 5
selector:
matchLabels:
name: mysql-pod
file:
matchDirectories:
- dir: /var/lib/mysql/
recursive: true
action:
Block
Karmor probe output:
But I'm able to create files under /var/lib/mysql/ without being blocked.
Bug Report
General Information
kubeadm
uname -a
):6.5.0-1020-aws
kubectl version
, ...): v1.29.5To Reproduce
sleep
command. Verify that the policy is successfully applied to the respective pod usingkarmor probe
.Expected behavior
KubeArmor must block any activities according to the created policy.
Screenshots