-
Notifications
You must be signed in to change notification settings - Fork 101
docs(mesh): mirror MeshTrafficPermission docs #5518
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...h_policies/meshtrafficpermission_experimental/examples/allow-observability-namespace.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| title: 'Allow traffic from a namespace' | ||
| description: 'Use MeshTrafficPermission to allow requests from every workload in a namespace by matching a SPIFFE ID prefix.' | ||
|
|
||
| weight: 800 | ||
|
|
||
| namespace: kong-mesh-demo | ||
| config: | ||
| type: MeshTrafficPermission | ||
| name: allow-observability-ns | ||
| mesh: default | ||
| spec: | ||
| rules: | ||
| - default: | ||
| allow: | ||
| - spiffeID: | ||
| type: Prefix | ||
| value: spiffe://default.default.mesh.local/ns/observability |
17 changes: 17 additions & 0 deletions
17
app/_mesh_policies/meshtrafficpermission_experimental/examples/deny-malicious-namespace.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| title: 'Deny traffic from a namespace' | ||
| description: 'Use MeshTrafficPermission to deny requests from every workload in a namespace by matching a SPIFFE ID prefix.' | ||
|
|
||
| weight: 900 | ||
|
|
||
| namespace: kong-mesh-demo | ||
| config: | ||
| type: MeshTrafficPermission | ||
| name: deny-malicious-ns | ||
| mesh: default | ||
| spec: | ||
| rules: | ||
| - default: | ||
| deny: | ||
| - spiffeID: | ||
| type: Prefix | ||
| value: spiffe://default.default.mesh.local/ns/malicious | ||
22 changes: 22 additions & 0 deletions
22
.../meshtrafficpermission_experimental/examples/deny-observability-on-backend-admin-api.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| title: 'Override a mesh-wide allow rule on a service port' | ||
| description: 'Use MeshTrafficPermission to deny traffic from a namespace on a specific service port, even when a mesh-wide allow rule exists.' | ||
|
|
||
| weight: 700 | ||
|
|
||
| namespace: kong-mesh-demo | ||
| config: | ||
| type: MeshTrafficPermission | ||
| name: deny-observability-ns | ||
| mesh: default | ||
| spec: | ||
| targetRef: | ||
| kind: Dataplane | ||
| labels: | ||
| app: backend | ||
| sectionName: backend-admin-api | ||
| rules: | ||
| - default: | ||
| deny: | ||
| - spiffeID: | ||
| type: Prefix | ||
| value: spiffe://default.default.mesh.local/ns/observability | ||
|
lobkovilya marked this conversation as resolved.
|
||
92 changes: 92 additions & 0 deletions
92
app/_mesh_policies/meshtrafficpermission_experimental/index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| --- | ||
| title: MeshTrafficPermission with SPIFFE ID matchers | ||
| name: MeshTrafficPermissions | ||
| description: Control service-to-service access using SPIFFE identities with allow, deny, and shadow deny rules. | ||
| products: | ||
| - mesh | ||
| content_type: plugin | ||
| type: policy | ||
| icon: policy.svg | ||
| tags: | ||
| - access-control | ||
| - authorization | ||
| - security | ||
| min_version: | ||
| mesh: '2.12' | ||
| related_resources: | ||
| - text: Issue identity with the MeshIdentity bundled provider | ||
| url: /mesh/issue-identity-with-meshidentity/ | ||
| - text: Issue identity with MeshIdentity Spire provider | ||
| url: /mesh/issue-identity-with-meshidentity-spire/ | ||
| - text: MeshIdentity policy | ||
| url: /mesh/policies/meshidentity/ | ||
| - text: MeshTrust policy | ||
| url: /mesh/policies/meshtrust/ | ||
| - text: MeshTLS policy | ||
| url: /mesh/policies/meshtls/ | ||
| --- | ||
|
|
||
| {:.warning} | ||
| > This resource is experimental. | ||
| > Enable [MeshIdentity](/mesh/policies/meshidentity/) before you apply `MeshTrafficPermission`. | ||
|
|
||
| `MeshTrafficPermission` defines which clients can access services inside a mesh based on their SPIFFE identities. | ||
| If no `MeshTrafficPermission` applies, the default behavior is to deny all requests. | ||
|
|
||
| You can use `MeshTrafficPermission` to: | ||
|
|
||
| * deny requests from specific clients or namespaces so service owners can't override that deny rule | ||
| * allow groups of clients, such as all workloads in a namespace, to access services by default | ||
| * shadow-deny traffic so you can validate a policy before you enforce it | ||
|
|
||
| The following example shows a common rule set: | ||
|
|
||
| {% policy_yaml namespace=kong-mesh-demo %} | ||
|
|
||
| ```yaml | ||
| type: MeshTrafficPermission | ||
| name: my-app-permissions | ||
| mesh: my-mesh | ||
| spec: | ||
| targetRef: | ||
| kind: Dataplane | ||
| labels: | ||
| app: my-app | ||
| rules: | ||
| - default: | ||
| deny: | ||
| - spiffeID: | ||
| type: Prefix | ||
| value: "spiffe://my-mesh.us-east-2.mesh.local/ns/legacy-ns" | ||
| - spiffeID: | ||
| type: Exact | ||
| value: "spiffe://my-mesh.us-east-2.mesh.local/ns/test/sa/client" | ||
| allow: | ||
| - spiffeID: | ||
| type: Prefix | ||
| value: "spiffe://my-mesh.us-east-2.mesh.local" | ||
| ``` | ||
|
|
||
| {% endpolicy_yaml %} | ||
|
|
||
| With this policy in place, workloads labeled `app: my-app` reject connections from identities in the `legacy-ns` namespace | ||
| and from the specific `test/client` identity, while continuing to accept other identities in the `my-mesh.us-east-2.mesh.local` | ||
|
lobkovilya marked this conversation as resolved.
|
||
| [trust domain](/mesh/policies/meshtrust/). | ||
|
|
||
| ## Configuration | ||
|
|
||
| `MeshTrafficPermission` uses three matcher lists: | ||
|
|
||
| * `deny`: Clients that must always be denied. | ||
| * `allow`: Clients that are explicitly allowed. | ||
| * `allowWithShadowDeny`: Clients that are allowed, but also logged as if they were denied. This lets you test a new policy before you enforce a deny rule. | ||
|
|
||
| The policy evaluates requests in this order: | ||
|
|
||
| 1. If a request matches at least one `deny` matcher, the result is `DENY`. | ||
| 1. If a request matches no `deny` matcher and at least one `allow` or `allowWithShadowDeny` matcher, the result is `ALLOW`. | ||
| 1. If no matcher applies, the result is `DENY`. | ||
|
|
||
| See the [Examples](./examples/) tab for ready-to-apply policies that deny namespace-wide traffic, | ||
| allow namespace-wide traffic, and override a mesh-wide allow rule on a specific service port. | ||
| See the [Configuration reference](./reference/) tab for the complete schema. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.