Skip to content
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

Create restrict-binding-to-clusteradmin #162

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions rbac-best-practices/restrict-binding-to-clusteradmin
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: restrict-binding-clusteradmin
annotations:
policies.kyverno.io/title: Restrict Binding to Cluster-Admin
policies.kyverno.io/category: Security
policies.kyverno.io/severity: medium
policies.kyverno.io/subject: RoleBinding, ClusterRoleBinding, RBAC
kyverno.io/kyverno-version: 1.6.2
policies.kyverno.io/minversion: 1.6.0
kyverno.io/kubernetes-version: "1.23"
policies.kyverno.io/description: >-
The cluster-admin ClusterRole allows any action to be performed on any resource
in the cluster and its granting should be heavily restricted. This
policy prevents binding to the cluster-admin ClusterRole in
RoleBinding or ClusterRoleBinding resources.
spec:
validationFailureAction: audit
background: true
rules:
- name: clusteradmin-bindings
match:
any:
- resources:
kinds:
- RoleBinding
- ClusterRoleBinding
validate:
message: "Binding to cluster-admin is not allowed."
pattern:
roleRef:
name: "!cluster-admin"
Loading