Skip to content

Commit

Permalink
rule (EphemeralContainers Created): add new rule to detect ephemeral …
Browse files Browse the repository at this point in the history
…container created

Signed-off-by: kaizhe <derek0405@gmail.com>
  • Loading branch information
Kaizhe committed Jul 31, 2020
1 parent 64999c5 commit 39e36e3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions rules/k8s_audit_rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,19 @@
source: k8s_audit
tags: [k8s]

- macro: user_known_pod_debug_activities
condition: (k8s_audit_never_true)

# Only works when feature gate EphemeralContainers is enabled
- rule: EphemeralContainers Created
desc: >
Detect any ephemeral container created
condition: kevt and pod_subresource and kmodify and ka.target.subresource in (ephemeralcontainers) and not user_known_pod_debug_activities
output: Ephemeral container is created in pod (user=%ka.user.name pod=%ka.target.name ns=%ka.target.namespace ephemeral_container_name=%jevt.value[/requestObject/ephemeralContainers/0/name] ephemeral_container_image=%jevt.value[/requestObject/ephemeralContainers/0/image])
priority: NOTICE
source: k8s_audit
tags: [k8s]

# In a local/user rules fie, you can append to this list to add additional allowed namespaces
- list: allowed_namespaces
items: [kube-system, kube-public, default]
Expand Down

0 comments on commit 39e36e3

Please sign in to comment.