One of the vexing things about Java is that it uses its own cacerts trust store when the OS has its own updated and configurable trust store. In Windows, there’s a solution. Add a flag to set a system property
-Djavax.net.ssl.trustStoreType=Windows-ROOT
Linux folks? There actually is a way to use the OS trust store. It’s just not so clear and easy. There is a package which uses the system CA store as the source of truth and creates a hook to regenerate the JDK’s cacerts from it whenever the system bundle is rebuilt. The JDK’s cacerts path is a symlink into the generated file, so Java reads whatever the last rebuild produced. Nothing syncs continuously. The sync happens only when the rebuild command runs.
Debian/Ubuntu
- Source:
/usr/local/share/ca-certificates/*.crt(your additions) plus the packaged roots in/usr/share/ca-certificates/. - Rebuild:
update-ca-certificatescombines these into/etc/ssl/certs/ca-certificates.crtand runs the hooks in/etc/ca-certificates/update.d/. - Java hook: the
ca-certificates-javapackage installs a hook that uses the JDK’skeytoolto build/etc/ssl/certs/java/cacertsfrom the system bundle. - Link: the JDK’s
lib/security/cacertsis managed byupdate-alternativesand points to/etc/ssl/certs/java/cacerts. - Triggers: running
update-ca-certificates(manually, or by package install/upgrade or your config management), and installing or upgradingca-certificates-java.
RHEL/Fedora/CentOS
- Source:
/etc/pki/ca-trust/source/anchors/(your additions), plus vendor anchors in/usr/share/pki/ca-trust-source/. - Rebuild:
update-ca-trust extractuses p11-kit to generate bundles under/etc/pki/ca-trust/extracted/, including ajava/cacertsfile. - Link:
/etc/pki/java/cacertspoints to the generatedextracted/java/cacerts, and the JDK’scacertslinks to that. - Triggers: running
update-ca-trust(manually, or by RPM scriptlets when theca-certificatespackage updates).

