[
https://issues.apache.org/jira/browse/HDDS-17882?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18148351#comment-18148351
]
Andrey Yarovoy commented on HDDS-17882:
---------------------------------------
does https://issues.apache.org/jira/browse/HDDS-16034 cover this issue as well?
> gRPC TLS fails on Kubernetes: Datanode certificates contain no DNS name for
> *.svc.cluster.local hosts, because DomainValidator rejects the .local TLD
> -----------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: HDDS-17882
> URL: https://issues.apache.org/jira/browse/HDDS-17882
> Project: Apache Ozone
> Issue Type: Bug
> Components: Security
> Affects Versions: 2.2.0
> Environment: *Kubernetes* (RKE2 1.32), cluster domain cluster.local,
> StatefulSets with headless Services, *ozone.security.enabled=true*
> (Kerberos/FreeIPA), *hdds.grpc.tls.enabled=true,
> dfs.datanode.use.datanode.hostname=true* (as set by the official Helm chart).
> Reporter: Fatih
> Priority: Major
>
> With gRPC TLS enabled on Kubernetes, clients can’t write data. Volume and
> bucket operations, which only go to OM, succeed. ozone sh key put fails when
> the client opens the Ratis/gRPC stream to the Datanode:
> {noformat}
> INFO client.ClientTrustManager
> (ClientTrustManager.java:checkServerTrusted(175)) - CheckServerTrusted call
> failed, trying to re-fetch rootCA certificate
> java.security.cert.CertificateException: No name matching
> ozone-datanode-0.ozone-datanode-headless.ns.svc.cluster.local found
> at
> java.base/sun.security.util.HostnameChecker.matchDNS(HostnameChecker.java:229)
> ...
> at
> org.apache.hadoop.hdds.scm.client.ClientTrustManager.checkServerTrusted(ClientTrustManager.java:173)
> at
> org.apache.ratis.thirdparty.io.netty.handler.ssl.EnhancingX509ExtendedTrustManager.checkServerTrusted(...)
> ...
> Caused by: javax.net.ssl.SSLHandshakeException: General OpenSslEngine problem
> {noformat}
> The Datanode certificate issued by the SCM CA has the pod IP as its only
> subject alternative name:
> {noformat}
> Owner: SERIALNUMBER=4, O=CID-…, OU=…,
> [email protected]
> SubjectAlternativeName [
> IPAddress: 10.42.3.38
> ]
> {noformat}
> When it builds its CSR, the Datanode logs:
> {noformat}
> ERROR utils.CertificateSignRequest
> (CertificateSignRequest.java:lambda$addInetAddresses$0(316)) - Invalid domain
> ozone-datanode-0.ozone-datanode-headless.ns.svc.cluster.local
> {noformat}
> *Cause* (Claude explanation)
> *CertificateSignRequest.Builder.addInetAddresses()* calls
> *addInetAddresses(HddsServerUtil.getValidInetsForCurrentHost(),
> DomainValidator.getInstance())*. For each address it adds the IP, and adds
> *getCanonicalHostName()* as a DNS SAN only if *DomainValidator.isValid()
> *accepts it. *DomainValidator.getInstance()* is created with *allowLocal =
> false*, so every name under the reserved *.local* TLD is rejected. Every
> Kubernetes pod FQDN ends in .*svc.cluster.local *by default, so on Kubernetes
> no Datanode certificate ever carries a DNS name.
> With *dfs.datanode.use.datanode.hostname=true* (needed on Kubernetes, where
> pod IPs change), clients connect to the Datanode’s host name. The standard
> X509 host‑name check (*X509TrustManagerImpl.checkIdentity*) then finds no
> matching DNS SAN and rejects the connection. No configuration option disables
> this check or the domain validation.
> OM and SCM certificates are built the same way, but the failure shows up on
> the client → Datanode path, the first TLS hop that verifies host names.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]