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

fine tune rbac #1109

Merged
merged 2 commits into from
Jun 16, 2018
Merged
Show file tree
Hide file tree
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
59 changes: 59 additions & 0 deletions config/200-clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: knative-serving-admin
rules:
- apiGroups: [""]
resources: ["pods", "namespaces", "secrets", "configmaps", "endpoints", "services", "events", "serviceaccounts"]
verbs: ["get", "list", "create", "update", "delete", "patch", "watch"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to create service accounts?

This seems fine for a first pass, but it definitely shows how little we've been thinking about least privilege.

- apiGroups: ["extensions"]
resources: ["ingresses","deployments"]
verbs: ["get", "list", "create", "update", "delete", "patch", "watch"]
- apiGroups: ["apps"]
resources: ["deployments", "statefulsets"]
verbs: ["get", "list", "create", "update", "delete", "patch", "watch"]
- apiGroups: ["admissionregistration.k8s.io"]
resources: ["mutatingwebhookconfigurations"]
verbs: ["get", "list", "create", "update", "delete", "patch", "watch"]
- apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does the controller need create/update on custom resource definitions?

verbs: ["get", "list", "create", "update", "delete", "patch", "watch"]
- apiGroups: ["serving.knative.dev"]
resources: ["configurations", "configurationgenerations", "routes", "revisions", "revisionuids", "autoscalers", "services"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be "*"?

verbs: ["get", "list", "create", "update", "delete", "patch", "watch"]
- apiGroups: ["build.dev"]
resources: ["builds"]
verbs: ["get", "list", "create", "update", "delete", "patch", "watch"]
- apiGroups: ["config.istio.io"]
resources: ["routerules"]
verbs: ["get", "list", "create", "update", "delete", "patch", "watch"]
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: knative-serving-write
rules:
- apiGroups: [""]
resources: ["pods", "namespaces", "secrets", "configmaps", "endpoints", "services", "events", "serviceaccounts"]
verbs: ["get", "list", "update", "patch", "watch"]
- apiGroups: ["extensions"]
resources: ["ingresses","deployments"]
verbs: ["get", "list", "update", "patch", "watch"]
- apiGroups: ["apps"]
resources: ["deployments", "statefulsets"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why statefulsets?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(and above)

verbs: ["get", "list", "update", "patch", "watch"]
- apiGroups: ["admissionregistration.k8s.io"]
resources: ["mutatingwebhookconfigurations"]
verbs: ["get", "list", "update", "patch", "watch"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why update and patch for the autoscaler?

- apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
verbs: ["get", "list", "update", "patch", "watch"]
- apiGroups: ["serving.knative.dev"]
resources: ["configurations", "configurationgenerations", "routes", "revisions", "revisionuids", "autoscalers", "services"]
verbs: ["get", "list", "update", "patch", "watch"]
- apiGroups: ["build.dev"]
resources: ["builds"]
verbs: ["get", "list", "update", "patch", "watch"]
- apiGroups: ["config.istio.io"]
resources: ["routerules"]
verbs: ["get", "list", "update", "patch", "watch"]
4 changes: 2 additions & 2 deletions config/201-clusterrolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ subjects:
namespace: knative-serving-system
roleRef:
kind: ClusterRole
name: cluster-admin
name: knative-serving-admin
apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1beta1
Expand All @@ -35,5 +35,5 @@ subjects:
namespace: knative-serving-system
roleRef:
kind: ClusterRole
name: cluster-admin
name: knative-serving-write
apiGroup: rbac.authorization.k8s.io