Interview Prep/DevSecOps/Certificates, TLS and security incident response

A Java service fails with `PKIX path building failed: unable to find valid certification path to requested target` right after the internal CA was rotated

IntermediateTroubleshootingCertificates, TLS and security incident response
Answer

Likely causes → The JVM uses its own truststore ($JAVA_HOME/lib/security/cacerts or a custom -Djavax.net.ssl.trustStore), not the OS bundle. The new root or intermediate was never imported.

Diagnose →

kubectl exec deploy/orders -- sh -c 'keytool -list -cacerts -storepass changeit | grep -i acme'
kubectl exec deploy/orders -- sh -c 'echo $JAVA_TOOL_OPTIONS'

Fix →

keytool -importcert -cacerts -storepass changeit -noprompt -alias acme-root-2026 -file acme-root-2026.crt

Do this in the image build, or mount a managed truststore.

Prevent → Rotate CAs with overlap: publish the new root to every truststore weeks before the switch and keep the old one until all leaf certificates have moved.

All DevSecOps questions

More on Certificates, TLS and security incident response