[GH-ISSUE #1412] bad dns_name: 1.1.1.1 #666

Closed
opened 2026-03-15 23:44:30 +03:00 by kerem · 11 comments
Owner

Originally created by @onoketa on GitHub (Mar 14, 2021).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/1412

Describe the bug
bad dns_name: 1.1.1.1 when using 1.1.1.1 as tls_dns_name in ResolverConfig

To Reproduce

let mut resolver = ResolverConfig::new();
				resolver.add_name_server(NameServerConfig {
					//...
					protocol: trust_dns_resolver::config::Protocol::Https,
					tls_dns_name: Some("1.1.1.1".to_string()),
					//...
					//...
				});

Expected behavior
https://1.1.1.1/dns-query is a valid DoH service so it should not be a bad dns name

System:

  • OS: Arch Linux
  • Architecture: x86_64
  • Version 5.10.23
  • rustc version: 1.48.0

Version:
Crate: resolver
Version: 0.20

Originally created by @onoketa on GitHub (Mar 14, 2021). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/1412 **Describe the bug** ```bad dns_name: 1.1.1.1 ``` when using 1.1.1.1 as ```tls_dns_name``` in ```ResolverConfig``` **To Reproduce** ```rust let mut resolver = ResolverConfig::new(); resolver.add_name_server(NameServerConfig { //... protocol: trust_dns_resolver::config::Protocol::Https, tls_dns_name: Some("1.1.1.1".to_string()), //... //... }); ``` **Expected behavior** ```https://1.1.1.1/dns-query``` is a valid DoH service so it should not be a bad dns name **System:** - OS: Arch Linux - Architecture: x86_64 - Version 5.10.23 - rustc version: 1.48.0 **Version:** Crate: resolver Version: 0.20
Author
Owner

@djc commented on GitHub (Mar 14, 2021):

The rustls stack doesn't support connecting to IP addresses over TLS. You can use the domain name or switch to native-tls via the relevant feature flags.

<!-- gh-comment-id:798940774 --> @djc commented on GitHub (Mar 14, 2021): The rustls stack doesn't support connecting to IP addresses over TLS. You can use the domain name or switch to native-tls via the relevant feature flags.
Author
Owner

@bluejekyll commented on GitHub (Mar 14, 2021):

Additionally, I don't believe that is the correct SNI for Cloudflare, which I'm nearly certain is cloudflare-dns.com. For ease of use you can just use the Cloudflare configs baked in: ResolverConfig::cloudflare_https.

<!-- gh-comment-id:798997526 --> @bluejekyll commented on GitHub (Mar 14, 2021): Additionally, I don't believe that is the correct SNI for Cloudflare, which I'm nearly certain is `cloudflare-dns.com`. For ease of use you can just use the Cloudflare configs baked in: `ResolverConfig::cloudflare_https`.
Author
Owner

@onoketa commented on GitHub (Mar 15, 2021):

Additionally, I don't believe that is the correct SNI for Cloudflare, which I'm nearly certain is cloudflare-dns.com. For ease of use you can just use the Cloudflare configs baked in: ResolverConfig::cloudflare_https.

When you connect with 1.1.1.1 there is no SNI in client hello. In China, connecting to 1.1.1.1 with SNI 'cloudflare-dns.com' is blocked by the Great Firewall. It will be helpful if connecting without SNI is supported in trust-dns's DNS over HTTPS resolver.

<!-- gh-comment-id:799228861 --> @onoketa commented on GitHub (Mar 15, 2021): > Additionally, I don't believe that is the correct SNI for Cloudflare, which I'm nearly certain is `cloudflare-dns.com`. For ease of use you can just use the Cloudflare configs baked in: `ResolverConfig::cloudflare_https`. When you connect with 1.1.1.1 there is no SNI in client hello. In China, connecting to 1.1.1.1 with SNI 'cloudflare-dns.com' is blocked by the Great Firewall. It will be helpful if connecting without SNI is supported in trust-dns's DNS over HTTPS resolver.
Author
Owner

@djc commented on GitHub (Mar 15, 2021):

As I mentioned, I think this would work with the openssl or native-tls support already available in the resolver crate. You just have to configure it using the crate's Cargo features.

<!-- gh-comment-id:799230241 --> @djc commented on GitHub (Mar 15, 2021): As I mentioned, I think this would work with the openssl or native-tls support already available in the resolver crate. You just have to configure it using the crate's Cargo features.
Author
Owner

@onoketa commented on GitHub (Mar 15, 2021):

As I mentioned, I think this would work with the openssl or native-tls support already available in the resolver crate. You just have to configure it using the crate's Cargo features.

DNS over HTTPS resolver has only rustls support.

<!-- gh-comment-id:799231505 --> @onoketa commented on GitHub (Mar 15, 2021): > As I mentioned, I think this would work with the openssl or native-tls support already available in the resolver crate. You just have to configure it using the crate's Cargo features. DNS over HTTPS resolver has only rustls support.
Author
Owner

@djc commented on GitHub (Mar 15, 2021):

Ah, sorry, I missed that. Maybe we could have an tls_enable_sni option for NameServerConfig (conditional on rustls features) to the https::HttpsClientStreamBuilder (and probably also the dns_over_rustls stream builder) which can propagate the flag into the rustls ClientConfig. @bluejekyll what do you think?

<!-- gh-comment-id:799239358 --> @djc commented on GitHub (Mar 15, 2021): Ah, sorry, I missed that. Maybe we could have an `tls_enable_sni` option for `NameServerConfig` (conditional on `rustls` features) to the `https::HttpsClientStreamBuilder` (and probably also the `dns_over_rustls` stream builder) which can propagate the flag into the rustls `ClientConfig`. @bluejekyll what do you think?
Author
Owner

@bluejekyll commented on GitHub (Mar 15, 2021):

I think that sounds fine. We could always add OpenSSL/NativeTLS support, though I've been thinking of dropping OpenSSL and leaning more on Rustls/ring in the long run, I just never got around to it myself.

I'm forgetting about SNI right now in terms of security in TLS. Does SNI add any security to the protocol, or is it purely for server-side multi-homing?

<!-- gh-comment-id:799740890 --> @bluejekyll commented on GitHub (Mar 15, 2021): I think that sounds fine. We could always add OpenSSL/NativeTLS support, though I've been thinking of dropping OpenSSL and leaning more on Rustls/ring in the long run, I just never got around to it myself. I'm forgetting about SNI right now in terms of security in TLS. Does SNI add any security to the protocol, or is it purely for server-side multi-homing?
Author
Owner

@djc commented on GitHub (Mar 15, 2021):

I don't think SNI is important for security.

<!-- gh-comment-id:799752320 --> @djc commented on GitHub (Mar 15, 2021): I don't think SNI is important for security.
Author
Owner

@trinity-1686a commented on GitHub (Apr 19, 2021):

Does SNI add any security to the protocol

Some would argue that SNI decrease security as it leaks information on the service being reached, creating the need for something like Encrypted SNI.

<!-- gh-comment-id:822120634 --> @trinity-1686a commented on GitHub (Apr 19, 2021): > Does SNI add any security to the protocol Some would argue that SNI decrease security as it leaks information on the service being reached, creating the need for something like [Encrypted SNI](https://tools.ietf.org/html/draft-ietf-tls-esni-10).
Author
Owner

@djc commented on GitHub (Nov 1, 2022):

Yes, it looks like DNS over HTTPS is currently only supported with rustls. If you want, consider submitting a PR to add a dns-over-https-native-tls feature (which probably wouldn't be very hard, mostly just a bunch of copy and pasting from the dns-over-https-rustls code -- though of course we'd prefer to abstract over the difference instead of outright copying where possible).

(As a rustls co-maintainer, rustls is likely to have support for IP address in certificates by the end of January.)

<!-- gh-comment-id:1298713216 --> @djc commented on GitHub (Nov 1, 2022): Yes, it looks like DNS over HTTPS is currently only supported with rustls. If you want, consider submitting a PR to add a `dns-over-https-native-tls` feature (which probably wouldn't be very hard, mostly just a bunch of copy and pasting from the `dns-over-https-rustls` code -- though of course we'd prefer to abstract over the difference instead of outright copying where possible). (As a rustls co-maintainer, rustls is likely to have support for IP address in certificates by the end of January.)
Author
Owner

@djc commented on GitHub (May 30, 2023):

For people following along here, the trust-dns 0.23.0-alpha.1 release depends on the new rustls release and should support connecting to IP addresses.

<!-- gh-comment-id:1567921642 --> @djc commented on GitHub (May 30, 2023): For people following along here, the trust-dns 0.23.0-alpha.1 release depends on the new rustls release and should support connecting to IP addresses.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#666
No description provided.