Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Add fix for when we need to use the system-wide trusted CAs#459

Merged
andrewstucki merged 2 commits intomainfrom
system-ca-fix
Nov 18, 2022
Merged

Add fix for when we need to use the system-wide trusted CAs#459
andrewstucki merged 2 commits intomainfrom
system-ca-fix

Conversation

@andrewstucki
Copy link
Copy Markdown
Contributor

@andrewstucki andrewstucki commented Nov 18, 2022

Changes proposed in this PR:

This adds the simplest path for supporting the helm option externalServer.useSystemRoots. Since the controller always passes in a value to the deployment via CONSUL_CACERT when the controller knows that the Consul connections are served over TLS, we leverage the fact that it's going to write an empty file to disk that the deployment will then try and use as a file.

Rather than doing a larger re-write of the deployment code to handle cases in which TLS is configured but no certs are passed in (when you want to validate with system-wide certs), I added some code that handles the invalid certificates being passed in, in which case we just fallback to using the system-wide certs. What this entails is:

  1. Ensuring that the file passed in CONSUL_CACERT is valid.
  2. If it isn't, unsetting it but flagging that CONSUL_USE_SSL is set to mark that this still needs to talk over SSL
  3. Passing this info down to our envoy process manager so that it knows to bootstrap envoy with the proper paths for verifying the Consul SSL connection (i.e. the path to the envoy container's system roots)

How I've tested this PR:

Verified this on HCP with useSystemRoots, with a local consul server node and the self-signed certs that go with it, and with a local node and TLS disabled. These were validated with the changes in hashicorp/consul-k8s#1743.

Checklist:

  • Tests added
  • CHANGELOG entry added

    Run make changelog-entry for guidance in authoring a changelog entry, and
    commit the resulting file, which should have a name matching your PR number.
    Entries should use imperative present tense (e.g. Add support for...)

@andrewstucki andrewstucki requested a review from a team November 18, 2022 19:40
Copy link
Copy Markdown
Contributor

@t-eckert t-eckert 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 a great workaround!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backport/0.5.x pr/conformance Run conformance tests from kubernetes-sigs/gateway-api

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants