I am using the Rust's tonic library for GRPC with TLS.
I get the following error
thread 'main' panicked at 'Failed to create request insight client: tonic::transport::Error(Transport,
hyper::Error(Connect, Custom { kind: InvalidData, error: InvalidCertificate(NotValidForName) }))'
The same certificate works for other languages.
curl --cacert <path to cert> -vv <server>
shows the expected certificate subject name.
This is how the ClientTlsConfig
and Channel
is created:
let tls = ClientTlsConfig::new()
.domain_name("server") // <server> matches the certificate subject name
.ca_certificate(Certificate::from_pem(client_ca_data));
let channel = Channel::from_shared(endpoint.to_string()) // endpoint is http://server:50051
.unwrap()
.tls_config(tls_config)?
.connect()
.await?;
It is not clear what the next steps are.