Files
opendesk/docs/security/rbac-mgt/rbac-mgt-002_binding-clusteradmin.yaml
Sebastian Kawelke ac712f4063 Adds further kyverno policies
Signed-off-by: Sebastian Kawelke <sebastian.kawelke@l3montree.com>
2025-12-03 11:48:43 +01:00

37 lines
1.3 KiB
YAML

# Source: https://github.com/kyverno/policies/tree/main/pod-security
# License: Apache-2.0
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: restrict-binding-clusteradmin
labels:
opendesk.eu/security-id: rbac-mgt-002
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"