Skip to content

Conversation

@justinsb
Copy link
Member

@justinsb justinsb commented Nov 14, 2016

This change is Reviewable

@justinsb justinsb changed the title First steps on authn WIP: First steps on authn Nov 14, 2016
@chrislovecnm
Copy link
Contributor

How is this related to #851?

cluster.KubeAPIServer.OIDCClientID = fi.String("841205377713-dlmq2pe0n1ftkevna3r18livjljm5uct.apps.googleusercontent.com")
cluster.KubeAPIServer.OIDCUsernameClaim = fi.String("email")

cluster.KubeAPIServer.AuthorizationRBACSuperUser = fi.String("admin")

Choose a reason for hiding this comment

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

Should the super user be admin or kubecfg, since the cert kops generates and puts in your ~/.kube/config has kubecfg as the common name?

Copy link
Member

Choose a reason for hiding this comment

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

rather than hardcoding a particular user name, if you include the system:masters group in the bootstrap superuser cert, it'll get superuser permission


cluster.KubeAPIServer.RuntimeConfig["rbac.authorization.k8s.io/v1alpha1"] = "true"

cluster.KubeAPIServer.AuthorizationMode = fi.String("RBAC")

Choose a reason for hiding this comment

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

Not sure exactly where this code is exercised in the flow of kops edit cluster, but if this purely sets auth mode to RBAC, aren't system components going to have a hard time working while their service account tokens are rejected? Won't there be a chicken-egg problem where the operator can't apply the RBAC roles in your examples above to enable system accounts, since the system isn't functioning, since the system accounts haven't been authorized for things yet?

Choose a reason for hiding this comment

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

I have the same question, since in my current setup I'm using both abac and rbac?

Copy link
Member

Choose a reason for hiding this comment

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

there are two ways to be authorized to load any role:

  1. run against the unsecured localhost API server port. this skips all authentication and authorization for all API calls, including loading/modifying RBAC policy
  2. be in the system:masters group, which inherently has full RBAC permissions. this is the group used by the components in the API server that talk back to the API, and is the easiest way for a bootstrap superuser to get full permissions.

with respect to system components, for 1.6, we're working on a set of default roles and rolebindings that get loaded for the in-tree components (kubelet, proxy, controller-manager and various controllers)

@justinsb justinsb modified the milestone: 1.5.1 Jan 4, 2017
@liggitt
Copy link
Member

liggitt commented Jan 15, 2017

there are default roles defined in-tree (and loaded at first start) for standard components and for scoped user permissions... I'd recommend using those as much as possible

see https://github.com/kubernetes/kubernetes/blob/master/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles.yaml

kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1alpha1
metadata:
name: kube-proxy
Copy link
Member

Choose a reason for hiding this comment

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

see the system:node-proxier role

kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1alpha1
metadata:
name: kubelet
Copy link
Member

Choose a reason for hiding this comment

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

see the system:node role

name: readonly
rules:
- apiGroups: ["*"]
resources: ["*"]
Copy link
Member

Choose a reason for hiding this comment

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

this gives read access to secrets, which makes the role escalating. I'd recommend the view role defined in-tree instead

kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1alpha1
metadata:
name: services
Copy link
Member

Choose a reason for hiding this comment

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

these are superuser permissions... I wouldn't use them as an example of the permissions to grant all service accounts. https://github.com/kubernetes/kubernetes/blob/master/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/controller-roles.yaml has roles defined for all the core controllers, and https://github.com/kubernetes/kubernetes/blob/master/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles.yaml has roles for superuser (cluster-admin) and namespace-scoped users (admin, edit, and view) which would be good starting points for something you might grant a service account.

kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1alpha1
metadata:
name: admin
Copy link
Member

Choose a reason for hiding this comment

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

the name admin is used upstream for a bootstrap role intended for namespace-scoped users. cluster-admin is the equivalent superuser role.

@justinsb justinsb modified the milestones: 1.5.2, backlog Feb 11, 2017
@krisnova
Copy link
Contributor

@justinsb can we get an update here? If not can we close this if it's out dated?

@chrislovecnm
Copy link
Contributor

Can we close?

@k8s-github-robot
Copy link

@justinsb PR needs rebase

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 20, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: justinsb

No associated issue. Update pull-request body to add a reference to an issue, or get approval with /approve no-issue

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 1, 2017
@k8s-github-robot k8s-github-robot removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 13, 2017
@justinsb justinsb closed this Oct 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. scheduled-to-close

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants