-
Notifications
You must be signed in to change notification settings - Fork 1.6k
KEP-4633: Only allow anonymous auth for configured endpoints #4634
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
Conversation
deeb407
to
d42cd81
Compare
/assign @liggitt |
/un-assign @liggitt |
/unassign @liggitt |
/unassign @liggitt |
/cc @liggitt |
249ea9b
to
bdd9e98
Compare
ee42d91
to
ade7a71
Compare
keps/sig-auth/4633-anonymous-auth-configurable-endpoints/kep.yaml
Outdated
Show resolved
Hide resolved
I plan on looking at this today. If that doesn't happen, I'll take care of getting it merged/marked |
keps/sig-auth/4633-anonymous-auth-configurable-endpoints/README.md
Outdated
Show resolved
Hide resolved
keps/sig-auth/4633-anonymous-auth-configurable-endpoints/README.md
Outdated
Show resolved
Hide resolved
keps/sig-auth/4633-anonymous-auth-configurable-endpoints/README.md
Outdated
Show resolved
Hide resolved
Hi @enj! gentle ping on this. We are getting close to the KEP freeze timelines. Thanks! |
At a high level, I am in favor of this KEP. I believe it will let certain environments harden themselves. Assuming Jordan is back from PTO tomorrow, I think my comments below would serve as good topics for the API review meeting.
anonymous:
enabledForAllRequests: bool
enabledForSelectedPaths: [ ... ] This makes it obvious from the single field exactly what the config is doing.
anonymous:
enabledForAllRequests: bool
enabledWithConditions:
- path: ...
- resource: ...
|
keps/sig-auth/4633-anonymous-auth-configurable-endpoints/kep.yaml
Outdated
Show resolved
Hide resolved
responding to #4634 (comment)
I want to keep the surface area here as small as possible, globbing wasn't required for the use cases presented so far, and the intent of this feature is to constrain anonymous auth to a well-known set of endpoints. That points to constraining this to exact paths in my opinion. AI: call out that this is more constrained than RBAC, etc, on purpose, and why.
AI: clarify this is an exact case-sensitive match, if you want to allow with/without slash, add both to the list (just like RBAC).
A flat list of paths is way simpler to reason about than parallel lists of non-resource paths and structured resource tuples, in terms of what it is allowing. I expect anyone using this feature to have ~1-3 entries and being very explicit about the paths the anonymous authenticator can be used for. AI: explain why this surface area is so constrained, and indicate that people who want anonymous access to a wider or more complicated set of endpoints should probably just leave it globally enabled and lean on authorization policy.
I want to be able to use the config file to disable anonymous auth as well, so I think the single coarse-grained explicit on / off boolean field is useful. Because we load the config file strictly, a typoed AI: explicitly describe how to disable anonymous auth via the config file
AI: switch to a list of struct conditions with only path as a condition today, which makes it possible to extend in the future if needed.
I don't think we should include this now, but if we structured as mentioned for 5, this could be added in the future: conditions:
- path: /healthz
ip: 127.0.0.1
- path: /readyz
ip: 127.0.0.1
- path: /livez
ip: 127.0.0.1
- path: /api/v1/namespaces/kube-public/configmaps/public-info
- path: /.well-known/openid-configuration
If someone is going to set up a sidecar load balancer container for kube-apiserver anyway, then sure, that could handle this scenario. However, many deployments do not run sidecar load balancer containers (see every kubeadm deployment) and the complexity to recommend they start doing so is way higher than allowing scoping down anonymous auth this way. AI: add an alternative considered sentence that a sidecar proxy could have handled this but would push complexity into all consumers who are not running side car proxies today, and the complexity of allowing the restriction in-tree is minimal.
AuthenticateRequest already takes the full request, TokenReview is a subset of that which only looks at the bearer token. I'd actually be ok with resurrecting #2843 to forward some info about the request to the token authenticators if we can constrain it sufficiently Determining if a given authenticator is active or not is a much smaller surface area than modifying the resulting user info based on request attributes. It's worth noting that this doesn't change the authenticator go interface at all, AuthenticateRequest already has the go request. Starting with a very constrained in-tree use of this information which we know doesn't modify resulting user info, before considering surfacing it to our external APIs, seems ok.
I'm not in favor of splitting this between authn and authz for a couple reasons:
AI: add an alternative considered about split authn / deny authorizer and why we don't want to do that.
Having other actual authenticators identify the incoming request as anonymous is ... sort of insane. I think we should start by just configuring / restricting the actual anonymous authenticator. AI: add an open question to resolve before beta about also applying any restrictions here to anonymous userInfo that comes back after all authenticators and impersonation have run. |
keps/sig-auth/4633-anonymous-auth-configurable-endpoints/README.md
Outdated
Show resolved
Hide resolved
Signed-off-by: Vinayak Goyal <[email protected]>
/approve |
@liggitt and @enj - I've updated the KEP based on the discussion and AI in #4634 (comment). Please take another look! Thanks! |
thanks /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jpbetz, liggitt, vinayakankugoyal The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
How would this new feature impact aggregated APIs added later to the cluster by installing apps which include a new APIService? I didn't see mention of that in the KEP. If some of those new aggregated APIs require anonymous auth, would anonymous auth be rejected if those paths were not included in this new configuration (assuming this new feature is configured with paths)? |
Yes. This is putting control about which endpoints allow anonymous auth in the hands of the kube-apiserver administrator. If they constrain anonymous auth to a specific set of paths, that precludes anonymous access through the kube-apiserver to aggregated API server endpoints not included in that set of paths. |
i think i agree with some of the points @enj brough up earlier especially around extensibility of the feature. example:
and as another crude example, if anonymous paths were guarded by authz with something like RBAC then that means they could be additive as resources are. however a single centralized config is a different story and also it means the admin has to keep it in sync on HA setups. so maybe a controller is needed. this makes deployment well guarded but more challenging. |
One of the goals of the feature is to disallow misconfiguration of clusters via RBAC, especially in cloud envs where the control plane config is owned by the cloud provider. Any tool has to the deal with anonymous auth being disabled. For example, AKS always has it disabled and there is no way to enable it. I don't see that ever changing. If kubeadm adopts this functionality (therefore changing the default of those environments), they should make it easy to configure since there is no distinction between the Kube API admin and the cluster operator in self hosted clusters. The anonymous config needs to be coordinated with the runtime config of the cluster such as aggregated APIs. |
here i mean the way RBAC is implemented as more of an example. it's an additive permission mechanism, via API resources, vs the static config which this feature utilizes. if the
also i would like to be clear that i don't disagree with the static config approach, and yes kubeadm can enable its internal patches mechanism to support extensibility on the cluster creation phase, but that would be a blocker for any tool deployed on top of kubeadm only via kubectl and YAML that wishes to enable additional anonymous auth endpoints. it has no way to modify the static config. (unless it also deploys a high-proviliged controller that manipulates files on control plane disk) for managed solutions up the stack like GKE, AKS, TKG, we could reason about this feature enablement, but i don't think i would give a +1 to enable it by default in OSS kubeadm. we could write a hardening guide. but i'm just one of the votes, so maybe the rest of the kubeadm maintainers will disagree with me. |
Uh oh!
There was an error while loading. Please reload this page.