-
Notifications
You must be signed in to change notification settings - Fork 12
Description
The CA certificates provides at runtime via the /platform/bindings folder are not added to the JVM truststore at the startup of the image. Only the CA certificates provided at build time are embedded and added.
Expected Behavior
The CA certificates provided at runtime via the /platform/bindings folder (containing the .pem file and the type file)
should be added to the JVM truststore as well as to the system truststore.
Current Behavior
The JVM truststore contains only the default JRE CA certificates plus the CA certificates embedded at build time.
Possible Solution
At runtime, launch a copy (or a link) of the .pem files from the bindings folder to the ca-certificate buildpack folder (/layers/paketo-buildpacks_ca-certificates/ca-certificates/ca-certificates).
Can also do the same into the folder /etc/pki/ca-trust/source/anchors for the system truststore
and then run the linux command : update-ca-trust
Steps to Reproduce
- Build an image with Java with options :
- BP_EMBED_CERTS set to true
- SERVICE_BINDING_ROOT set to /bindings
- mount a volume on /bindings containing
- folder ca-certificates containing :
- file : ca-certificate-1.pem
- file : type (containing text ca-certificates)
- folder ca-certificates containing :
- Run the generated image with :
- SERVICE_BINDING_ROOT set to /mnt/bindings
- mount a volume on /mnt/bindings containing
- folder ca-certificates containing :
- file : ca-certificate-2.pem
- file : type (containing text ca-certificates)
- folder ca-certificates containing :
The JVM truststore (cacerts file) should contain both ca-certificate-1 and ca-certificate-2
but only contains ca-certificate-1.
Motivations
The addition of a truststore at build time is needed (to add the corportate ca certificates) for external communications.
The addition of a truststore at runtime is needed because the kubernetes platform (openshift) provides dynamically the .pem file for re-encryption of the https communications (internal communications inside the cluster).
The openshift ca certificate is re-generated regularly
and just a restart of a pod is needed (not a rebuild of the image).