-
Notifications
You must be signed in to change notification settings - Fork 208
/
audit-policies-cm-scenario-1.yaml
131 lines (129 loc) · 4.05 KB
/
audit-policies-cm-scenario-1.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
apiVersion: v1
kind: ConfigMap
metadata:
name: audit
namespace: ScenarioOne
data:
default.yaml: |
apiVersion: audit.k8s.io/v1
kind: Policy
metadata:
name: policy
# drop managed fields from audit, this is at global scope.
omitManagedFields: true
# Don't generate audit events for all requests in RequestReceived stage.
omitStages:
- "RequestReceived"
rules:
# Don't log requests for events
- level: None
resources:
- group: ""
resources: ["events"]
# Don't log authenticated requests to certain non-resource URL paths.
- level: None
userGroups: ["system:authenticated", "system:unauthenticated"]
nonResourceURLs:
- "/api*" # Wildcard matching.
- "/version"
- "/healthz"
- "/readyz"
# Log the full Identity API resource object so that the audit trail
# allows us to match the username with the IDP identity.
- level: RequestResponse
verbs: ["create", "update", "patch", "delete"]
resources:
- group: "user.openshift.io"
resources: ["identities"]
- group: "oauth.openshift.io"
resources: ["oauthaccesstokens", "oauthauthorizetokens"]
# A catch-all rule to log all other requests at the Metadata level.
- level: Metadata
# Long-running requests like watches that fall under this rule will not
# generate an audit event in RequestReceived.
omitStages:
- "RequestReceived"
writerequestbodies.yaml: |
apiVersion: audit.k8s.io/v1
kind: Policy
metadata:
name: policy
# drop managed fields from audit, this is at global scope.
omitManagedFields: true
# Don't generate audit events for all requests in RequestReceived stage.
omitStages:
- "RequestReceived"
rules:
# Don't log requests for events
- level: None
resources:
- group: ""
resources: ["events"]
# Don't log authenticated requests to certain non-resource URL paths.
- level: None
userGroups: ["system:authenticated", "system:unauthenticated"]
nonResourceURLs:
- "/api*" # Wildcard matching.
- "/version"
- "/healthz"
- "/readyz"
# exclude resources where the body is security-sensitive
- level: Metadata
resources:
- group: "route.openshift.io"
resources: ["routes", "routes/status"]
- resources: ["secrets"]
- level: Metadata
resources:
- group: "oauth.openshift.io"
resources: ["oauthclients"]
# log request and response payloads for all write requests
- level: RequestResponse
verbs:
- update
- patch
- create
- delete
- deletecollection
# catch-all rule to log all other requests at the Metadata level.
- level: Metadata
# Long-running requests like watches that fall under this rule will not
# generate an audit event in RequestReceived.
omitStages:
- RequestReceived
allrequestbodies.yaml: |
apiVersion: audit.k8s.io/v1
kind: Policy
metadata:
name: policy
# drop managed fields from audit, this is at global scope.
omitManagedFields: true
# Don't generate audit events for all requests in RequestReceived stage.
omitStages:
- "RequestReceived"
rules:
# Don't log requests for events
- level: None
resources:
- group: ""
resources: ["events"]
# Don't log authenticated requests to certain non-resource URL paths.
- level: None
userGroups: ["system:authenticated", "system:unauthenticated"]
nonResourceURLs:
- "/api*" # Wildcard matching.
- "/version"
- "/healthz"
- "/readyz"
# exclude resources where the body is security-sensitive
- level: Metadata
resources:
- group: "route.openshift.io"
resources: ["routes", "routes/status"]
- resources: ["secrets"]
- level: Metadata
resources:
- group: "oauth.openshift.io"
resources: ["oauthclients"]
# catch-all rule to log all other requests with request and response payloads
- level: RequestResponse