8000 xds: Only pass relevant TLS config for originating/terminating TLS by JamesLaverack · Pull Request #31903 · cilium/cilium · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

xds: Only pass relevant TLS config for originating/terminating TLS #31903

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

Merged
merged 3 commits into from
Apr 13, 2024

Conversation

JamesLaverack
Copy link
Member
@JamesLaverack JamesLaverack commented Apr 11, 2024

Please ensure your pull request adheres to the following guidelines:

  • For first time contributors, read Submitting a pull request
  • All code is covered by unit and/or runtime tests where feasible.
  • All commits contain a well written commit description including a title,
    description and a Fixes: #XXX line if the commit addresses a particular
    GitHub issue.
  • If your commit description contains a Fixes: <commit-id> tag, then
    please add the commit author[s] as reviewer[s] to this issue.
  • All commits are signed off. See the section Developer’s Certificate of Origin
  • Provide a title or release-note blurb suitable for the release notes.
  • Are you a user of Cilium? Please add yourself to the Users doc
  • Thanks for contributing!

See the release note for a summary of the change, and #31761 for discussion of the bug this fixes. A flag is provided for backwards compatibility, set to false for future versions of Cilium. The intent is to set this to true in backports, so as not to change behavior unexpectedly in a patch release.

Fixes: #31761

Only read the relevant parts of secrets for originatingTLS (ca.crt) and terminatingTLS (tls.crt, tls.key) blocks in Cilium L7 policies. Fixes a bug where a ca.crt key in a secret passed to terminatingTLS incorrectly configures Envoy to require a client certificate on TLS connections from pods. Previous behavior can be restored with the --use-full-tls-context=true agent flag.

@JamesLaverack JamesLaverack requested a review from a team as a code owner April 11, 2024 15:51
@JamesLaverack JamesLaverack requested a review from sayboras April 11, 2024 15:51
@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Apr 11, 2024
@github-actions github-actions bot added the kind/community-contribution This was a contribution made by a community member. label Apr 11, 2024
This is to simply rename getCiliumTLSContext function to pave the way
for subsequent changes.

Signed-off-by: James Laverack <james@isovalent.com>
@sayboras sayboras added the release-note/bug This PR fixes an issue in a previous release of Cilium. label Apr 12, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Apr 12, 2024
@sayboras sayboras force-pushed the pr/jameslaverack/fix-31761 branch from 0008cc0 to 57ed685 Compare April 12, 2024 10:34
@sayboras sayboras changed the title Only pass relevant keys to Envoy TLS configuation in L7 Cilium Policy xds: Add flag to load full TLS context (including CA) Apr 12, 2024
@sayboras sayboras force-pushed the pr/jameslaverack/fix-31761 branch from 57ed685 to a9ea5ed Compare April 12, 2024 11:01
@JamesLaverack JamesLaverack requested a review from a team as a code owner April 12, 2024 11:01 8000
@JamesLaverack JamesLaverack requested a review from qmonnet April 12, 2024 11:01
@sayboras sayboras added affects/v1.14 This issue affects v1.14 branch affects/v1.15 This issue affects v1.15 branch backport/author The backport will be carried out by the author of the PR. labels Apr 12, 2024
@sayboras
Copy link
Member

/test

@sayboras sayboras force-pushed the pr/jameslaverack/fix-31761 branch from a9ea5ed to 88acbe6 Compare April 12, 2024 11:10
@sayboras
Copy link
Member

/test

Previously, this test incorrectly tested tls key and cert behaviour on
an originatingTLS config, but this should be used on a terminatingTLS
context.

Both contexts are converted the same way, so the test didn't fail
before.

Signed-off-by: James Laverack <james@isovalent.com>
@JamesLaverack JamesLaverack force-pushed the pr/jameslaverack/fix-31761 branch from 88acbe6 to cbe2bbc Compare April 12, 2024 13:26
@sayboras
Copy link
Member

/test

@sayboras sayboras changed the title xds: Add flag to load full TLS context (including CA) xds: Only pass relevant TLS config for originating/terminating TLS Apr 12, 2024
Copy link
Member
@qmonnet qmonnet 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 to me, thank you

Previously, the secrets were scanned for keys named 'ca.crt', 'tls.crt',
and 'tls.key'. However 'ca.crt' is only relevant for terminatingTLS and
'tls.crt'/'tls.key' only for originatingTLS. By including all three keys
in both the originating and terminating blocks, we can incorrectly pass
extra configuration to Envoy.

The result of this is that if a 'ca.crt' key is present in the secret
passed to terminatingTLS, then Envoy will be mistakenly configured with
a CA certificate and will then expect signed client certificates to be
passed from clients (i.e., Pods).

Along with a by-default fix, add --use-full-tls-context to the agent.
When set, this will force the agent's XDS server into the old incorrect
behaviour for Envoy TLS configuration. This is provided as an 'escape
hatch' for users that might be depending on the existing incorrect
behaviour. This flag may be removed in future releases.

Fixes: cilium#31761

Signed-off-by: James Laverack <james@isovalent.com>
@JamesLaverack JamesLaverack force-pushed the pr/jameslaverack/fix-31761 branch from cbe2bbc to e7115ac Compare April 12, 2024 14:07
@sayboras
Copy link
Member

/test

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Apr 13, 2024
@sayboras sayboras added this pull request to the merge queue Apr 13, 2024
Merged via the queue into cilium:main with commit 926adfb Apr 13, 2024
@jrajahalme
Copy link
Member

@JamesLaverack With the new behavior it is impossible to configure a case where client certificates are needed. Do we think that we'll never need to support TLS interception case where the final server requires the use of client certificate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects/v1.14 This issue affects v1.14 branch affects/v1.15 This issue affects v1.15 branch backport/author The backport will be carried out by the author of the PR. kind/community-contribution This was a contribution made by a community member. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/bug This PR fixes an issue in a previous release of Cilium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pod connection failures using L7 policy with terminatingTLS if ca.crt is present in the secret
4 participants
0