Commit Graph

26 Commits

Author SHA1 Message Date
Monis Khan 1873d19869 Allow handlers early in the request chain to set audit annotations
This change adds the generic ability for request handlers that run
before WithAudit to set annotations in the audit.Event.Annotations
map.

Note that this change does not use this capability yet. Determining
which handlers should set audit annotations and what keys and values
should be used requires further discussion (this data will become
part of our public API).

Signed-off-by: Monis Khan <mok@vmware.com>

Kubernetes-commit: 0bc62112adf270ef4efada37286319c229324c7b
2020-03-19 20:02:37 -04:00
Mike Danese 44b9fc84ab migrate callers to g/g/uuid
Kubernetes-commit: a4ca9e6c93e45b4a97e7d04df37362299088f64a
2019-11-04 23:15:20 -08:00
Jordan Liggitt a653e5ab1a Export UserInfo conversion, use authnv1.UserInfo in audit
Kubernetes-commit: 0e787a4b78a849fa66a02126721dd185e7c00955
2019-09-09 08:54:54 -04:00
Haowei Cai 70c200c6a0 audit & admission: associate annotation with audit level
Kubernetes-commit: 318226f3403f56aaf796af3f439c13674aa2b7ab
2019-05-31 15:36:29 -07:00
leigh capili 7762f62741 Refactor loops over SupportedMediaTypes() where mediaType is used to match a single SerializerInfo{}
We have an existing helper function for this:  runtime.SerializerInfoForMediaType()

This is common prep-work for encoding runtime.Objects into JSON/YAML for transmission over the wire or writing to ComponentConfigs.

Kubernetes-commit: 47e52d2981dc2a5c5950042f50688cf24dd92eda
2019-04-04 19:01:01 -06:00
David Eads 22712db708 make audit metadata work for custom resources
Kubernetes-commit: 9d41c0099adc9a9328209075421eb42681bd4b09
2019-02-26 14:37:58 -05:00
Davanum Srinivas 2710b17b80 Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
  * github.com/kubernetes/repo-infra
  * k8s.io/gengo/
  * k8s.io/kube-openapi/
  * github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods

Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135

Kubernetes-commit: 954996e231074dc7429f7be1256a579bedd8344c
2018-11-09 13:49:10 -05:00
Christoph Blecker 92e87e143a Update gofmt for go1.11
Kubernetes-commit: 97b2992dc191a357e2167eff5035ce26237a4799
2018-10-05 12:59:38 -07:00
xuzhonghu 895382e183 limit User-Agent max length 1024 and add ...TRUNCATED suffix
Kubernetes-commit: f0b1f1c2f67877ddb2eceac5eb7c9c4ea22b4b6b
2018-06-20 11:15:09 +08:00
xuzhonghu c739da1f02 logging user-agent in audit
Kubernetes-commit: d066d547cce64a4f02bb05d718bc53fe71d06ad3
2018-06-06 10:53:03 +08:00
Cao Shufeng 69b26e07a7 avoid duplicate status in audit events
Fixes: https://github.com/kubernetes/kubernetes/issues/60108

Kubernetes-commit: 4d20c38c337525f8105969a582ce421f52d09c8e
2018-04-25 10:13:51 +08:00
hzxuzhonghu 7fb69020af fix typo and remove inaccurate TODO
Kubernetes-commit: d94925af8854031f1548466c655afd3119613785
2018-02-23 09:27:37 +08:00
Cao Shufeng 8af8554968 add Annotations to audit event
Kubernetes-commit: 97b0d99a33d71250bc7f967135c435e62343d9b8
2018-01-08 12:00:33 +08:00
Cao Shufeng 2a2505e824 remove duplicated import
Kubernetes-commit: 4e7398b67b12390486012dd6f9d708dd64f961f3
2018-01-11 19:15:11 +08:00
Cao Shufeng f7e881914a support micro time for advanced audit
Kubernetes-commit: 817bc6954ca9af02013fd8f492f8ef865c217b0d
2017-09-25 11:56:30 +08:00
Cao Shufeng d781318aca audit real impersonated user info
Log the newest impersonated user info in the second audit event. This
will help users to debug rbac problems.

Kubernetes-commit: 1c3dc52531b7761921c8855cafc58b669da111f1
2017-09-03 14:04:13 +00:00
Cao Shufeng 9ab155429e Split APIVersion into APIGroup and APIVersion in audit events
audit.Event.ObjectRef.APIVersion currently holds both the the API group and
version, separated by a /. This change break these out into separate fields.

This is part of:
https://github.com/kubernetes/kubernetes/issues/48561

Kubernetes-commit: c57eebfe2f8d36361d510f0afd926777a44cccd2
2017-09-01 16:38:54 +00:00
Cao Shufeng d248b52a81 Fix Audit-ID header key
Now http header key "Audit-ID" doesn't have effect, because golang
automaticly transforms "Audit-ID" into "Audit-Id". This change use
http.Header.Get() function to canonicalize "Audit-ID" to "Audit-Id".

Kubernetes-commit: f21bc7bb9a82378e8b24f72c66dfd23bc8113f20
2017-07-06 23:56:07 +00:00
Cao Shufeng af4570c690 update events' ResponseStatus at Metadata level
ResponseStatus is populated in MetadataLevel, so we also update it in
MetadataLevel.

Kubernetes-commit: b6abcacb38d5da7c70ea9f3e6f673c8beeb90092
2017-07-04 08:39:44 +00:00
Chao Xu 8be42ee0d0 run hack/update-all
Kubernetes-commit: 60604f8818aecbc9c3736fbc32747cc0a535bc80
2017-06-28 00:14:31 +00:00
Chao Xu 81b7aaaa7d run root-rewrite-import-client-go-api-types
Kubernetes-commit: f2d3220a11111f86b2f481e70e3c1ca4f5896f44
2017-06-28 00:14:31 +00:00
Tim St. Clair 64014c6e25 audit: Fill in full ObjectRef, include in LevelMetadata
Kubernetes-commit: 28beb4572e676b9073f400fb6ccf2720381a41d0
2017-06-14 20:44:08 +00:00
Dr. Stefan Schimanski 8b776edc46 audit: fill in sub-resource
Kubernetes-commit: 019003b9266872f912b188708583141a34561007
2017-06-13 20:47:29 +00:00
Tim St. Clair 8ff532a4cb Implement audit policy logic
Kubernetes-commit: a5de309ee261aea15bb1cc12647b32640c2ac196
2017-06-13 20:47:28 +00:00
Tim St. Clair dac438aa53 Update existing code for audit API changes
Kubernetes-commit: 4c54970d31f0e35f21247514fb946081e6ee0be5
2017-06-13 20:47:28 +00:00
Dr. Stefan Schimanski f7d766d92d audit: add audit event to the context and fill in handlers
Kubernetes-commit: 0b5bcb021932355b3ff7c2b45fb579f4adad84bf
2017-06-13 20:47:28 +00:00