From 973045ce8c6dd99a526a8631e6e25e3b0d6cbf93 Mon Sep 17 00:00:00 2001 From: Adnan Abdulhussein Date: Wed, 2 May 2018 08:37:15 +0100 Subject: [PATCH] add preset RBAC roles and authorization documentation (#293) * add preset RBAC roles and authorization documentation - Adds a set of ClusterRoles and Roles to make it easier to bind to user accounts - Adds a new docuemntation page for configuring Auth in Kubeapps * small fixes in dashboard * rename doc to access-control, link to doc from dashboard * link to access-control doc from README * updates the getting-started guide with auth setup * fix screenshot title --- README.md | 6 +- .../DeploymentForm/DeploymentForm.tsx | 6 + .../ErrorAlert/PermissionsErrorAlert.tsx | 10 +- .../src/components/LoginForm/LoginForm.tsx | 8 +- .../src/components/ProvisionButton/index.tsx | 6 +- docs/access-control.md | 177 +++++++++++++++ docs/getting-started.md | 20 +- manifests/kubeapps.jsonnet | 10 + manifests/user-roles.jsonnet | 202 ++++++++++++++++++ 9 files changed, 438 insertions(+), 7 deletions(-) create mode 100644 docs/access-control.md create mode 100644 manifests/user-roles.jsonnet diff --git a/README.md b/README.md index 900f2a4aa37..3e85a40d017 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,9 @@ kubeapps dashboard These commands will deploy Kubeapps in your cluster and launch a browser with the Kubeapps dashboard. -![Dashboard main page](img/dashboard-login.png) +![Dashboard login page](img/dashboard-login.png) -Access to the dashboard requires authorization which is handled by Kubernetes API server. The dashboard only acts as a proxy and passes all auth information to it. In case of forbidden access corresponding warnings will be displayed in Dashboard. +Access to the dashboard requires a Kubernetes API token to authenticate with the Kubernetes API server. Read the [Access Control](docs/access-control.md) documentation for more information on configuring users for Kubeapps. The following commands create a ServiceAccount and ClusterRoleBinding named `kubeapps-operator` which will enable the dashboard to authenticate and manage resources on the Kubernetes cluster: @@ -43,6 +43,8 @@ Use the following command to reveal the authorization token that should be used kubectl get secret $(kubectl get serviceaccount kubeapps-operator -o jsonpath='{.secrets[].name}') -o jsonpath='{.data.token}' | base64 --decode ``` +**NOTE**: It's not recommended to create cluster-admin users for Kubeapps. Please refer to the [Access Control](docs/access-control.md) documentation to configure more fine-grained access. + ![Dashboard main page](img/dashboard-home.png) To remove Kubeapps from your cluster, simply run: diff --git a/dashboard/src/components/DeploymentForm/DeploymentForm.tsx b/dashboard/src/components/DeploymentForm/DeploymentForm.tsx index 7778785cec9..9b790c02a79 100644 --- a/dashboard/src/components/DeploymentForm/DeploymentForm.tsx +++ b/dashboard/src/components/DeploymentForm/DeploymentForm.tsx @@ -22,6 +22,12 @@ const RequiredRBACRoles: IRBACRole[] = [ resource: "helmreleases", verbs: ["create", "patch"], }, + { + apiGroup: "kubeapps.com", + namespace: "kubeapps", + resource: "apprepositories", + verbs: ["get"], + }, ]; interface IDeploymentFormProps { diff --git a/dashboard/src/components/ErrorAlert/PermissionsErrorAlert.tsx b/dashboard/src/components/ErrorAlert/PermissionsErrorAlert.tsx index e8002848aea..0cdf4bb4621 100644 --- a/dashboard/src/components/ErrorAlert/PermissionsErrorAlert.tsx +++ b/dashboard/src/components/ErrorAlert/PermissionsErrorAlert.tsx @@ -25,7 +25,15 @@ class PermissionsErrorPage extends React.Component { -

See the documentation for more info on access control in Kubeapps.

+

+ See the documentation for more info on{" "} + + access control in Kubeapps + . +

); diff --git a/dashboard/src/components/LoginForm/LoginForm.tsx b/dashboard/src/components/LoginForm/LoginForm.tsx index 6bc9935e52f..0360052e109 100644 --- a/dashboard/src/components/LoginForm/LoginForm.tsx +++ b/dashboard/src/components/LoginForm/LoginForm.tsx @@ -45,7 +45,13 @@ class LoginForm extends React.Component {

Your cluster operator should provide you with a Kubernetes API token.{" "} - Click here for more info on how to create and use Bearer Tokens. + + Click here + {" "} + for more info on how to create and use Bearer Tokens.

diff --git a/dashboard/src/components/ProvisionButton/index.tsx b/dashboard/src/components/ProvisionButton/index.tsx index 8839d2f968d..bb63a0617b4 100644 --- a/dashboard/src/components/ProvisionButton/index.tsx +++ b/dashboard/src/components/ProvisionButton/index.tsx @@ -189,7 +189,11 @@ class ProvisionButton extends React.Component