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

unify authn for xds and sds clients #45455

Merged
merged 4 commits into from
Jun 21, 2023
Merged

Conversation

hzxuzhonghu
Copy link
Member

Please provide a description of this PR:

To help us figure out who should review this PR, please put an X in all the areas that this PR affects.

  • Ambient
  • Configuration Infrastructure
  • Docs
  • Installation
  • Networking
  • Performance and Scalability
  • Policies and Telemetry
  • Security
  • Test and Release
  • User Experience
  • Developer Infrastructure

Please check any characteristics that apply to this pull request.

  • Does not have any user-facing changes. This may include CLI changes, API changes, behavior changes, performance improvements, etc.

@hzxuzhonghu hzxuzhonghu requested review from a team as code owners June 14, 2023 07:41
@istio-testing istio-testing added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 14, 2023
Copy link
Member Author

Choose a reason for hiding this comment

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

this is originally from pilot/pkg/xds/auth.go

Copy link
Contributor

@costinm costinm left a comment

Choose a reason for hiding this comment

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

Not sure XDS and SDS/CA clients should have the same behavior.

For XDS - it is fine to use lighter auth, there is nothing secret - just configs and endpoints.

For SDS/CA - we want more strict auth. Unfortunately we don't do a lot of checks - like
verify the IP address ( now that we have the reverse index ), but should become stronger.

Not strongly against this change - IMO longer term it would be best to put a gateway in front of Istiod and use our own authn/authz instead of custom.

@hzxuzhonghu
Copy link
Member Author

For SDS the strict part, we can pass in addional authentiocator. Or add a wrapper based on the shared function

@hzxuzhonghu hzxuzhonghu added the release-notes-none Indicates a PR that does not require release notes. label Jun 14, 2023
"istio.io/istio/pkg/env"
)

var AuthPlaintext = env.Register("XDS_AUTH_PLAINTEXT", false,
Copy link
Member

Choose a reason for hiding this comment

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

Making this apply to the CA is a major major security risk

Copy link
Member Author

Choose a reason for hiding this comment

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

It does not change sds. YOu can see the return value of Authenticate for CA server is nil, nil when it is through 15010(plaintext)

But we donot allow nil for SDS

if caller == nil {
return nil, status.Error(codes.Unauthenticated, "request authenticate failure")
return nil, status.Error(codes.Unauthenticated, err.Error())
Copy link
Member

Choose a reason for hiding this comment

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

Not returning the error is intentional to avoid leaking sensitive info to unauthenticated callers

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the test, i can restore it too

@hzxuzhonghu
Copy link
Member Author

@howardjohn ptaL

@howardjohn howardjohn added the do-not-merge/hold Block automatic merging of a PR. label Jun 20, 2023
Copy link
Member

@howardjohn howardjohn left a comment

Choose a reason for hiding this comment

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

LGTM aside from metric. Can you fix and remove hold?

// Authenticate authenticates the ADS request using the configured authenticators.
// Returns the validated principals or an error.
// If no authenticators are configured, or if the request is on a non-secure
// stream ( 15010 ) - returns an empty list of principals and no errors.
Copy link
Member

Choose a reason for hiding this comment

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

nit: "empty list of principals" should be updated, its now a nil struct

caller := am.Authenticate(ctx)
if caller == nil {
serverCaLog.Errorf("Failed to authenticate client from %s: %s", peerAddr, am.FailedMessages())
s.monitoring.AuthnError.Increment()
Copy link
Member

Choose a reason for hiding this comment

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

seems we lost this?

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch

@hzxuzhonghu hzxuzhonghu removed the do-not-merge/hold Block automatic merging of a PR. label Jun 21, 2023
@istio-testing istio-testing merged commit 314baf1 into istio:master Jun 21, 2023
@hzxuzhonghu hzxuzhonghu deleted the unify-authn branch June 25, 2023 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes-none Indicates a PR that does not require release notes. 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

4 participants