Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Etcd client connect return error when tls enabled #49

Open
haojinming opened this issue Dec 18, 2022 · 3 comments
Open

Etcd client connect return error when tls enabled #49

haojinming opened this issue Dec 18, 2022 · 3 comments

Comments

@haojinming
Copy link

haojinming commented Dec 18, 2022

The following code panic with error TransportError(tonic::transport::Error(Transport, hyper::Error(Connect, InvalidDNSNameError)))'

The config file is like this:

[pd]
endpoints = ["172.16.5.32:2379"]

[security]
ca-path = "~/ca/ca.cert.pem"
cert-path = "~/ca/client.cert.pem"
key-path = "~/client.key.pem"
 let mut option = ConnectOptions::new();
    if !config.security.ca_path.is_empty() {
        let (ca, cert, key) = config.security.load_certs().unwrap();
        option = option.with_tls(
            TlsOptions::new()
                .ca_certificate(Certificate::from_pem(ca))
                .identity(Identity::from_pem(cert, key)),
        );
    }
    let mut etcd_client = etcd_client::Client::connect(&config.pd.endpoints, Some(option))
        .await
        .unwrap();
@haojinming
Copy link
Author

Do I use the tls feature correctly? I don't see any example in the repo about tls usage.

@davidli2010
Copy link
Contributor

We just re-export TLS related structures and functions from tonic::transport. I think you'd better check your config according to the error InvalidDNSNameError.

@haojinming
Copy link
Author

Seems that TLS package etcd_client using does not support IP address as the endpoint. See issue: hyperium/tonic#279. The error is reported here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants