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

invalid dnsname #84

Closed
IThawk opened this issue Oct 11, 2019 · 8 comments
Closed

invalid dnsname #84

IThawk opened this issue Oct 11, 2019 · 8 comments

Comments

@IThawk
Copy link

IThawk commented Oct 11, 2019

use this example:
Starting to serve on https://127.0.0.1:1337.
[!] Voluntary server halt due to client-connection error...
FAILED: run errorerror trying to connect: invalid dnsname

@IThawk
Copy link
Author

IThawk commented Oct 11, 2019

let path = "D:\\workSpace\\myrust\\rust-demo\\web_tcp\\config\\sample.pem";
let f = fs::File::open(path)
    .map_err(|e| error(format!("failed to open {}: {}", path, e)))?;
let rds = io::BufReader::new(f);
let mut ca = Some(rds);
// Prepare the HTTPS connector.
println!("读取证书完成");
let https = match ca {
    Some(ref mut rd) => {
        // Build an HTTP connector which supports HTTPS too.
        let mut http = client::HttpConnector::new(4);
        http.enforce_http(false);
        // Build a TLS client, using the custom CA store for lookups.
        let mut tls = rustls::ClientConfig::new();
        tls.root_store
            .add_pem_file(rd)
            .map_err(|_| error("failed to load custom CA store".into()))?;
        // Join the above part into an HTTPS connector.
        hyper_rustls::HttpsConnector::from((http, tls))
    }
    // Default HTTPS connector.

    None => {
        println!("证书有问题!");
        hyper_rustls::HttpsConnector::new(4)
    }
};

@ctz
Copy link
Member

ctz commented Nov 7, 2019

The destination must be a hostname, not an IP address. Connecting via an IP address isn't supported currently in the rustls or webpki crates.

@ctz ctz closed this as completed Nov 7, 2019
@mcobzarenco
Copy link

This seem a pretty major limitation of rustls IMO 😞

@ufoscout
Copy link

@ctz I guess this issue should be kept open to track the possible resolution of the problem.
In a project of my company, we had to move from rustls to openssl due to this. We would be happy to switch back to rustls when this is solved.

@lucab
Copy link
Contributor

lucab commented Jul 16, 2020

@ufoscout see #56.

jgrund added a commit to whamcloud/integrated-manager-for-lustre that referenced this issue Oct 2, 2020
Due to rustls/hyper-rustls#84 and the fact that
we may use ip addresses for this endpoint, we need to switch the
wbem-client back to using openssl.

Signed-off-by: Joe Grund <jgrund@whamcloud.io>
jgrund added a commit to whamcloud/integrated-manager-for-lustre that referenced this issue Oct 2, 2020
Due to rustls/hyper-rustls#84 and the fact that
we may use ip addresses for this endpoint, we need to switch the
wbem-client back to using openssl.

Signed-off-by: Joe Grund <jgrund@whamcloud.io>
@oxlade39
Copy link

oxlade39 commented Mar 4, 2022

I came across this when using rustls + hyper-rustls + hyper-proxy. I think I'm getting this error because the proxy is an IP address.

I'm not sure how to proceed here, it seems a fundamental blocker that the address must be a hostname.
Why's this been closed?

@djc
Copy link
Member

djc commented Mar 4, 2022

Because it is tracked in #56.

@oxlade39
Copy link

oxlade39 commented Mar 4, 2022

Because it is tracked in #56.

Thank you. I didn't see that.

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

7 participants