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

design: add initial external authorization proposal #2643

Merged
merged 1 commit into from
Jul 22, 2020

Conversation

jpeach
Copy link
Contributor

@jpeach jpeach commented Jun 30, 2020

This updates #432.
This updates #2459.

Signed-off-by: James Peach jpeach@vmware.com

@jpeach jpeach added the kind/design Categorizes issue or PR as related to design. label Jun 30, 2020
@codecov
Copy link

codecov bot commented Jun 30, 2020

Codecov Report

Merging #2643 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2643   +/-   ##
=======================================
  Coverage   76.88%   76.88%           
=======================================
  Files          72       72           
  Lines        5702     5702           
=======================================
  Hits         4384     4384           
  Misses       1227     1227           
  Partials       91       91           
Impacted Files Coverage Δ
internal/dag/cache.go 98.09% <0.00%> (-0.96%) ⬇️
internal/dag/status.go 97.43% <0.00%> (ø)
internal/fixture/meta.go 100.00% <0.00%> (ø)
cmd/contour/servecontext.go 93.54% <0.00%> (ø)
internal/contour/handler.go 78.94% <0.00%> (ø)
internal/contour/metrics.go 65.85% <0.00%> (ø)
internal/k8s/statusupdater.go 20.40% <0.00%> (ø)
internal/featuretests/featuretests.go 88.50% <0.00%> (ø)
internal/dag/builder.go 92.06% <0.00%> (+0.13%) ⬆️
internal/k8s/objectmeta.go 100.00% <0.00%> (+6.89%) ⬆️

Copy link
Member

@stevesloka stevesloka left a comment

Choose a reason for hiding this comment

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

  • How does the actual auth flow work? You mentioned OIDC, but not how we might configure that?
  • You mentioned not allowing external auth servers, so this proposal requires all auth to exist inside the k8s cluster where Contour is running?

design/external-authorization-design.md Outdated Show resolved Hide resolved
design/external-authorization-design.md Outdated Show resolved Hide resolved
design/external-authorization-design.md Outdated Show resolved Hide resolved
design/external-authorization-design.md Outdated Show resolved Hide resolved
design/external-authorization-design.md Outdated Show resolved Hide resolved
design/external-authorization-design.md Outdated Show resolved Hide resolved
design/external-authorization-design.md Show resolved Hide resolved
design/external-authorization-design.md Show resolved Hide resolved
design/external-authorization-design.md Outdated Show resolved Hide resolved
@stevesloka
Copy link
Member

Another thought I had was adding auth to Conditions somehow, so you could allow operators to tell a child set of Proxies should have specific auth, but then not allow them to configure from there. I think some operators might not want each route to be disabled for example.

@jpeach
Copy link
Contributor Author

jpeach commented Jun 30, 2020

Another thought I had was adding auth to Conditions somehow, so you could allow operators to tell a child set of Proxies should have specific auth, but then not allow them to configure from there. I think some operators might not want each route to be disabled for example.

I'm not really following this, can you explain this a bit more?

@jpeach
Copy link
Contributor Author

jpeach commented Jul 1, 2020

  • How does the actual auth flow work?

There's some relevant sequence diagrams in #2459. I can reproduce them here for context.

You mentioned OIDC, but not how we might configure that?

You would create a SupportService CRD that references a service that implements OIDC. That will need to be configured with all the necessary OIDC parameters. There's still a bunch of work needed to explore and document how to do this.

  • You mentioned not allowing external auth servers, so this proposal requires all auth to exist inside the k8s cluster where Contour is running?

If you used an ExternalName Service to back the SupportService CRD, then you could have an auth server outside the cluster. Not sure if that will need special code to support, or whether we would get it for free from Contour's existing Service support.

@jpeach
Copy link
Contributor Author

jpeach commented Jul 1, 2020

xref #1922

@jpeach jpeach force-pushed the external-auth-design branch 2 times, most recently from 37697bb to 49dc967 Compare July 1, 2020 03:46
@jpeach
Copy link
Contributor Author

jpeach commented Jul 2, 2020

FYI, @pims convinced me that being able to toggle the fail-open or fail-closed behavior is needed when migrating from internal application auth to external auth, so I'm planning to add that flag to the API.

@jpeach jpeach force-pushed the external-auth-design branch 2 times, most recently from 5f782c3 to 7c613d1 Compare July 7, 2020 02:20
@jpeach
Copy link
Contributor Author

jpeach commented Jul 9, 2020

@jpeach Note to self ... consider what happens to headers injected by the external auth server on routes that have auth disabled. A client request could still present those headers, causing an application to become confused (a request could accidentally be performed as an authorized identity).

So perhaps we need to add API to ensure that any injected auth headers are scrubbed from the incoming client request. Envoy has the concept of internal headers, which aligns fairly closely, but that (and the API for removing headers) requires listing specific headers (would be more robust to pattern match IMHO). The Envoy concept on internal requests is also a bit hard to understand and it's not obvious that it would be the right choice in all deployments.

Copy link
Member

@youngnick youngnick left a comment

Choose a reason for hiding this comment

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

This is great work, and I think it's really close. Just a few small questions and nits.

design/external-authorization-design.md Show resolved Hide resolved
design/external-authorization-design.md Outdated Show resolved Hide resolved
design/external-authorization-design.md Outdated Show resolved Hide resolved
design/external-authorization-design.md Outdated Show resolved Hide resolved
design/external-authorization-design.md Outdated Show resolved Hide resolved
design/external-authorization-design.md Outdated Show resolved Hide resolved
design/external-authorization-design.md Outdated Show resolved Hide resolved
Copy link
Member

@youngnick youngnick left a comment

Choose a reason for hiding this comment

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

I think at this point any concerns I have are squarely in 'implementation detail' territory. This LGTM, but I'd like to see @stevesloka's thoughts as well.

Copy link
Member

@stevesloka stevesloka left a comment

Choose a reason for hiding this comment

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

Looking good @jpeach, just some more questions on bits that aren't clear to me.

design/external-authorization-design.md Show resolved Hide resolved
design/external-authorization-design.md Outdated Show resolved Hide resolved
design/external-authorization-design.md Outdated Show resolved Hide resolved
design/external-authorization-design.md Show resolved Hide resolved
design/external-authorization-design.md Show resolved Hide resolved
design/external-authorization-design.md Show resolved Hide resolved
design/external-authorization-design.md Outdated Show resolved Hide resolved
design/external-authorization-design.md Show resolved Hide resolved
@stevesloka
Copy link
Member

Also don't want to loose context from a Slack conversation about renaming s/SupportService/ExtensionService: https://kubernetes.slack.com/archives/C8XRH2R4J/p1594707008255100

Copy link
Member

@skriss skriss left a comment

Choose a reason for hiding this comment

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

still paging in all the context, but added some initial questions & comments.

design/external-authorization-design.md Show resolved Hide resolved
design/external-authorization-design.md Show resolved Hide resolved
design/external-authorization-design.md Show resolved Hide resolved
design/external-authorization-design.md Show resolved Hide resolved
design/external-authorization-design.md Show resolved Hide resolved
@jpeach
Copy link
Contributor Author

jpeach commented Jul 17, 2020

I'm pretty sure I addressed all the comments, but I'll leave this until next week to give a change for additional feedback. I added a new "Compatibility" section to make it more obvious how auth will interact with existing features.

Also SupportService is now ExtensionService.

Copy link
Member

@youngnick youngnick left a comment

Choose a reason for hiding this comment

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

Just approving again to say that I prefer extensionRef.

Copy link
Member

@skriss skriss left a comment

Choose a reason for hiding this comment

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

no other comments, LGTM!

@stevesloka
Copy link
Member

This CRD is relatively generic, so that it can be re-used for Envoy rate limiting and logging services.

If the goal of this CRD is to re-use for other bits other than just auth. How does Contour understand that context? For instance, if we use this for rate limiting and features of the spec aren't valid to be set, how could that be implemented?

@jpeach
Copy link
Contributor Author

jpeach commented Jul 20, 2020

This CRD is relatively generic, so that it can be re-used for Envoy rate limiting and logging services.

If the goal of this CRD is to re-use for other bits other than just auth. How does Contour understand that context?

The context can be understood from where the CRD is referenced. In this design, Contour can do the right thing because the CRD is referenced from an authorization policy. In logging and rate limiting, there would be a similar context in the HTTPProxy resource.

For instance, if we use this for rate limiting and features of the spec aren't valid to be set, how could that be implemented?

Hard to answer this hypothetical, but since the extension service CRD is basically scoped to generate an Envoy cluster, that's sufficient for the rate limiting and logging cases that we know about. Maybe there could be conflicting use cases in the future, but I expect we could address them by revving the CRD, adding another CRD, or in some other way.

@stevesloka
Copy link
Member

The context can be understood from where the CRD is referenced. In this design, Contour can do the right thing because the CRD is referenced from an authorization policy. In logging and rate limiting, there would be a similar context in the HTTPProxy resource.

Ahh ok that could work looking at where it's referenced from. =)

Copy link
Member

@stevesloka stevesloka left a comment

Choose a reason for hiding this comment

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

I've made a bunch of comments in the design that have questions and things I'm not sure how they might work, but I'm not going to block any further, but still think they are important.

@jpeach
Copy link
Contributor Author

jpeach commented Jul 21, 2020

  • added ingress to non-goals
  • moved timeout to ExtensionService CRD
  • made ExtensionService services field a slice

design/external-authorization-design.md Outdated Show resolved Hide resolved
- Most HTTP authorization protocols depend on HTTPS to keep headers and URL query parameters private.
Supporting only authorization on HTTPS, Contour reduces the changes of misconfiguring this.
- HTTPS sessions between Envoy and the authorization server are required.
TLS validation can be configured if necessary (should be recommended),
Copy link
Member

Choose a reason for hiding this comment

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

Just a note for future: preferably the Envoy <-> Authorization server connection would be mutually authenticated (related to #2338).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeh that should be doable eventually.

design/external-authorization-design.md Show resolved Hide resolved
design/external-authorization-design.md Show resolved Hide resolved
design/external-authorization-design.md Show resolved Hide resolved
This updates projectcontour#432.
This updates projectcontour#2459.
This updates projectcontour#2325.

Signed-off-by: James Peach <jpeach@vmware.com>
@jpeach jpeach merged commit e02ca4c into projectcontour:master Jul 22, 2020
@jpeach jpeach deleted the external-auth-design branch July 22, 2020 00:23
@glerchundi
Copy link
Contributor

glerchundi commented Jul 22, 2020 via email

@jpeach
Copy link
Contributor Author

jpeach commented Jul 22, 2020

Thinking out loud but as this design doc i ntroduces the concept of ExtensionService, have you considered the idea of using WASM based extension services instead of just those based on gRPC? It’s problably premature to take even into consideration but I would like to put it on the table to see if the new spec definitions can absorb them in the future.

In principle the extensionRef field in the HTTPProxy resource could reference something that is not an ExtensionService CRD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/design Categorizes issue or PR as related to design.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants