You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Enhance the generation and handling of keystore and truststore #312
There are various ways to inject keystore and truststore for the application. In some cases, some conflicts could prevent the application from working as expected. Re-evaluate the generation and handling of keystore and truststore and improve as possible.
I think I can see two issues with the trust store handling in docker-server.sh
The script uses 'keytool -import' to add certificates to the default trust store in 2 situations (ca.crt exists in /etc/x509/certs or SEC_IMPORT_K8S_CERTS=true). If there is an existing trust store, this command will fail, as the passwords won't match
If a trust store exists in the default location, then the script will add its own config to config overrides. If there was an existing trust store before the script ran, this config will cause a password mismatch, and an error on Liberty startup.
The fix for 2 is pretty simple (only add config if docker-server.sh created the truststore)
For 1, we need to decide what to do in the case of an existing trust store.
The docker-server.sh script shipped with Liberty does not import .crt files that are missing a newline at the end of the file in the /var/run/secrets/kubernetes.io/serviceaccount dir.
changed the title [-]Evaluate the generation and handling of keystore and truststore and improve as possible[/-][+]Enhance the generation and handling of keystore and truststore[/+]on May 6, 2024
Activity
leochr commentedon Nov 22, 2023
@idlewis please add your analysis of truststore handling in Liberty container here. Thank you
idlewis commentedon Nov 22, 2023
I think I can see two issues with the trust store handling in docker-server.sh
The fix for 2 is pretty simple (only add config if docker-server.sh created the truststore)
For 1, we need to decide what to do in the case of an existing trust store.
justin-fleming commentedon Feb 22, 2024
Summary
The
docker-server.shscript shipped with Liberty does not import .crt files that are missing a newline at the end of the file in the/var/run/secrets/kubernetes.io/serviceaccountdir.The problem is on this line where we are
cating *.crt and attempting to iterate over the certs to import them: https://github.com/OpenLiberty/ci.docker/blob/main/releases/latest/full/helpers/runtime/docker-server.sh#L62Steps to recreate
Setup:
thing1.crtandthing2.crtWithout newlines at the end of the cert files, no truststore is generated (even though the certs are mounted):
Created a configmap with the bad certs:
Created this deployment:
Check details in the running pod:
With newlines, the certs are imported into the truststore:
Delete & recreate the configmap with the 'good' certs and restart the app pod:
Check details in the new pod:
[-]Evaluate the generation and handling of keystore and truststore and improve as possible[/-][+]Enhance the generation and handling of keystore and truststore[/+]