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

✨ Allow Use of Public CAs #1610

Merged
merged 1 commit into from
Jul 19, 2023

Conversation

spjmurray
Copy link
Contributor

As a public cloud operator it strikes me as odd that I have to supply a CA certificate for every cluster that's created. This leads to a bunch of code that has to Dial the endpoint and extract the root CA (rather than hard coding it - ugh!). The whole point of the distroless base container image is to distribute TLS root CAs, so allow the option to use what's already present.

What this PR does / why we need it:

As stated in the commit message.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
None

Special notes for your reviewer:

  1. Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

TODOs:

  • squashed commits
  • if necessary:
    • includes documentation
    • adds unit tests

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 14, 2023
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 14, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @spjmurray. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 14, 2023
@netlify
Copy link

netlify bot commented Jul 14, 2023

Deploy Preview for kubernetes-sigs-cluster-api-openstack ready!

Name Link
🔨 Latest commit 0249663
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-openstack/deploys/64b65ba7beeece0008e295f4
😎 Deploy Preview https://deploy-preview-1610--kubernetes-sigs-cluster-api-openstack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

pkg/scope/provider.go Outdated Show resolved Hide resolved
@spjmurray
Copy link
Contributor Author

Implementation note: I left the default behaviour as-is, so it doesn't work unless you provide a CA certificate... odd security posture that, if you want to force the use of a CA, have admission control do it.

Anyway, I wouldn't be averse to backing out 90% of the changes, making public CAs the default, and have the end user explicitly override for self-signed infra. Seems like the infinitely more useful way of doing it imo 🤷🏻

@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 18, 2023
@spjmurray
Copy link
Contributor Author

Ah, I see what I did wrong! Helm defaults injecting an invalid CA. Yeah, I'm going to take the KISS approach; use the system CAs if a cert if not explicitly specified. It's literally 2 lines then. If you want to enforce the specification of an exact CA then I can add some logic into the validating webhook.

As a public cloud operator it strikes me as odd that I have to supply a
CA certificate for every cluster that's created.  This leads to a bunch
of code that has to Dial the endpoint and extract the root CA (rather
than hard coding it - ugh!).  The whole point of the distroless base
container image is to distribute TLS root CAs, so allow the option to
use what's already present.
@mdbooth
Copy link
Contributor

mdbooth commented Jul 18, 2023

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 18, 2023
Copy link
Contributor

@mdbooth mdbooth left a comment

Choose a reason for hiding this comment

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

https://pkg.go.dev/crypto/tls#Config says:

// RootCAs defines the set of root certificate authorities
// that clients use when verifying server certificates.
// If RootCAs is nil, TLS uses the host's root CA set.
RootCAs *x509.CertPool

With this change RootCAs is nil unless cacerts is non-nil. Following cacerts up the chain of callers, it is also nil unless --ca-certs was given on the command line. IOW, I think this behaviour is probably what most folks would have expected it already does.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mdbooth, spjmurray

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 18, 2023
@jichenjc
Copy link
Contributor

/lgtm
/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 19, 2023
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 19, 2023
@k8s-ci-robot k8s-ci-robot merged commit 88a3a1d into kubernetes-sigs:main Jul 19, 2023
@spjmurray spjmurray deleted the system_ca_pool branch July 19, 2023 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants