-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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
Added proposal for "acting-as". #16933
Conversation
Not a ton of time to comment today, but in general some form of scoped delegation on behalf of the user is good. It's even better if it's the intersection of a service account for the controller (scoped) and the user context (scoped). Or even further, a named scope that the delegation occurs in (permission is intersection of controller, user, and a scope the controller applies). |
@smarterclayton I don't want to involve a human user in the intersection. It should be possible for a human user to create a replication controller, and then leave the company, thus no longer appear in ldap, and that replication controller should not stop working. That is too tight a coupling between a corporate database and a production system. We've tried that tight coupling, and bad things happen. |
@smarterclayton @liggitt does openshift already do something in this area? |
Sorry, wasn't implying that. I was merely saying that the actor the RC is acting on behalf of should be the service account (which is a user), and it should be clear that the "on behalf of" and the RC's permissions should be able to be made safe. |
I personally do not believe end users should be the "actors" in the system except for very transient things (things that should run to completion within the scope of a period of employment with 99.9% certainty) |
Agreed. |
We run all controllers (well, almost all) under their own service accounts We do use pod security policy to limit the impact of the creation for many
On Nov 6, 2015, at 3:30 PM, Eric Tune notifications@github.com wrote: @smarterclayton https://github.com/smarterclayton @liggitt — |
master This does require users to change their flags, but we can support the | ||
old way for several release cycles. | ||
- change apiserver to recognize an "Acting-As" header in requests, and to check whether the | ||
originally authenticated user is able to act as that user. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you envision only being able to act as a user, or also as a group?
how do you envision the authn layer checking if a user (or group) is allowed to act as another user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I envisioned only being able to act as a user. I envision that the steps are:
- authenticate user as we do today
- authorize user to act-as another user
- lookup group membership of (effective) user
- authorize REST action using effective user and its group membership
I was thinking that we would only let you act-as a kubernetes ServiceAccount, not as another type of account. Since ServiceAccount is a kubernetes object, it can be referenced in Openshift (or other) Policy statements. So, you can have a Policy and Role like this:
kind: Role
...
rules:
- resourceNames: [ "namespace/foo/serviceAccounts/default", ...]
- verb: ["actAs"]
-----
kind: roleBinding
...
usernames: ["system:replicationController"]
roleRef: "that one up there"
which says that user "system:replicationController" can "actAs" (or maybe "use") the default service account for namespace foo (and probably every other namespace, as they get added.)
cc @deads2k |
1. this is a common class of bugs in systems such as this. | ||
1. we might trust ourselves to keep controllers in the main repo free from these bugs; | ||
but we will not have time to closely review contributed code for these bugs. | ||
1. out authorization rules will get more complex over time, so deputies will have |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo "out" should be "our"
Pulling @liggitt's comment out into the main thread:
I share the concern. I definitely want the ability for a user to act as a ServiceAccount, but I'm not certain that this approach reduces the trust required for controllers. Whoever enables the controller must still trust that the controller switches identity correctly. Meaning that the controller is triggered to request the correct SA and that code for selecting an SA is not bugged. That seems like I'm still trusting the controller to properly use all the permissions it has for its own identity and all the transitive permissions it gets from the SAs its allowed to act-as. I still want the feature to allow a regular user to act as a more privileged service account for some tasks (sort of like |
Is there a rule we can enforce to make controllers extremely unlikely to But I also think that at some level you have to trust that the system On Tue, Nov 10, 2015 at 5:34 AM, David Eads notifications@github.com
|
4d01f80
to
87e94a9
Compare
This PR hasn't been active in 90 days. Closing this PR. Please reopen if you would like to work towards merging this change, if/when the PR is ready for the next round of review. cc @erictune You can add 'keep-open' label to prevent this from happening again, or add a comment to keep it open another 90 days |
GCE e2e build/test passed for commit 87e94a9. |
@deads2k You have implemented some of this, and some other things that this proposal did not forsee. Does it make sense to merge this and then update it, or abandon it, or something else? |
I've implemented the mechanics of impersonation (acting-as), but not the usage being described here. I think we (at least @liggitt and myself) agree with you that we should stop using the insecure port for controllers and that we need to more tightly scope the powers that individual controllers have. We're less sure of using impersonation to do it. Not much progress was made on stabilizing rbac in 1.4, but it is on my personal objective list for 1.5 so I'm hoping to make things like default policy achievable. I think that in combination with a special purpose "service accounts from namespace kube-infra are special" authorizer for alternative authorization approaches makes the "Special-purpose accounts" a viable option. How do you feel about pursuing that avenue? |
I like that approach for kubelet. I like it less for controller-manager
On Wed, Aug 24, 2016 at 4:58 AM, David Eads notifications@github.com
|
Impersonation can reduce instances of the confused deputy problem due to How do you and liggitt rate the importance of "avoid confused deputy"? Do On Mon, Aug 29, 2016 at 2:08 PM, Eric Tune etune@google.com wrote:
|
Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test". This message will repeat several times in short succession due to jenkinsci/ghprb-plugin#292. Sorry. |
A third party controller could provide a |
Important, but well bounded. In OpenShift, we bind individual controllers to roles which limit the controllers to the individual resources they must have access to run. For instance, the RS controller can
That significantly reduces risk, since anyone able to create a replicaset has implicit control over pods already. That means that the confused deputy risk for the controller is only cross namespace attacks. Cross namespace bugs are actually pretty easy to review for since there's only one namespace involved per-action. That why we aren't overly concerned about impersonation. The difficulty in code review for determining safe usage of two clients instead of one client and when to use which client (users probably shouldn't be creating events as a for instance) seems additive to the problem of cross namespace bug inspection. With RBAC, its now possible to start using a similar strategy in kube. I'm working towards creating default |
@erictune convinced me that we need a way to scope impersonation and one way of doing it is to intersect the rights of the impersonater with the rights of the impersonatee. In OpenShift, we do this using scopes inside of the We both agreed that the next step for controllers is to find a way to scope the overall powers of individual controllers (probably using @erictune as I understood the next steps, you were going to propose a mechanism for driving this intersection and demonstrate inside of a controller. We might end up taking the intersection first (it provides utility for callers regardless of whether controllers use it). |
Adding label:do-not-merge because PR changes docs prohibited to auto merge |
This PR hasn't been active in 90 days. Closing this PR. Please reopen if you would like to work towards merging this change, if/when the PR is ready for the next round of review. cc @erictune You can add 'keep-open' label to prevent this from happening again, or add a comment to keep it open another 90 days |
This change is