Policy Examples for Containers
apiVersion: security.kubearmor.com/v1 kind: KubeArmorPolicy metadata: name: ksp-group-1-proc-path-block namespace: multiubuntu spec: selector: matchLabels: group: group-1 process: matchPaths: - path: /bin/sleep action: BlockapiVersion: security.kubearmor.com/v1 kind: KubeArmorPolicy metadata: name: ksp-match-expression-in-notin-block-process namespace: multiubuntu spec: severity: 5 message: "block execution of a matching binary name" selector: matchExpressions: - key: label operator: In values: - container=ubuntu-1 - key: label operator: NotIn values: - container=ubuntu-3 process: matchPaths: - execname: apt action: BlockapiVersion: security.kubearmor.com/v1 kind: KubeArmorPolicy metadata: name: ksp-match-expression-notin-block-process namespace: multiubuntu spec: severity: 5 message: "block execution of a matching binary name" selector: matchExpressions: - key: label operator: NotIn values: - container=ubuntu-1 process: matchPaths: - execname: apt action: BlockapiVersion: security.kubearmor.com/v1 kind: KubeArmorPolicy metadata: name: ksp-ubuntu-1-proc-dir-block namespace: multiubuntu spec: selector: matchLabels: container: ubuntu-1 process: matchDirectories: - dir: /sbin/ action: BlockapiVersion: security.kubearmor.com/v1 kind: KubeArmorPolicy metadata: name: ksp-ubuntu-2-proc-dir-recursive-block namespace: multiubuntu spec: selector: matchLabels: container: ubuntu-2 process: matchDirectories: - dir: /usr/ recursive: true action: BlockapiVersion: security.kubearmor.com/v1 kind: KubeArmorPolicy metadata: name: ksp-ubuntu-3-file-dir-allow-from-source-path namespace: multiubuntu spec: severity: 10 message: "a critical directory was accessed" tags: - WARNING selector: matchLabels: container: ubuntu-3 file: matchDirectories: - dir: /credentials/ fromSource: - path: /bin/cat action: AllowapiVersion: security.kubearmor.com/v1 kind: KubeArmorPolicy metadata: name: ksp-ubuntu-3-proc-path-owner-allow namespace: multiubuntu spec: severity: 7 selector: matchLabels: container: ubuntu-3 process: matchPaths: - path: /home/user1/hello ownerOnly: true matchDirectories: - dir: /bin/ # required to change root to user1 recursive: true - dir: /usr/bin/ # used in changing accounts recursive: true file: matchPaths: - path: /root/.bashrc # used by root - path: /root/.bash_history # used by root - path: /home/user1/.profile # used by user1 - path: /home/user1/.bashrc # used by user1 - path: /run/utmp # required to change root to user1 - path: /dev/tty matchDirectories: - dir: /etc/ # required to change root to user1 (coarse-grained way) recursive: true - dir: /proc/ # required to change root to user1 (coarse-grained way) recursive: true action: Allow
apiVersion: security.kubearmor.com/v1 kind: KubeArmorPolicy metadata: name: ksp-ubuntu-4-file-path-readonly-allow namespace: multiubuntu spec: severity: 10 message: "a critical file was accessed" tags: - WARNING selector: matchLabels: container: ubuntu-4 process: matchDirectories: - dir: /bin/ # used by root recursive: true - dir: /usr/bin/ # used by root recursive: true file: matchPaths: - path: /credentials/password readOnly: true - path: /root/.bashrc # used by root - path: /root/.bash_history # used by root - path: /dev/tty matchDirectories: - dir: /etc/ # used by root (coarse-grained way) recursive: true - dir: /proc/ # used by root (coarse-grained way) recursive: true action: AllowapiVersion: security.kubearmor.com/v1 kind: KubeArmorPolicy metadata: name: ksp-ubuntu-5-file-dir-recursive-block namespace: multiubuntu spec: selector: matchLabels: container: ubuntu-5 file: matchDirectories: - dir: /credentials/ recursive: true action: Block
apiVersion: security.kubearmor.com/v1 kind: KubeArmorPolicy metadata: name: ksp-ubuntu-5-net-icmp-audit namespace: multiubuntu spec: severity: 8 selector: matchLabels: container: ubuntu-5 network: matchProtocols: - protocol: icmp action: Audit
apiVersion: security.kubearmor.com/v1 kind: KubeArmorPolicy metadata: name: ksp-ubuntu-1-cap-net-raw-block namespace: multiubuntu spec: severity: 1 selector: matchLabels: container: ubuntu-1 capabilities: matchCapabilities: - capability: net_raw action: Block
apiVersion: security.kubearmor.com/v1 kind: KubeArmorPolicy metadata: name: audit-all-unlink namespace: default spec: severity: 3 selector: matchLabels: container: ubuntu-1 syscalls: matchSyscalls: - syscall: - unlink action: Audit
Last updated
Was this helpful?