Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Update naming and definition for access control #20

Merged
merged 3 commits into from
May 7, 2019

Conversation

grampelberg
Copy link
Collaborator

Access Control

  • Change TrafficRole to TrafficTarget. This is to hopefully clear up that this is authorization and for the target of traffic, not the mutual connection between client and server.
  • Move aware from resources to pod selectors. This is to allow a little bit more flexible policy (fit into the canary use case) and make the target definition a little bit more clear. Pods being selected is now explicit instead of the implicit relationship through higher order resources such as deployments.
  • Change specs to matches. This feels like a slightly better word and is 1:1 with the new definition in HTTPRoutes.
  • Change TrafficRoleBinding to IdentityBinding. This makes it explicit that the binding is an identity and not something else.
  • Call out the use of groups a little bit more. This is the best way to do allow all policies and disable identity for some endpoints (via system:unauthenticated).
  • Show an example of using matchExpressions to show a TrafficTarget that works for everything (or as close as possible).

Traffic Spec

  • Change routes to matches so that the interface can be general across protocols.
  • Add filters to allow for matching things other than a URI. This is currently useful for filtering the Host header FQDN/port combination.

@grampelberg
Copy link
Collaborator Author

@slack do these new names and structures make the access control side of this a little more obvious?

@aanandr check out the IdentityBinding section, in particular system:unauthenticated. Does that work for your mesh external use case?

@nicholasjackson this all fits together a little bit better, there were some ugly edge cases that I tripped over earlier today. WDYT?

@grampelberg
Copy link
Collaborator Author

@stefanprodan check out how HTTPRoutes and TrafficTargets work together. The idea is to have a new object that works with HTTPRoutes to apply other types of policy across those routes (retries, timeouts and rate limits). Check out #19 to track the thinking there. Definitely needs some more thought first =)

traffic-access-control.md Outdated Show resolved Hide resolved
traffic-access-control.md Outdated Show resolved Hide resolved
@slack
Copy link
Collaborator

slack commented May 6, 2019

@grampelberg I think this is a lot better.

I was thinking through the typical "client/server" mental model over the weekend, I think that's the thing that makes this hilariously slippery!

The statement "clients have access to services" in SMI becomes "IdentityBindings have permission to TrafficTargets". Would changing IdentityBinding to TrafficSource or TrafficSourceBinding help the mental model?

Otherwise, this is a great improvement over Role-bits. LGTM.

@grampelberg
Copy link
Collaborator Author

I thought about TrafficSource and had a good reason for not going down that route. @olix0r you wouldn't happen to remember would you? I think it didn't work when thinking about other policies like rate limits and retries.

@grampelberg grampelberg force-pushed the grampelberg/access-updates branch from 3a3c579 to 435f8b7 Compare May 6, 2019 22:39
@nicholasjackson
Copy link
Collaborator

LGTM

@grampelberg grampelberg merged commit 9d420fd into master May 7, 2019
@grampelberg grampelberg deleted the grampelberg/access-updates branch May 7, 2019 15:14
### ClusterTrafficTarget

A `ClusterTrafficTarget` allows policy to be applied to targets that live in
multiple namespaces. This is primarily useful to system wide endpoints such as
Copy link

Choose a reason for hiding this comment

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

What does this mean? The target is a service. What does it mean to say that target resides in multiple namespaces?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Think global allow policies, there would be multiple things serving traffic and they'd live in multiple namespaces.

Copy link

Choose a reason for hiding this comment

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

Thanks, that makes sense

*server* side of a connection. It is up to implementations to decide whether
they would also like to enforce access control on the *client* side
of the connection as well.
This example uses the `HTTPRoutes` definition from
Copy link

@aanandr aanandr May 14, 2019

Choose a reason for hiding this comment

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

A few questions here

  1. How will we handle access definition to multiple such services? Would we create a separate ClusterTrafficTarget spec for each or is the matchexpression rich in terms of accepting lists/wildcards?
  2. What is the namespace parameter under "rules" for? So far rules were generic and didnt have any namespace associated with them

name: path-specific
```

This example allows any unauthenticated client access to the rules defined in
`path-specific`.
the `path-specific` TrafficTarget. Groups are more flexible than just
unauthenticated users. Kubernetes defines many groups by default,
Copy link

Choose a reason for hiding this comment

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

Does such a group (similar to the system one used in this example) have to be created upfront? Would like to understand this a bit more

## RBAC
Continuing with the Prometheus example from above, it is possible to have a
IdentityBinding that grants a specific system service access to an endpoint on
every pod in the cluster.
Copy link

Choose a reason for hiding this comment

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

Would this be done by playing with the "matches" param a bit and providing an "access all" kind of option in HttpRoutes?


## Example Implementation

TODO ...

## Tradeoffs

Copy link

@aanandr aanandr May 14, 2019

Choose a reason for hiding this comment

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

  1. I would like to understand how all this will be used by customers to define access policies for their service mesh. From my understanding it looks like the moment a Policy is defined and applied all communication between all services (both originating from within the cluster and from outside) and destined to the selected service (e.g. "foo" used here) will be blocked except for the ones allowed per the policy. This is a good design but i am also wondering how customers will handle situations where there are many services wanting to talk to a single service. We have a mechanism for talking "TO" multiple services. Do we need one for requests originating "FROM" multiple services and going to a single service?

  2. If i want to restrict traffic originating from a Pod/Service and going to an endpoint outside the cluster how do i do that? For e.g., i may want the Pod to be able to access only specific endpoints in my network and residing outside the cluster. I think this has been called out as out of scope below - maybe the solution is something else but bringing up the point here because we are discussing access policies. Would we use Network Policies?

access control as it selects specific pods and not hostnames. Another object
will need to be created to manage this use case.

* Ingress policy - assuming clients present the correct identity, this *should*
Copy link

Choose a reason for hiding this comment

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

Ingress Policy kind of touches upon the point i raised earlier

common use cases (filtering by hostname) and will need to be expanded to cover
this use case.

* Other types of policy - having policy around retries, timeouts and rate limits
Copy link

Choose a reason for hiding this comment

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

Wouldnt retries and rate limiting also fall under traffic mgmt/routing?


* Non-HTTP traffic - this specification will need to be expanded to support
traffic such as Kafka or MySQL.
* Other types of identity - there is room to expand the `kind` accepted for
Copy link

Choose a reason for hiding this comment

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

This will be very useful, for e.g. tying identity to cloud resident identity providers/services like AAD. But for now K8S service accounts is a good start.

This example grants the ability to access the routes in `path-specific` to any
client providing the identity `bar` based on a ServiceAccount.
This example grants the ability to access the `/metrics` route to any client
providing the identity `bar`, based on a ServiceAccount.

As access control is additive, it is important to provide definitions that allow
non-authenticated traffic access. Imagine rolling a service mesh out
Copy link

Choose a reason for hiding this comment

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

Cool. I think groups here are addressing the earlier comment i had for not enforcing mTLS for a service for all communication that it terminates

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants