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

global ca-bundle #19744

Open
lknite opened this issue Oct 4, 2023 · 3 comments
Open

global ca-bundle #19744

lknite opened this issue Oct 4, 2023 · 3 comments
Assignees
Labels
feature-request on-hold Issues or Pull Requests with this label will never be considered stale
Projects

Comments

@lknite
Copy link
Contributor

lknite commented Oct 4, 2023

Name and Version

all

What is the problem this feature will solve?

In enterprise environments onprem certificates are necessary to perform man in the middle inspection.

These onprem certificates need to be added to each pod which needs to access a url.

As a workaround this can be accomplished with a configmap or secret which maps to /etc/ssl/certs/ca-certificates.crt . However there are complications, some base images with different os's requires the certs in a different location. Python wants certs in a different location, java based apps require 'keytool' to be used to generate certs in a particular format. Also, sometimes you need more than just the onprem certs, you need all the original certs plus the onprem certs, so you don't want to wipe them out, and sometimes trying to put all the existing certs + the onprem certs is too big for a configmap or secret.

A solution would be to standardize how to provide a ca-bundle to be implemented by an application in the values.yaml.

Implementation in general would result in an image-specific technique to add the specified onprem ca-bundle by splitting the multiple scripts up into individual .crt files, placing them into /user/local/share/ca-certificates and then importing them by running update-ca-certificates or update-ca-trust, whatever the os requires.

Splitting the file is as easy as running:
awk 'BEGIN {c=0;} /BEGIN CERT/{c++} { print > "cert." c ".pem"}' < ca-bundle.pem

The keycloak helm chart has a way of specifying a ca-bundle which is automatically imported, we just need to standardize where the ca-bundle is specified rather than have it in a different place unique in each chart. And also, pretty much every chart needs to implement this ability to have onprem certs imported.

What is the feature you are proposing to solve the problem?

global:
  imageRegistry: ""
  imagePullSecrets: []
  storageClass: ""
  # specify by providing the name of a secret and use all data as .crt files
  ca-bundle-secret: ca-bundle
  # or specify directly
  ca-bundle: |
    -----BEGIN CERTIFICATE-----
    MIIFrDCCBJSgAwIBAgIQCfluwpVVXyR0nq8eXc7UnTANBgkqhkiG9w0BAQwFADBh
    MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
    -----END CERTIFICATE-----
    -----BEGIN CERTIFICATE-----
    MIIFrDCCBJSgAwIBAgIQCfluwpVVXyR0nq8eXc7UnTANBgkqhkiG9w0BAQwFADBh
    MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
    -----END CERTIFICATE-----

What alternatives have you considered?

I've considered writing a controller to implement this functionality and looked for a k8s based solution. If implemented ClusterTrustBundles, a possible future feature of k8s, may help to add in ca-bundles.

Alternatively, if 'postStart' was added to all the deployments then a work around could be implemented as needed. However, since the technique needed can be different in different apps / images it'd be nice to not have to try and figure out what to do every time.

@lknite
Copy link
Contributor Author

lknite commented Oct 4, 2023

I created an initContainer which could be used as an example implementation, it would need to be altered for application / image specific requirements, but shows how it could pretty easily be implemented:
argoproj/argo-cd#7572 (comment)

This is using a PVC as a work around, but if the solution was provided by the helm chart it could be much much more simply implemented with a postStart or similar technique (no pvc needed).

This example also shows just how hard it is to create a work around when a helm chart lacks the needed template integrations.

@javsalgar javsalgar moved this from Triage to In progress in Support Oct 5, 2023
@github-actions github-actions bot added in-progress and removed triage Triage is needed labels Oct 5, 2023
@bitnami-bot bitnami-bot assigned fmulero and unassigned javsalgar Oct 5, 2023
@fmulero
Copy link
Collaborator

fmulero commented Oct 17, 2023

Hi @lknite, Thanks a lot for all the details.

The proposal is very interesting but there is a thing I don't fully understand. You mentioned that the solution could be simpler with a postStart but I don't see how it can be possible, as you mentioned, each app has its own way to set trusted certificates and the postStart hook could be "too late" to do it.

I'll open an internal task to analyse it. Please keep in mind that we are a small team that this task could require a lot of work so we can not provide any ETA. PRs are welcome and the Bitnami Team will be happy to review it.

@github-actions github-actions bot moved this from In progress to Pending in Support Oct 17, 2023
Copy link

github-actions bot commented Nov 2, 2023

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

@github-actions github-actions bot added the stale 15 days without activity label Nov 2, 2023
@fmulero fmulero moved this from Pending to On hold in Support Nov 6, 2023
@github-actions github-actions bot added on-hold Issues or Pull Requests with this label will never be considered stale and removed in-progress labels Nov 6, 2023
@fmulero fmulero removed the stale 15 days without activity label Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request on-hold Issues or Pull Requests with this label will never be considered stale
Projects
No open projects
Support
On hold
Development

No branches or pull requests

3 participants