From 8b155e82d876c8130962e61b2235f2bd066abde1 Mon Sep 17 00:00:00 2001 From: Jordan Liggitt Date: Thu, 8 Aug 2019 17:59:12 -0400 Subject: [PATCH] Use the escalate verb for clusterroleaggregator rather than cluster-admin permissions --- .../rbac/bootstrappolicy/controller_policy.go | 5 ++--- .../testdata/controller-roles.yaml | 15 ++++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/controller_policy.go b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/controller_policy.go index 297cc8e9185..fef50d68b6d 100644 --- a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/controller_policy.go +++ b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/controller_policy.go @@ -85,9 +85,8 @@ func buildControllerRoles() ([]rbacv1.ClusterRole, []rbacv1.ClusterRoleBinding) addControllerRole(&controllerRoles, &controllerRoleBindings, rbacv1.ClusterRole{ ObjectMeta: metav1.ObjectMeta{Name: saRolePrefix + "clusterrole-aggregation-controller"}, Rules: []rbacv1.PolicyRule{ - // this controller must have full permissions to allow it to mutate any role in any way - rbacv1helpers.NewRule("*").Groups("*").Resources("*").RuleOrDie(), - rbacv1helpers.NewRule("*").URLs("*").RuleOrDie(), + // this controller must have full permissions on clusterroles to allow it to mutate them in any way + rbacv1helpers.NewRule("escalate", "get", "list", "watch", "update", "patch").Groups(rbacGroup).Resources("clusterroles").RuleOrDie(), }, }) addControllerRole(&controllerRoles, &controllerRoleBindings, rbacv1.ClusterRole{ diff --git a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/controller-roles.yaml b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/controller-roles.yaml index 31052cb695a..7a76381fc61 100644 --- a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/controller-roles.yaml +++ b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/controller-roles.yaml @@ -119,15 +119,16 @@ items: name: system:controller:clusterrole-aggregation-controller rules: - apiGroups: - - '*' + - rbac.authorization.k8s.io resources: - - '*' + - clusterroles verbs: - - '*' - - nonResourceURLs: - - '*' - verbs: - - '*' + - escalate + - get + - list + - patch + - update + - watch - apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: