Skip to content

Commit

Permalink
SYS-632 add audit-policies.yaml.j2
Browse files Browse the repository at this point in the history
  • Loading branch information
instantlinux committed Jan 1, 2025
1 parent 1a5fdec commit 61d8c0a
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions ansible/roles/kubernetes/templates/audit-policies.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{{ ansible_managed | comment }}

apiVersion: audit.k8s.io/v1
kind: Policy
rules:
# inhibit these
- level: None
nonResourceURLs: ['/healthz*', '/logs', '/metrics', '/swagger*', '/version']

# exclude auth token material
- level: Metadata
omitStages: [RequestReceived]
resources:
- group: authentication.k8s.io
resources: [tokenreviews]

# extended audit of auth delegation
- level: RequestResponse
omitStages: [RequestReceived]
resources:
- group: authorization.k8s.io
resources: [subjectaccessreviews]

# log changes to pods at RequestResponse level
- level: RequestResponse
omitStages: [RequestReceived]
resources:
# core API group; add API services as desired
- group: ''
resources: [pods]
verbs: [create, patch, update, delete]

# log everything else at Metadata level
- level: Metadata
omitStages: [RequestReceived]

0 comments on commit 61d8c0a

Please sign in to comment.