-
Notifications
You must be signed in to change notification settings - Fork 912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add secrets created deleted k8s audit rules #1151
Conversation
New rules K8s Secret Created/K8s Secret Deleted detect creating/deleting secrets, following the pattern of the other "K8s XXX Created/Deleted" rules. One minor difference is that service account token secrets are excluded, as those are created automatically as namespaces are created. Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
Add test to verify new rules for creating/deleting secrets. New trace files for creating a secret/deleting a secret, and test cases that verify that the rules trigger. Two additional test cases/traces file tracks creating a service account token secret/kube-system secret and ensures that the rules do *not* trigger. Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
Instead of using the request object to identify service account tokens, exclude any secrets activity by system users (e.g. users starting with "system:"). This allows the rules to work on k8s audit events at Metadata level instead of RequestResponse level. Also change the example objects for automated tests to ones collected at Metadata level. Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
LGTM label has been added. Git tree hash: 785483bd820c41d169b2b9fce65f13137c1c5728
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Mark! LGTM
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Kaizhe, leodido The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind rule-create
Any specific area of the project related to this PR?
/area rules
What this PR does / why we need it:
Add new rules to track creating/deleting K8s Secrets. kube-system and service account secrets are excluded.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: