feat: add caCertCredentialName to ClientTLSSettings for Gateway API mTLS - #3774
Open
ericdbishop wants to merge 1 commit into
Open
feat: add caCertCredentialName to ClientTLSSettings for Gateway API mTLS#3774ericdbishop wants to merge 1 commit into
ericdbishop wants to merge 1 commit into
Conversation
Signed-off-by: Eric Bishop <ericbish.dev@gmail.com>
|
😊 Welcome @ericdbishop! This is either your first contribution to the Istio api repo, or it's been You can learn more about the Istio working groups, Code of Conduct, and contribution guidelines Thanks for contributing! Courtesy of your friendly welcome wagon. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Mostly looking for initial feedback and discussion on this plan for implementing ClientAndServer TLS mode for XBackend, with this API change being a pre-requisite.
Will be accompanied by a PR for istio/istio#61403, and also relates to istio/istio#61515.
Proposing adding a
caCertCredentialNamefield to ClientTLSSettings, like the existingcaCertCredentialNameunder ServerTLSSettings #3544, for storing the CA trust bundle reference when using ClientAndServer TLS mode on XBackend, which frees upcredentialNameto store the XBackendclientCertificateRef.The logic used for configuring the
credentialNamefor XBackend ServerOnly mode (which is already implemented) is reused from BackendTLSPolicy; BackendTLSPolicy only uses SIMPLE TLS. Here is a scenario for establishing an mTLS connection which summarizes the current issue with implementing ClientAndServer TLS mode for XBackend:Client (Gateway) connects to server (represented by XBackend).
Server presents it's cert.
Client verifies the cert is signed by using it's own CA trust bundle (delivered by istiod via SDS, held in a K8s ConfigMap for XBackend).
Here we face a problem; istiod always derives the client's trust bundle name as
credentialName+ "-cacert". In the case of XBackend, that means we ignore the ConfigMap declared on the XBackend custom resource under tls.validation.caCertificateRefs.For the XBackend ServerOnly TLS mode (SIMPLE TLS), this is fine. We use ClientTLSSettings.credentialName to store the ConfigMap CA cert ref, since there is no client cert ref needed for ServerOnly mode with one-way TLS.
For ClientAndServer mode, however, there is no field in Istio's ClientTLSSettings to separately carry the client's CA certificate reference. The only relevant credential field in ClientTLSSettings is credentialName, which we must use to store the XBackend tls.clientCertificateRef (as it is a required field for ClientAndServer mode).
VerifiedCertificateReferences; this list includes the Gateway's server certificate refs as authorized resources, but not the XBackend clientCertificateRef.Since there is no Secret at <cert name> + "-cacert", we can't verify the server's cert. We fail here.
The server requests the client's cert (mTLS part).
Client presents it's cert (which was configured under tls.clientCertificateRef)
The server verifies the cert against it's own CA, which is configured on the backend pod itself or otherwise not our concern.