Skip to content

Commit 439ec41

Browse files
stttssoltysh
authored andcommitted
UPSTREAM: <carry>: bootstrap-rbac-policy: move over .well-known rules
Origin-commit: 45f159f05b92c893c175ffe968f89a34f5581f5b openshift-rebase(v1.24):source=538170825bb
1 parent 15b2d2e commit 439ec41

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

plugin/pkg/auth/authorizer/rbac/bootstrappolicy/policy.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,15 @@ func clusterRoles() []rbacv1.ClusterRole {
214214
).RuleOrDie(),
215215
},
216216
},
217+
{
218+
// a role which provides unauthenticated access.
219+
ObjectMeta: metav1.ObjectMeta{Name: "system:openshift:public-info-viewer"},
220+
Rules: []rbacv1.PolicyRule{
221+
rbacv1helpers.NewRule("get").URLs(
222+
"/.well-known", "/.well-known/*",
223+
).RuleOrDie(),
224+
},
225+
},
217226
{
218227
// a role which provides minimal resource access to allow a "normal" user to learn information about themselves
219228
ObjectMeta: metav1.ObjectMeta{Name: "system:basic-user"},
@@ -573,6 +582,7 @@ func clusterRoleBindings() []rbacv1.ClusterRoleBinding {
573582
rbacv1helpers.NewClusterBinding("system:discovery").Groups(user.AllAuthenticated).BindingOrDie(),
574583
rbacv1helpers.NewClusterBinding("system:basic-user").Groups(user.AllAuthenticated).BindingOrDie(),
575584
rbacv1helpers.NewClusterBinding("system:public-info-viewer").Groups(user.AllAuthenticated, user.AllUnauthenticated).BindingOrDie(),
585+
rbacv1helpers.NewClusterBinding("system:openshift:public-info-viewer").Groups(user.AllAuthenticated, user.AllUnauthenticated).BindingOrDie(),
576586
rbacv1helpers.NewClusterBinding("system:node-proxier").Users(user.KubeProxy).BindingOrDie(),
577587
rbacv1helpers.NewClusterBinding("system:kube-controller-manager").Users(user.KubeControllerManager).BindingOrDie(),
578588
rbacv1helpers.NewClusterBinding("system:kube-dns").SAs("kube-system", "kube-dns").BindingOrDie(),

plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-role-bindings.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,26 @@ items:
149149
- apiGroup: rbac.authorization.k8s.io
150150
kind: User
151151
name: system:kube-proxy
152+
- apiVersion: rbac.authorization.k8s.io/v1
153+
kind: ClusterRoleBinding
154+
metadata:
155+
annotations:
156+
rbac.authorization.kubernetes.io/autoupdate: "true"
157+
creationTimestamp: null
158+
labels:
159+
kubernetes.io/bootstrapping: rbac-defaults
160+
name: system:openshift:public-info-viewer
161+
roleRef:
162+
apiGroup: rbac.authorization.k8s.io
163+
kind: ClusterRole
164+
name: system:openshift:public-info-viewer
165+
subjects:
166+
- apiGroup: rbac.authorization.k8s.io
167+
kind: Group
168+
name: system:authenticated
169+
- apiGroup: rbac.authorization.k8s.io
170+
kind: Group
171+
name: system:unauthenticated
152172
- apiVersion: rbac.authorization.k8s.io/v1
153173
kind: ClusterRoleBinding
154174
metadata:

plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,6 +1207,21 @@ items:
12071207
verbs:
12081208
- list
12091209
- watch
1210+
- apiVersion: rbac.authorization.k8s.io/v1
1211+
kind: ClusterRole
1212+
metadata:
1213+
annotations:
1214+
rbac.authorization.kubernetes.io/autoupdate: "true"
1215+
creationTimestamp: null
1216+
labels:
1217+
kubernetes.io/bootstrapping: rbac-defaults
1218+
name: system:openshift:public-info-viewer
1219+
rules:
1220+
- nonResourceURLs:
1221+
- /.well-known
1222+
- /.well-known/*
1223+
verbs:
1224+
- get
12101225
- apiVersion: rbac.authorization.k8s.io/v1
12111226
kind: ClusterRole
12121227
metadata:

0 commit comments

Comments
 (0)