The documentation for the Java Apache Arrow (v11.0.0) FlightClient.Builder has several methods related to constructing a TLS-enabled client:
clientCertificate(InputStream clientCertificate, InputStream clientKey)useTls()overrideHostname(String hostname)trustedCertificates(InputStream stream)verifyServer(boolean verifyServer)
The descriptions aren't detailed enough for me to understand which ones are needed to enable and use TLS in connections with a FlightServer. There could easily be some gap in my understanding of TLS that would help me more easily consume this documentation.
Do I need to use all of these? Are some of them redundant? How are they related?
I took a look at the code that implements this API for some insights.
useTlssimply tells the underlying client builder to start putting together SSL Context for the TLS-enabled client. The same effect is achieved by having thegrpc+tlsscheme attached to the location attribute.The rest of the options are used for adding to the SSL Context. The context builder is provided by
io.netty.handler.ssl.SslContextBuilder.clientCertificate(cert, key)adds the provided cert/key to the SSL Context's key manager.trustedCertificates(cert)adds the provided cert to the trust manager (for third party connection verification).verifyServer(bool)cannot befalseif either of the above two are provided, since they are required to verify the server. If this isfalse, the trust manager will simply be set up usingInsecureTrustManagerFactory.INSTANCE.overrideHostname(hostname)calls the underlyingoverrideAuthority()on the channel builder. This isn't really related to what I'm trying to do.Do I need to use all of these (ignoring
overrideHostname)? It depends on how the TLS is configured on the server the client will connect to.Are any of them redundant?
useTls()is redundant if thelocationattribute already has the TLS scheme attached.