-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Update authorization to use the Target Reference API #7709
Comments
Draft CRDs on the |
We probably want to namespace these resources somehow to reflect that they only apply on the inbound side of the proxy--either in the group name: |
Issue #7709 proposes new Custom Resource types to support generalized authorization policies: - `AuthorizationPolicy` - `MeshTLSAuthentication` - `NetworkAuthentication` This change introduces these CRDs to the default linkerd installation (via the `linkerd-crds` chart) and updates the policy controller's admission webhook to validate these resource types. This change does NOT update the policy controller to actually honor these resources when serving policy configuration to proxies. Signed-off-by: Oliver Gould <ver@buoyant.io>
Issue #7709 proposes new Custom Resource types to support generalized authorization policies: - `AuthorizationPolicy` - `MeshTLSAuthentication` - `NetworkAuthentication` This change introduces these CRDs to the default linkerd installation (via the `linkerd-crds` chart) and updates the policy controller's admission webhook to validate these resource types. This change does NOT update the policy controller to actually honor these resources when serving policy configuration to proxies. This change adds policy-controller integration tests to exercise the admission controller & CRD validation logic. These tests are implemented in the `policy-test` crate. Signed-off-by: Oliver Gould <ver@buoyant.io>
Issue #7709 proposes new Custom Resource types to support generalized authorization policies: - `AuthorizationPolicy` - `MeshTLSAuthentication` - `NetworkAuthentication` This change introduces these CRDs to the default linkerd installation (via the `linkerd-crds` chart) and updates the policy controller's admission webhook to validate these resource types. This change does NOT update the policy controller to actually honor these resources when serving policy configuration to proxies. This change adds policy-controller integration tests to exercise the admission controller & CRD validation logic. These tests are implemented in the `policy-test` crate. Signed-off-by: Oliver Gould <ver@buoyant.io>
Issue #7709 proposes new Custom Resource types to support generalized authorization policies: - `AuthorizationPolicy` - `MeshTLSAuthentication` - `NetworkAuthentication` This change introduces these CRDs to the default linkerd installation (via the `linkerd-crds` chart) and updates the policy controller's admission webhook to validate these resource types. This change does NOT update the policy controller to actually honor these resources when serving policy configuration to proxies. This change adds policy-controller integration tests to exercise the admission controller & CRD validation logic. These tests are implemented in the `policy-test` crate. Signed-off-by: Oliver Gould <ver@buoyant.io>
Issue #7709 proposes new Custom Resource types to support generalized authorization policies: - `AuthorizationPolicy` - `MeshTLSAuthentication` - `NetworkAuthentication` This change introduces these CRDs to the default linkerd installation (via the `linkerd-crds` chart) and updates the policy controller's to handle these resource types. The policy admission controller validates that these resource reference only suppported types. This new functionality is tested at multiple levels: * `linkerd-policy-controller-k8s-index` includes unit tests for the indexer to test how events update the index; * `linkerd-policy-test` includes integration tests that run in-cluster to validate that the gRPC API updates as resources are manipulated; * `linkerd-policy-test` includes integration tests that exercise the admission controller's resource validation; and * `linkerd-policy-test` includes integration tests that ensure that proxies honor authorization resources. This change does NOT update Linkerd's control plane and extensions to use these new authorization primitives. Furthermore, the `linkerd` CLI does not yet support inspecting these new resource types. These enhancements will be made in followup changes. Signed-off-by: Oliver Gould <ver@buoyant.io>
Issue #7709 proposes new Custom Resource types to support generalized authorization policies: - `AuthorizationPolicy` - `MeshTLSAuthentication` - `NetworkAuthentication` This change introduces these CRDs to the default linkerd installation (via the `linkerd-crds` chart) and updates the policy controller's to handle these resource types. The policy admission controller validates that these resource reference only suppported types. This new functionality is tested at multiple levels: * `linkerd-policy-controller-k8s-index` includes unit tests for the indexer to test how events update the index; * `linkerd-policy-test` includes integration tests that run in-cluster to validate that the gRPC API updates as resources are manipulated; * `linkerd-policy-test` includes integration tests that exercise the admission controller's resource validation; and * `linkerd-policy-test` includes integration tests that ensure that proxies honor authorization resources. This change does NOT update Linkerd's control plane and extensions to use these new authorization primitives. Furthermore, the `linkerd` CLI does not yet support inspecting these new resource types. These enhancements will be made in followup changes. Signed-off-by: Oliver Gould <ver@buoyant.io>
Issue #7709 proposes new Custom Resource types to support generalized authorization policies: - `AuthorizationPolicy` - `MeshTLSAuthentication` - `NetworkAuthentication` This change introduces these CRDs to the default linkerd installation (via the `linkerd-crds` chart) and updates the policy controller's to handle these resource types. The policy admission controller validates that these resource reference only suppported types. This new functionality is tested at multiple levels: * `linkerd-policy-controller-k8s-index` includes unit tests for the indexer to test how events update the index; * `linkerd-policy-test` includes integration tests that run in-cluster to validate that the gRPC API updates as resources are manipulated; * `linkerd-policy-test` includes integration tests that exercise the admission controller's resource validation; and * `linkerd-policy-test` includes integration tests that ensure that proxies honor authorization resources. This change does NOT update Linkerd's control plane and extensions to use these new authorization primitives. Furthermore, the `linkerd` CLI does not yet support inspecting these new resource types. These enhancements will be made in followup changes. Signed-off-by: Oliver Gould <ver@buoyant.io>
This PR enables the ingestion of the new Linkerd policy types that are outlined in linkerd/linkerd2#7709 Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
The new
networking.k8s.io
APIs provide a pattern called policyattachment. This pattern allows for policies to be generic over the types
to which they are attached, with the specific supported types becoming an
implementation detail of Linkerd's policy controller.
We should anticipate this pattern stabilizing as the Kubernetes way and ensure
that our new routing/policy behavior leverages this pattern. This will help us
take advantage of standardized policies as they become available, and generally
ease cognitive burden.
Unfortunately, this probable means that we should replace the recently
introduced
ServerAuthorization
resource with a new resource type that moreclosely adheres to this pattern. Specifically:
Proposed changes
AuthorizationPolicy
We deprecate the
ServerAuthorization
resource, replacing it with the moregeneric
AuthorizationPolicy
. AnAuthorizationPolicy
uses thetargetRef
APIto bind an authorization policy to a single (server-side) resource. A given
authorization also references a set of required authentication resources. In
order for an authorization to apply, all authorizations must be satisfied.
targetRef
An
AuthorizationPolicy
'stargetRef
may reference a variety of resourcesrepresenting the server-side of a connection (where authorization is enforced).
The policy controller provides a validating admission controller that prevents
resources from being created with unsupported
targetRef
kinds.To accomplish the same functionality as the
ServerAuthorization
resource, wecan target a
Server
resource:To apply to all servers in a namespace, we can reference a
Namespace
resource:Similarly, we can target a
ServiceAccount
to apply to all pods with a givenServiceAccount
:It can even reference pods by a
Deployment
/StatefulSet
/etc.An
AuthorizationPolicy
may not target aService
, which is a distinctlyclient-centric concept. (I.e. a server cannot necessarily know whether a given
connection targetted servicea or serviceb).
Initially, Servers would be the only supported target type (and the web hook
should reject policies that use other targets). We would incrementally add
supported resources after the initial change is introduced straightforward, This
will also allow attachment to HTTP routes/request classes as those primitives
are fleshed out.
Note that this removes support for label-based matching of targets. This will at
the very least simplify our matching code, at the cost of requiring users to
create more resources. This is probably a reasonable tradeoff.
requiredAuthenticationRefs
A policy binds a target to a set of required authentication resources. All
authentications must be provided for traffic to be authorized.
Note that an authorization may reference authentication types in other
namespaces! This should be used with care, as anyone with write access to this
resource can alter the authentication requirement. This allows us to define
common authentication types (for instance, in the
linkerd
namespace) that maybe reused by policies.
NetworkAuthentication
MeshTLSAuthentication
If we want to require communication is authenticated via mesh TLS, we can use a
MeshTLSAuthentication
resource to describe acceptable clients.Client identities can be referenced by
ServiceAccount
:Or by
Namespace
:And we don't have to reference an in-cluster resource. We can also match
identity strings by suffix (especially relevant for multi-cluster gateways):
Or we can match any authenticated client with a wildcard identity
Questions
The text was updated successfully, but these errors were encountered: