Repository navigation
Description
Goal
For Tiller to execute all of its API operations "as" the user. So that (a) Tiller is not a "superuser" and (b) users' own ids, etc. are attached to operations.
Architecture
The general idea is Helm cli will forward user’s auth info from kubeconfig to Tiller gRPC server via HTTP Header. Tiller gRPC server will call various Kubernetes authN/Z apis to perform authentication and authorization in an intercepter before applying mutation. The following diagram shows the flow:
Kube Client Authentication
The TokenReview api call will be made using default service account. This is required, since if RBAC authorization is enabled in the cluster, user may not have permission to perform TokenRview api.
All other kube api calls (including SubjectReview api) will be made using user’s auth info.
User info
- Client Certs: If a client certificate is presented and verified, the common name of the subject is used as the user name for the request.
- Basic Auth: Username found in the Authorization header.
- Bearer Token: Tiller calls TokenReview api with the bearer token found in the authorization header. In response, Kube api server returns username and list of groups for the user associated with the token.
Anonymous requests
From Kubernetes docs, "When enabled, requests that are not rejected by other configured authentication methods are treated as anonymous requests, and given a username of system:anonymous and a group of system:unauthenticated." I propose that Tiller does not support anonymous requests.
Choice of Header Keys
The following keys (case-sensitive) will be used in golang context to forward auth info from kubeconfig to gRPC server:
- authorization: This will be available as This is the standard authorization header to pass username:password or bearer token.
- k8s-server: This is the server field in kubeconfig.
- k8s-certificate-authority: This is the CA certificate used by kubernetes api server.
- k8s-client-certificate: This is the user’s client certificate.
- k8s-client-key: This is the user’s client key.
HTTP protocol itself has no limit on header length. So, forwarding the above fields should be ok.
Discovering Tiller Server
We would like to support running Tiller in Standalone mode or Hosted mode. In Standalone mode, Tiller manages the cluster it is running on. This is the current setup. In Hosted mode, Tiller will be run outside the cluster that it manages. To support auto discovery of Tiller server address, we propose the following change:
If tillerHost is empty, first search for a service named “{"app": "helm", "name": "tiller"}” in default tiller namespace (kube-system). If found, use the externalName in the service to connect to an externally Hosted Tiller server. If not found, then use the existing port forwarding mechanism to connect to cluster.
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "my-service",
"namespace": "prod"
},
"spec": {
"type": "ExternalName",
"externalName": "my.tiller.example.com"
}
}Misc Considerations
JSON API
If users are interested in accessing the Tiller api from a web page, they have to run gRPC Gateway to provide a JSON api.
Release Authorization
An additional layer of authorization may be added to Tiller gRPC server using a Third Party Resource called Release. Cluster admins can configure RBAC authorization for the Release resource. Tiller api server will perform an extra SubjectReview call to check if the user has permission to release a chart:
{
"apiVersion": "authorization.k8s.io/v1beta1",
"kind": "SubjectAccessReview",
"spec": {
"resourceAttributes": {
"namespace": "kittensandponies",
"verb": "POST",
"group": "helm.sh",
"resource": "release"
},
"user": "jane",
"group": [
"group1",
"group2"
]
}
}This can be added later, once the initial above proposal is implemented.
Storing Release Data
-
Standalone mode: Currently Tiller stores data in configmaps. I think we should store release data in a TPR to avoid confusion. The
Releaseobject used for authorization can also be used for storing release data. This is also inline with discussions on api extension. -
Hosted mode: A Storage Driver can be implemented to store data in conventional databases like Postgres, etc. It should be very easy for implement this using existing Driver interface.
Both of these options can be implemented after the initial auth flow is implemented.
Third Party Controller
A TillerC TPR controller was designed, prototyped and ultimately abandoned because Kubernetes authZ process can’t extended to fit Tiller’s authorization requirements.

Activity
[-]Proposal: Authenticator and Authorization support for Tiller[/-][+]Proposal: Authentication and Authorization support for Tiller[/+]technosophos commentedon Feb 8, 2017
I very much like this proposal.
I would imagine doing this as four separate PRs:
Okay, a few other comments:
ReleaseTPR until TPR comes out of Beta (or at least until TPRs can actually be updated). The system keeps changing, and that would add a big backwards compatibility burden.tamalsaha commentedon Feb 9, 2017
I think supporting it via a service in Kube will be better because, users don't need to worry about one more extra config.
I think there is a "security" benefit of using TPR. As things work today, it is possible for someone to overwrite coinfigmaps and then rollback to deploy a bad version. With TPR, cluster admins can restrict regular users from writing Tiller TPR but allow them to edit configmaps. But these can be done as step 2.
One thing, that is not discussed so far is how to store the user info. I was thinking about storing that as a Label in the configmap and them display it. This will also require adding username field to proto.
technosophos commentedon Feb 10, 2017
Just want to record that I have been getting a lot of supportive feedback in Slack and in other places about this particular feature as defined here. This is something a wide variety of users are asking for in the 2.3.0 release.
technosophos commentedon Feb 14, 2017
I've added this to the 2.3 milestone. @tamalsaha I am assuming this is a feature you are planning on leading.
smarterclayton commentedon Feb 15, 2017
Are you expecting tiller to have a different set of client certificates than the kubernetes master? Or the same?
In this case tiller is acting as an authenticating proxy - would be good to make sure we have a checklist for the sorts of things that are "safe" and are audited. Such as never storing the token, never writing it to logs, etc. Some of the bearer tokens will be very powerful (cluster-admin or highly privileged users).
smarterclayton commentedon Feb 15, 2017
If you have the user's token, why do you need to do SubjectAccessReview for mutations? The Kube APIs will already do that.
@liggitt re: use of impersonation or not.
tamalsaha commentedon Feb 15, 2017
I am expecting them to be same.
Sounds great!
Calling
SubjectAccessReviewbefore doing any mutation will avoid failing in the middle of a release. Also, if TPRs are used to store Release data (instead of configmaps), I think SubjectAccessReview will be needed to enforce authZ.technosophos commentedon Feb 16, 2017
Assigned this to @tamalsaha as the feature owner.
liggitt commentedon Feb 17, 2017
Not necessarily, there are plenty of other reasons requests could fail. You need to handle partial success already.
tamalsaha commentedon Feb 17, 2017
Yes. Even the diff computation can fail. Is there any technical reason to avoid SubjectReview calls if possible (say, too much traffic for apiserver, etc.)?
liggitt commentedon Feb 19, 2017
can't assume the login name is identical to the authenticated username. some auth systems allow multiple logins (bob, BOB, bob@domain) to map to a single username. Also, to impersonate, you need to obtain and impersonate all the user info: username, group membership, and "extra" data (could hold scope info, other info used by the authorizer, etc). I'm not sure how you plan to obtain that info from basic auth credentials.
is this proposing sending the content of the private key to the server so the server can replay as the user?
Is this referring to storing the resolved user information (username, groups, extra data, etc) or the user credentials themselves?
User info (especially if used for replay) should only be stored in a way that guarantees its integrity. Some ways to do that are:
I think user info stored in mutable API fields is likely to be used without proper verification, allowing someone to modify it and perform escalation attacks.
All aspects of the user info - username, groups, and "extra" fields (see the SubjectAccessReview API)
34 remaining items
mumoshu commentedon Jan 10, 2018
@seh @technosophos Hi! Although it ended up as an unideal solution, please let me 👍 to the one involving impersonation, and highlight this part of the discussion:
I'm not really clear about that but isn't it apiserver but not tiller who calls out to a webhook token authnz server for a token review?
If that's the case, I suppose what Tiller would do given an user's brearer token is only to populate ImpersonateConfig which is then passed to kubernetes/client-go for impersonation?
Anyway, the webook token review thing would be beneficial for me.
The context is that I'm relying on heptio/authenticator which is a webhook token authentication server who validates a user-provided bearer-token with AWS IAM, so that any IAM user with an appropriate IAM role can authenticate against K8S API.
If Tiller supported impersonation with an user-provided bearer token (perhaps via something like
helm apply -f ... --token $mybearertoken?) while supporting Webhook token authn, we can completely freed from managing PKI for securing helm<->tiller communication. This is a huge win from a perspective of a cluster admin.Thanks!
Edit 1: Sorry but I had misunderstood how impersonation in k8s works. For impersonation, we have to allow Tiller to impersonate any user/group/etc w/ RBAC. That would be too much permission plus it doesn't involve the user's bearer-token at all :) "Impersonation" in this case should be done by Tiller just replays an user-provided bearer token, instead of utilizing k8s's impersonation mechanism.
Edit 2: RBAC does seem to allow restricting who can impersonate as who:
whereisaaron commentedon Jan 11, 2018
OT: Interesting @mumoshu! There are quite few moving parts to configuring heptio/authenticator, are you able to deploy it with just a
kube-awscluster.yaml? (If so I'd love to see an example!) Or do you need extra steps?mumoshu commentedon Jan 15, 2018
Hi @whereisaaron Yes, it is definitely possible. I'll share it once ready 👍
mumoshu commentedon Jan 15, 2018
For anyone interested, I'm working on my POC to delegate authn/authz w/ k8s RBAC via tokens to kube-rbac-proxy.
How it works
The modified version of helm assumes you to rely on a token saved in your kubeconfig to authenticate against k8s api. Then, helm with
--experimenta-rbac-proxyreads the token from kubeconfig, passes it along with a tiller gRPC call(inside metadata i.e. http/2 request header).kube-rbac-proxy calls SubjectAccessReviews K8S API to authn with the token, authz with the "resource attributes" specified to kube-rbac-proxy.
Once the authn/authz passes on kube-rbac-proxy, it modifies the original http/2 request to include
x-forwarded-userandx-forwarded-groupsto be used by tiller.tillerwith--experimental-rbac-proxythen trusts the forwarded header so that it allows the access to the requested tiller API.Note that you MUST protect your tiller container from anything other than accesses from the kube-rbac-proxy sidecar for now. kubectl-exec into the tiller should be prohibited, kubectl-port-forward to the tiller grpc port should be prohibited, etc.
If I could manage to add tls support for the kube-rbac-proxy mode, perhaps all of the above operations but kubectl-exec could be permitted?
I'm not really an expert in this area but am willing to learn. Please let me know anything you have in mind about this!
Thanks.
mumoshu commentedon Jan 16, 2018
I've put some time to investigate possibility to support impersonation for tiller via the
x-forwarded-userand/orx-forwarded-groups.I had wanted
tiller --experimental-impersonate-user --experimental-rbac-proxyto pass the value inx-forwarded-userto helm's local release module so that the release module could configure k8s api client to use an ImpersonateConfig which includes the passed username.This results in following changes to current code-base. Would it be an acceptable change to helm/tiller?
ReleaseReleaseServerreceives parameters for a specific release viaRelease.ReleaseServerto pass an one-time k8s client-go instance which has specific impersonation configReleaseServeras of today has a singleenvwhich contains a k8s api client used from everywhere in tiller.ImpersonateConfigper the authenticated user who requested the operation on a releaseTBD;
RemoteReleaseModules?fejta-bot commentedon Feb 15, 2018
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with
/remove-lifecycle rotten.Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with
/close.Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
/remove-lifecycle stale
whereisaaron commentedon Feb 17, 2018
/remove-lifecycle stale
This is still an important feature that should be considered for 3.x if an implementation can be identified. It would be good to get feedback on @mumoshu's excellent work on this.
whereisaaron commentedon Feb 17, 2018
/remove-lifecycle rotten
docwhat commentedon Apr 4, 2018
Is there something I could do to make this happen?
bacongobbler commentedon Apr 4, 2018
@docwhat there has been discussion in the community around this topic, and the general consensus is to close this in favour of the Helm 3 proposal around its Security Considerations. We plan on moving Helm towards a client-only model, which means that a
helm installacts on behalf of the user that invokedhelmrather than having to impersonate the user whentilleris deploying the chart. This model is identical tokubectl's current security model so it makes for a better fit overall in the ecosystem. No extra work to provide user impersonation would be required.Given that the general consensus is to move forward with the proposal in https://github.com/kubernetes-helm/community, I feel this is safe to close out this one as superseded by the Helm 3 proposal.