dnsproxy icon indicating copy to clipboard operation
dnsproxy copied to clipboard

How to customize sni/host/ip

Open f4nff opened this issue 3 years ago • 12 comments

curl --connect-to www.baidu.com:443:[2001:4860:4860::8888]:443 -k -H "accept: application/dns-json" -H "Host: dns.google" "https://www.baidu.com:443/resolve?name=cloudflare.com&type=A"

I want to customize sni, host, ip separately, how do I do it?

f4nff avatar Jun 02 '21 09:06 f4nff

There's no functionality for that in dnsproxy

ameshkov avatar Jun 02 '21 10:06 ameshkov

I hope dnsproxy will add such a function, customize sni/host/ip

f4nff avatar Jun 02 '21 10:06 f4nff

You know what, I think there's a way after all.

Create a DNS stamp: https://dnscrypt.info/stamps

  1. Choose DNS-over-HTTPS
  2. Enter the hostname
  3. Enter the IP address you want to use
  4. Run dnsproxy with --insecure flag
  5. Run dnsproxy with that DNS stamp.

Here's an example of such a stamp: sdns://AgcAAAAAAAAABzguOC44LjgADXJhbmRvbS5kb21haW4KL2Rucy1xdWVyeQ (examine it on dnscrypt.info to see what's inside)

./dnsproxy -u sdns://AgcAAAAAAAAABzguOC44LjgADXJhbmRvbS5kb21haW4KL2Rucy1xdWVyeQ --insecure

ameshkov avatar Jun 02 '21 10:06 ameshkov

Only sni+host can be customized, and sni host cannot be separated independently.

f4nff avatar Jun 02 '21 10:06 f4nff

I have tested, sni/host/ip:port Are three independent variables,

f4nff avatar Jun 02 '21 10:06 f4nff

Only sni+host can be customized, and sni host cannot be separated independently.

DNS stamp allows you to configure all three: image

ameshkov avatar Jun 02 '21 10:06 ameshkov

stamp Only host+sni can be set, host and sni set the same value, and cannot be set independently

f4nff avatar Jun 02 '21 13:06 f4nff

sni is the identification code of the tls handshake, host is the host value of the http protocol ip is the connection address, The three values are different.

stamp Only host=sni can be set, and host and sni cannot be set separately.

f4nff avatar Jun 02 '21 13:06 f4nff

Yeah, I see. You're right, host+sni would be the same.

ameshkov avatar Jun 02 '21 13:06 ameshkov

Because in some places, such as the firewall of China, sni will block dns.google, so you can use a specific sni to evade the firewall

f4nff avatar Jun 02 '21 13:06 f4nff

  • Option to send no SNI indication to better counter censorship

this repo can disable SNI indication: https://github.com/compassd/dcompass

honwen avatar Jun 08 '21 14:06 honwen

@honwen

sni host ip:port can be customized separately to make sense.

f4nff avatar Sep 02 '21 14:09 f4nff