Skip to content

implement trusting a CA bundle #14609

Closed

Description

@ReToCode

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

Activity

  1. converted this from a draft issue on Nov 10, 2023
  2. ReToCode commented on Nov 10, 2023

    @ReToCode
    ContributorAuthor
  3. ReToCode commented on Nov 24, 2023

    @ReToCode
    ContributorAuthor

    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.

  4. self-assigned this
    on Dec 5, 2023
  5. moved this to In Progress in Serving Encryptionon Dec 5, 2023
  6. changed the title [-]implement trust-manager integration[/-] [+]implement trusting a CA bundle[/+] on Dec 14, 2023
  7. added this to the v1.14.0 milestone on Jan 30, 2024
  8. moved this from In Progress to Done in Serving Encryptionon Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions