-
Notifications
You must be signed in to change notification settings - Fork 617
Add auth-proxy and enable on IntegrationSink #8708
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
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #8708 +/- ##
==========================================
- Coverage 51.62% 50.73% -0.90%
==========================================
Files 401 402 +1
Lines 25459 25962 +503
==========================================
+ Hits 13144 13172 +28
- Misses 11509 11979 +470
- Partials 806 811 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| } | ||
|
|
||
| logger.Info("Starting auth proxy servers...") | ||
| if err = serverManager.StartServers(ctx); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we add otel instrumentation to these servers for a better observability picture into this sidecar?
IMO, this should be a follow up PR on top of this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, let's do OTel in a separate one
Cali0707
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@creydr could you TAL at the linter errors?
Error: cmd/auth_proxy/main.go:155:2: ineffectual assignment to ctx (ineffassign)
ctx = logging.WithLogger(ctx, logger)
^
Error: pkg/auth/verifier.go:400:2: Consider pre-allocating `subjectsWithFiltersFromApplyingPolicies` (prealloc)
var subjectsWithFiltersFromApplyingPolicies []SubjectsWithFilters
fixed |
Cali0707
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/hold in case @creydr wants to wait for other reviews
|
|
||
| logger.Debugf("Handling request to %s", r.RequestURI) | ||
|
|
||
| err := h.authVerifier.VerifyRequestFromSubjectsWithFilters(ctx, features, h.config.SinkAudience, h.authSubjects, h.config.SinkNamespace, r, w) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The authVerifier.Verify...() method, internally copies the request to avoid the problem.
In #8710 we had the issue, that the request was accessed before it was passed to the authVerifier already. (At least I think so)
But I'll rebase this PR after #8710 is in, to get the authz tests updated, which check for this issue now
Co-authored-by: Calum Murray <cmurray@redhat.com>
|
Needed to resolve some merge conflicts |
| trustBundleConfigMapLister: trustBundleConfigMapInformer.Lister(), | ||
| integrationSinkLister: integrationSinkInformer.Lister(), | ||
| rolebindingLister: rolebindingInformer.Lister(), | ||
| authProxyImage: env.AuthProxyImage, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I htink we need like this for event transformer as well
but lets do on separate pr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I'd do this as a separate PR. Added #8715 to have an issue for it
matzew
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: creydr, matzew The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
|
Most/all of the IntegrationSink components are not written in Golang and thus can use our libs for AuthN and AuthZ checks. Therefor the IntegrationSink does not support AuthN and AuthZ currently.
This PR adds an auth-proxy, which can be used as a sidecar container and does the Auth checks. Therefor we can get AuthN/AuthZ support on the IntegrationSink.
This PR contains the following main parts:
Hint:
The auth-proxy requires permissions to read the features and logging configmaps from the knative-eventing namespace. Therefor each pod running an IntegrationSink needs to have a RoleBinding for the
knative-eventing-auth-proxyrole in the knative-eventing namespace. Instead of adding a RoleBinding for each IntegrationSink, we aggregate it together in theeventing-auth-proxyRoleBinding to not have x similar RoleBindings.