mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 14:10:49 -05:00
Add floci.tls.extra-ca-path (FLOCI_TLS_EXTRA_CA_PATH): a PEM file of CA certificates that Floci's own outbound HTTPS clients trust on top of the JVM's default roots, and Floci's CA when TLS is on. It applies whether or not TLS is enabled. ContainerCaBundle.sslContext(config) merges the extra CAs and is now also built with TLS off. floci-ca-bundle.pem and its .p12 are unchanged, so containers Floci launches are unaffected in both modes. EventBridge API destination delivery uses the context, and JwtSignatureVerifier already shares it, so HTTP API JWT authorizers and AppSync OIDC providers trust the extra CAs too. TlsExtraCaStartupValidator refuses to start when the file is missing, unreadable, or holds no certificate, from any config source. A private key in the file is ignored. Closes #5259 With floci.tls.extra-ca-path set and TLS on, a bundle that could not be read or parsed made outboundTrustAnchors throw. sslContext(config) then logged the extra CA file as the unreadable one, fell back to the bundle alone, failed on it again and returned empty, so the valid extra CAs were dropped. The bundle is now read on its own: on failure Floci warns with the bundle's path and trusts the JVM roots plus the extra CAs, as the sslContext(config) Javadoc already describes. ContainerCaBundle builds every SSL context and trust manager array from a KeyStore, so sslContext(Path), trustManagers(Path) and the extra-CA context no longer repeat the JCA calls. Tests share LocalHttpsServer in testing for the localhost HTTPS server issued by a CA, the two JWT issuer-trust cases share one helper, and the JVM roots check in ContainerCaBundleTest is written once. outboundTrustAnchors and trustStore(Path) now read a certificate file through one method, which also refuses a file with no certificate. In the tests added for the extra CA file, the certificate-and-key file comes from one helper in TlsTestSupport, the two missing-file cases are one parameterized test, and the refused EventBridge delivery is checked by one helper. TlsExtraCaStartupValidator now calls ContainerCaBundle.certificates instead of reading the file and checking for a certificate on its own. outboundTrustAnchors reads the bundle through the same method, and ContainerCaBundle.extraCaFile is the one place that decides whether the setting is set, for both the SSL context and the startup check. The startup message still names the path and gives the reason. Both EventBridgeInvoker constructors now get the API destination HttpClient from one method, which adds Floci's outbound SSL context when there is one.