Cosmos DB SDK behind a TLS-inspecting proxy: strict certificate validation with private endpoint DNS
0 reputation · 20 Oct 2020, 21:48 UTC
0 reputation · 20 Oct 2020, 21:48 UTC
We run the Azure Cosmos DB SDK (Java and .NET clients) behind a corporate egress proxy that re-terminates TLS, and we also use a private endpoint for the account. The goal is to keep strict certificate validation enabled end to end while DNS resolution and the proxy's certificate chain both behave correctly, including during regional failover.
With the private endpoint, the account name must resolve through the privatelink DNS zone rather than to public IPs, and our custom DNS forwarders are shared with other workloads. Separately, the proxy presents its own chain to clients, so the SDKs fail validation unless the proxy root CA is in the client trust store. We do not want to disable validation or trust all certificates. We are also unsure how JVM and OS DNS caching interact with Cosmos DB endpoint changes after failover, and whether our SDK version still does any certificate pinning that would conflict with the proxy chain.
32275 reputation · 21 Oct 2020, 09:13 UTC
Keep strict validation by trusting the proxy’s root CA in the client trust store, bypass TLS inspection for the Cosmos DB privatelink name, and point DNS to a private zone that forwards account.documents.azure.com to the privatelink zone. Set a short JVM address cache TTL (≈30 s) and rely on the OS resolver’s default TTL so clients re‑resolve quickly after a regional failover.
The Cosmos DB Java and .NET SDKs do not perform certificate pinning; they validate the server certificate against the default trust store. When a corporate proxy re‑terminates TLS, it presents its own chain, causing validation failures unless the proxy’s root CA is trusted. The proxy can be configured to skip decryption for specific hostnames (SNI‑based bypass) so the original server chain is seen, preserving end‑to‑end validation without importing the CA. For private endpoints, the account name must resolve to the *.privatelink.documents.azure.com zone; otherwise clients reach public IPs and bypass the private link. DNS caching controls how fast clients pick up a new regional endpoint after failover.
-Djavax.net.ssl.trustStore) or the OS trust store (Windows/macOS/Linux) for validation.networkaddress.cache.ttl controls how long resolved addresses are cached; a value of 30 seconds forces a re‑lookup after roughly half a minute.*.privatelink.documents.azure.com.keytool -import -alias proxyca -file proxy-root.crt -keystore $JAVA_HOME/lib/security/cacertsprivatelink.documents.azure.com.account.documents.azure.com pointing to the private endpoint’s FQDN (<account>.privatelink.documents.azure.com).nslookup account.documents.azure.com from a client VM; the answer should be a private IP in the subnet’s address space.-Dnetworkaddress.cache.ttl=30 (or lower, e.g., 15, if failover detection must be faster).If the proxy cannot be configured for SNI‑based bypass, the only reliable path is to import the proxy’s root CA into every client trust store. Confirming whether your proxy supports hostname‑specific TLS decryption bypass will determine if the CA import step is required.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.