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

implement trusting a CA bundle #14609

Closed
4 tasks done
ReToCode opened this issue Nov 10, 2023 · 3 comments · Fixed by #14717
Closed
4 tasks done

implement trusting a CA bundle #14609

ReToCode opened this issue Nov 10, 2023 · 3 comments · Fixed by #14717
Assignees
Milestone

Comments

@ReToCode
Copy link
Member

ReToCode commented Nov 10, 2023

If we are using cert-manager, we currently build our trust on reading the ca.crt in the generated certificate's Secret to configure trust in:

  • activator
  • net-* implementation

Digging into the docs and asking our cert-manager team, they strongly recommend to use trust-manager to distribute a trust bundle decoupled from the actual secret generation. With that in place, it enables to rotate the CA without breaking the trust:

  1. The administrator, manually adds the old and new CA to the trust-bundle
  2. trust-manager distributes it to all workload
  3. The administrator updates the CA, all certificates are recreated when they are expired or when they are force-renewed
  4. The administrator removes the old CA from the trust-bundle

Note the relevant bits from the docs

Say you have a cert-manager Issuer which has the root certificate you want to trust in ca.crt. It's tempting to use the Secret directly and point at ca.crt, but a best practice would be to copy that root into a separate ConfigMap (or Secret). The reason is - as with many TLS gotchas - certificate rotation. If you rotate your issuer such that it's issued from a new root certificate, trust-manager will see the Secret be updated and automatically update your trust bundle to include the new root - immediately distrusting the old root. That means that if any services were still using a certificate issued by the old root, they'll be distrusted and will break.

To not limit the use to just trust-manager, we can use the API of a ConfigMap containing one or more PEM formatted certificates as trust-bundle sources. This also works with other approaches like OpenShift PKI or OpenShift Service Signer which have the same interface, see https://github.com/ReToCode/knative-encryption/blob/main/8-trust-sources/README.md. In the future we can also add https://github.com/kubernetes/enhancements/tree/master/keps/sig-auth/3257-cluster-trust-bundles as a possible extension or replacement.

Tasks

@ReToCode ReToCode converted this from a draft issue Nov 10, 2023
@ReToCode
Copy link
Member Author

/cc @skonto, @nak3, @KauzClay , @dprotaso , @pierDipi

@ReToCode
Copy link
Member Author

ReToCode commented Nov 24, 2023

Some initial investigation results here: https://github.com/ReToCode/knative-encryption/tree/main/8-trust-sources#trust-manager.

Having CA Bundles in a Configmap is pretty common. OpenShift also has solutions that work this way. All of them allow to add a custom label to filter on them. So it might be a good approach to not limit the implementation to trust-manager, but instead to just read Configmaps with a specific label having PEM based bundles in them.

@dprotaso
Copy link
Member

dprotaso commented Nov 24, 2023

@ReToCode ReToCode self-assigned this Dec 5, 2023
@ReToCode ReToCode moved this to In Progress in Serving Encryption Dec 5, 2023
@ReToCode ReToCode changed the title implement trust-manager integration implement trusting a CA bundle Dec 14, 2023
@pierDipi pierDipi removed this from Eventing TLS Jan 25, 2024
@ReToCode ReToCode added this to the v1.14.0 milestone Jan 30, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Serving Encryption Mar 8, 2024
mgencur added a commit to mgencur/serving-1 that referenced this issue May 30, 2024
This test relies on trusting certificates as described in
knative#14609
This is currently not implemented in net-istio, and it's tracked as
knative-extensions/net-istio#1328
knative-prow bot pushed a commit that referenced this issue May 30, 2024
This test relies on trusting certificates as described in
#14609
This is currently not implemented in net-istio, and it's tracked as
knative-extensions/net-istio#1328
ReToCode pushed a commit to ReToCode/serving that referenced this issue May 31, 2024
This test relies on trusting certificates as described in
knative#14609
This is currently not implemented in net-istio, and it's tracked as
knative-extensions/net-istio#1328

(cherry picked from commit f84265a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

2 participants