Skip to content
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

Ambient policy enforcement #15072

Merged
merged 31 commits into from
May 30, 2024
Merged

Conversation

ilrudie
Copy link
Contributor

@ilrudie ilrudie commented May 13, 2024

Description

Adding some information about different ways to apply/target policy and the resulting enforcement locations. This is presently in a deleted doc which I suspect we don't want to introduce this page again so @craigbox would appreciate suggestions as to where we may want to add these.

Alternatively these could be depicted as flow diagrams rather than tables if desired.

Reviewers

  • Ambient
  • Docs
  • Installation
  • Networking
  • Performance and Scalability
  • Extensions and Telemetry
  • Security
  • Test and Release
  • User Experience
  • Developer Infrastructure
  • Localization/Translation

@ilrudie ilrudie requested a review from a team as a code owner May 13, 2024 20:40
@istio-testing istio-testing added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 13, 2024
@dhawton dhawton added the cherrypick/release-1.22 Set this label on a PR to auto-merge it to the release-1.22 branch label May 14, 2024
@dhawton
Copy link
Member

dhawton commented May 14, 2024

/test lint

Copy link
Member

@dhawton dhawton left a comment

Choose a reason for hiding this comment

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

May also want to wrap some of the really long lines

content/en/docs/ambient/usage/policy/index.md Outdated Show resolved Hide resolved
content/en/docs/ambient/usage/policy/index.md Outdated Show resolved Hide resolved
content/en/docs/ambient/usage/policy/index.md Outdated Show resolved Hide resolved
content/en/docs/ambient/usage/policy/index.md Outdated Show resolved Hide resolved
content/en/docs/ambient/usage/policy/index.md Outdated Show resolved Hide resolved
@istio-testing istio-testing added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 16, 2024
@ilrudie
Copy link
Contributor Author

ilrudie commented May 16, 2024

@linsun, @craigbox I moved some of these sections around to location I think may be more appropriate. content/en/docs/ambient/usage/policy/index.md I think we will delete before merging, it was just a wip location to store some md I didn't yet have a location to land...

Comment on lines 125 to 128
| no | Selector | Pod | n/a | DENY destination ztunnel |
| yes | Selector | Pod | n/a | DENY destination ztunnel |
| no | _empty**_ | Namespace | n/a | DENY destination ztunnel |
| yes | _empty**_ | Namespace | n/a | DENY destination ztunnel |
Copy link
Member

Choose a reason for hiding this comment

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

Also, I don't understand why source identity is n/a. Wouldnt that be the client or waypoint if it exists?


* Whether or not there is already a waypoint is in the traffic path.

** If no attachment is specified the policy will be treated as Namespace scoped.
Copy link
Member

Choose a reason for hiding this comment

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

Namespace scoped but only for L4? This is same as line 127 & 128, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was stated that having a blank cell in the table was confusing so I was trying to convey that if you don't have a selector or targetRef then you get namespace scope enforced at the ztunnel and this extra note was intended to clarify what empty in the cell means. Maybe it's a bad idea or just not worded correctly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the wording of this line to hopefully clarify it a little. Ultimately maybe we should just change _empty**_ though so that a footnote isn't required

@@ -0,0 +1,70 @@
---
title: Policy enforcement in ambient mode
Copy link
Member

Choose a reason for hiding this comment

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

Is this only Authz policy?

Copy link
Member

@linsun linsun May 17, 2024

Choose a reason for hiding this comment

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

I would like to see this under a page for authz policy vs under usage/policy as if folks don't need authz policy, they don't need to care about this. Or if folks don't need L4 authz policy, they don't need to worry about most of this.

Copy link
Contributor

Choose a reason for hiding this comment

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

My suggestion is:

  • this becomes a "Designing authorization policy for ambient mode" guide (or whatever other types of policy are different between L4 and L7 and need consideration)
  • it is weighted to come after the initial L4/L7 feature introductions
  • most of the content is here, and the L4/L7 feature introductions link out to this doc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, I thought we were attempting to get rid of a dedicated auth pol page for ambient. I'm ok with having it though.

Copy link
Contributor

Choose a reason for hiding this comment

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

We got rid of a dedicated page to move policy into the journey of an adopter:

  • here's how you install
  • here's how you can do L4 things
  • here's how you can add on L7 things

We didn't want to leave policy to after you've learned about L7.
However, a page on how you should think about and design policy is a good thing to have, and by the time you get to reading that, you should have understood L4/L7/etc architecturally.

test: no
---

Istio's ambient data plane splits the data plane into two different sets of components. This architecture allows users to only pay for application layer processing if they need it. The trade-off made is the extra complexity of understanding how traffic flows through this architecture and where policy will be enforced. This guide will introduce a number of broad scenarios and explore the permutations therein and the details to understand for each scenario.
Copy link
Member

Choose a reason for hiding this comment

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

extra complexity - we need to spin positively. flexibility, pay only what you need

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we just delete this page. Right now it is basically just storing notes.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, maybe good to have dedicated page for authz policy.

Copy link

linux-foundation-easycla bot commented May 17, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@ilrudie ilrudie force-pushed the ambient-policy-enforcement branch from 321ef22 to a5726f1 Compare May 17, 2024 15:07
@craigbox
Copy link
Contributor

Thanks for driving this, Ian!

I've had a look through today and here's what I would recommend:

  • a dedicated guide on how to design and use policy in an ambient world
  • a section in the L4 and L7 intro docs with a small amount of information - possibly just the table of situations under which the policy will apply,
  • each of those sections direct you off to the policy guide.

What you have here is basically that, with some rearrangement. The docs would probably also benefit from some "when and why to do X" docs, which I think @keithmattix was going to have a go at.

If you're interested, I can have a first pass at moving the things around?

content/en/docs/ambient/usage/l4-policy/index.md Outdated Show resolved Hide resolved
content/en/docs/ambient/usage/l7-features/index.md Outdated Show resolved Hide resolved
content/en/docs/ambient/usage/l7-features/index.md Outdated Show resolved Hide resolved
@@ -0,0 +1,70 @@
---
title: Policy enforcement in ambient mode
Copy link
Contributor

Choose a reason for hiding this comment

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

My suggestion is:

  • this becomes a "Designing authorization policy for ambient mode" guide (or whatever other types of policy are different between L4 and L7 and need consideration)
  • it is weighted to come after the initial L4/L7 feature introductions
  • most of the content is here, and the L4/L7 feature introductions link out to this doc.

content/en/docs/ambient/usage/policy/index.md Outdated Show resolved Hide resolved
content/en/docs/ambient/usage/policy/index.md Outdated Show resolved Hide resolved
Comment on lines 125 to 128
| no | Selector | Pod | n/a | DENY destination ztunnel |
| yes | Selector | Pod | n/a | DENY destination ztunnel |
| no | _empty**_ | Namespace | n/a | DENY destination ztunnel |
| yes | _empty**_ | Namespace | n/a | DENY destination ztunnel |
Copy link
Contributor

Choose a reason for hiding this comment

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

So why is row 2 a DENY?

also, suggest wording update to 'destination ztunnel (always DENY)' so it starts with the actual column heading, which is where it is enforced

@@ -75,6 +75,31 @@ Even though the identity of the pod is otherwise correct, the presence of a L7 p
command terminated with exit code 56
{{< /text >}}

### Authorization policy attachment

In the simplest enforcement scenario, you want to enforce policy against TCP attributes and you have no waypoint proxies in your traffic's path. These policies can be enforced by ztunnel proxies.
Copy link
Contributor

Choose a reason for hiding this comment

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

I am still not comfortable with the hoops we have to jump through to describe "having a waypoint in your traffic's path"

https://istio.io/latest/docs/ambient/architecture/data-plane/ uses "in mesh" and "in mesh, waypoint enabled" which is close but probably still not how people are going to describe workload configuration.

Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure the ideal way to word this if we don't like "no waypoint proxies in your traffic path" which I think is at least fairly clear, if somewhat clunky. I don't really like "waypoint disabled" personally but if that is the project's preferred wording I can change it.

Copy link
Contributor

@craigbox craigbox May 21, 2024

Choose a reason for hiding this comment

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

I've never heard "waypoint disabled" but I'd never use that; you don't define Stage 1 of something additive as "Without Stage 2" :)

"In the simplest enforcement scenario, you want to enforce policy against TCP attributes and you are only using the secure L4 overlay. These policies can be enforced by ztunnel proxies."

(Still too wordy.)
Diet Ambient™


In the simplest enforcement scenario, you want to enforce policy against TCP attributes and you have no waypoint proxies in your traffic's path. These policies can be enforced by ztunnel proxies.

Once you introduce a waypoint proxy, the ideal place to enforce policy shifts. Traffic arriving at the destination ztunnel will be coming from the waypoint's identity because waypoint proxies do not impersonate `src` identity on behalf of the client. This means that even if you only wish to enforce policy against TCP attributes, you should bind that policy to your waypoint proxy. An additional TCP policy may be applied to your workload to request that ztunnel enforce rules like, "in-mesh traffic needs to come from my waypoint in order to reach my application". This type of policy allows you to choose if "bypassing" the waypoint proxy is permissible in your scenario.
Copy link
Contributor

Choose a reason for hiding this comment

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

replace 'be coming' with 'come' or 'appear' or 'is presented as' (to make active voice)

you should bind that policy to your waypoint proxy

Is there any performance penalty? I guess the implication is "it will go through the waypoint anyway, if the PEP is the destination ztunnel"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The point I was trying to make is that if you want to base any of your policy on client identity waypoint is your only real choice. Otherwise even a client called evil-do-not-ever-allow will just look like your waypoint proxy to the dest ztunnel so you can't make a very good decision based on identity anymore.

@dhawton
Copy link
Member

dhawton commented May 20, 2024

/easycla

@ilrudie
Copy link
Contributor Author

ilrudie commented May 20, 2024

If you're interested, I can have a first pass at moving the things around?

@craigbox, I invited you as a collaborator on my istio.io fork if you wanna be able to contribute directly to this PR.

@ilrudie ilrudie force-pushed the ambient-policy-enforcement branch 2 times, most recently from 2969715 to 206d2c3 Compare May 20, 2024 21:06
@craigbox
Copy link
Contributor

If you're interested, I can have a first pass at moving the things around?

@craigbox, I invited you as a collaborator on my istio.io fork if you wanna be able to contribute directly to this PR.

Thanks, in general as a maintainer of Istio I can do that anyway 😊

@ilrudie
Copy link
Contributor Author

ilrudie commented May 21, 2024

Do we want to consider getting the L7 and L4 updates from this PR merged and break writing of the "design and use auth policy" out into it's own PR? I think the updates that exist now may provide value even though they are not the end state

@istio-testing istio-testing added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 22, 2024
@craigbox
Copy link
Contributor

PTAL at these exact links

I am especially concerned as to if the behavior I have written up in the L7 table is true.

@jarias-lfx
Copy link

/easycla

Copy link
Contributor Author

@ilrudie ilrudie left a comment

Choose a reason for hiding this comment

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

nice work on rewording and organizing this. Couple of suggestions but overall I think it's an improvement

content/en/docs/ambient/usage/l7-features/index.md Outdated Show resolved Hide resolved
content/en/docs/ambient/usage/l7-features/index.md Outdated Show resolved Hide resolved
content/en/docs/ambient/usage/l7-features/index.md Outdated Show resolved Hide resolved
content/en/docs/ambient/usage/l4-policy/index.md Outdated Show resolved Hide resolved
content/en/docs/ambient/usage/l4-policy/index.md Outdated Show resolved Hide resolved
@craigbox craigbox force-pushed the ambient-policy-enforcement branch from e7095cc to 58ed7b8 Compare May 24, 2024 09:24
@istio-testing istio-testing removed the needs-rebase Indicates a PR needs to be rebased before being merged label May 24, 2024
Copy link
Contributor Author

@ilrudie ilrudie left a comment

Choose a reason for hiding this comment

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

Looks good overall and likely fine to merge as is if doc maintainers like it. I've added some notes/suggestions mostly for clarity.


## Layer 4 authorization policies
## Policy enforcement using the secure overlay
Copy link
Contributor Author

Choose a reason for hiding this comment

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

"secure overlay" hasn't really been introduced, folks may not know what it is?

Suggested change
## Policy enforcement using the secure overlay
## Policy enforcement using ztunnel

Copy link
Contributor

Choose a reason for hiding this comment

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

See https://istio.io/latest/docs/ambient/overview/#ztunnel and a few other places, as well as the bikeshed thread. We need a way to refer to what you get when ambient is installed with no waypoints, where you don't have to care about the implementation.

content/en/docs/ambient/usage/l4-policy/index.md Outdated Show resolved Hide resolved
content/en/docs/ambient/usage/l4-policy/index.md Outdated Show resolved Hide resolved
content/en/docs/ambient/usage/l4-policy/index.md Outdated Show resolved Hide resolved
content/en/docs/ambient/usage/l4-policy/index.md Outdated Show resolved Hide resolved
content/en/docs/ambient/usage/l4-policy/index.md Outdated Show resolved Hide resolved
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In peer authentication we should probably mention permissive and maybe remove the part about disabling ambient mode all together. "if you need to disable mTLS just don't use Istio" is effectively the last thing we say when practically speaking inbound passthrough via permissive is probably what they would actually want.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure how to put that into words sorry, but could we do that in a different PR? It hasn't changed (except I merged in a fix to the formatting)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, I can try to tackle that as a fast follower. I mostly just don't love the idea of an Istio doc ending with "don't use Istio" if we can avoid it.

.spelling Outdated Show resolved Hide resolved
content/en/docs/ambient/usage/l7-features/index.md Outdated Show resolved Hide resolved
content/en/docs/ambient/usage/l7-features/index.md Outdated Show resolved Hide resolved

### Attach to the entire waypoint proxy

To attach a policy or routing rule to the entire waypoint — so that it applies to all traffic enrolled to use it — set `Gateway` as the `parentRefs` or `targetRefs` value, depending on the type.
To attach a route or a policy to the entire waypoint — so that it applies to all traffic enrolled to use it — set `Gateway` as the `parentRefs` or `targetRefs` value, depending on the type.
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be helpful to include when/why you would want to do this here - for policies with L7 attributes dependent on the identity of the calling service (as mentioned in the L4 docs under "Choosing enforcement points when waypoints are introduced " - any other specific use cases?) and mention implications for scope and which services are fronted by the waypoint (single service account vs all services in a namespace).

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe we intend to write such s guide but this doc was scoped down to be useful until that happened.

I kind of stole it off Ian 😁

{{< /text >}}

### Attach to a specific service

You can also attach a policy or routing rule to a specific service within the waypoint. Set `Service` as the `parentRefs` or `targetRefs` value, as appropriate.
You can also attach a route or policy to one or more specific services within the waypoint. Set `Service` as the `parentRefs` or `targetRefs` value, as appropriate.
Copy link
Member

Choose a reason for hiding this comment

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

Similar to waypoint attachment above, suggest which policies make sense to attach in this way (HTTPRoute commonly), and which may be impractical (would AuthorizationPolicy perhaps not work as may be expected by a user because the calling identity becomes the waypoint?)

Copy link
Contributor

@craigbox craigbox left a comment

Choose a reason for hiding this comment

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

It pains me I can do this

@ilrudie
Copy link
Contributor Author

ilrudie commented May 30, 2024

It pains me I can do this

I am reminded of the StarCraft 2 Legacy of the Void intro where the Archon forms and says, "Power overwhelming". Craig the maintainer and Craig the author together has great powers!

Signed-off-by: ilrudie <[email protected]>
@istio-testing istio-testing merged commit 9191a27 into istio:master May 30, 2024
6 checks passed
@istio-testing
Copy link
Contributor

In response to a cherrypick label: new pull request created: #15202

istio-testing pushed a commit that referenced this pull request May 31, 2024
* sync l7 update part

* finish translate

* fix lint

* fix lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ambient cherrypick/release-1.22 Set this label on a PR to auto-merge it to the release-1.22 branch kind/docs size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants