Skip to content

Commit

Permalink
rule(Anonymous Request Allowed): exclude {/livez, /readyz}
Browse files Browse the repository at this point in the history
Fixes #1794.

/livez and /readyz don't require authentication and can generate a lot
of noise if the cluster is checked by an anonymous external
system.

Some k8s systems have those endpoints required to be anonymous, as per this
[link to an OpenShift
setup](http://static.open-scap.org/ssg-guides/ssg-ocp4-guide-cis.html#xccdf_org.ssgproject.content_rule_api_server_anonymous_auth).

Signed-off-by: Sebastien Le Digabel <sledigabel@gmail.com>
  • Loading branch information
sledigabel authored and poiana committed May 4, 2022
1 parent dbbc93f commit 2bc4fec
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions rules/k8s_audit_rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@
- macro: health_endpoint
condition: ka.uri=/healthz

- macro: live_endpoint
condition: ka.uri=/livez

- macro: ready_endpoint
condition: ka.uri=/readyz

- rule: Create Disallowed Pod
desc: >
Detect an attempt to start a pod with a container image outside of a list of allowed images.
Expand Down Expand Up @@ -250,7 +256,7 @@
- rule: Anonymous Request Allowed
desc: >
Detect any request made by the anonymous user that was allowed
condition: kevt and ka.user.name=system:anonymous and ka.auth.decision="allow" and not health_endpoint
condition: kevt and ka.user.name=system:anonymous and ka.auth.decision="allow" and not health_endpoint and not live_endpoint and not ready_endpoint
output: Request by anonymous user allowed (user=%ka.user.name verb=%ka.verb uri=%ka.uri reason=%ka.auth.reason))
priority: WARNING
source: k8s_audit
Expand Down Expand Up @@ -734,4 +740,3 @@
priority: WARNING
source: k8s_audit
tags: [k8s]

0 comments on commit 2bc4fec

Please sign in to comment.