MTProxy icon indicating copy to clipboard operation
MTProxy copied to clipboard

TLS-Mode

Open rlka opened this issue 7 years ago • 14 comments

Hello, can anyone explain what is TLS-Transport-Mode, why do we need it and how to use it?

rlka avatar Oct 09 '19 10:10 rlka

In short, your ISP sees the traffic as if you were visiting a site that is listed on the proxy server. Use the latest version of the server and add the flag -D www.google.com for example. Little instruction - https://github.com/TelegramMessenger/MTProxy/pull/335/files

hookzof avatar Oct 10 '19 14:10 hookzof

Yup, i red this already, still don't get it. domain must support TLS 1.3 - does it mean Your webserver must support TLS 1.3, or i totally misunderstood it? Right now i do not have any webserver configured on my MTProxy machine.

Let's say i'll install nginx with tls 1.3 support on port 443. From here i do not understand how should it work with MTProxy running on port 1082 together

That is why i need an explanation of this entire system.

ee + <secret> + <domain> (in hex format) - domain in HEX format? o_O Which port must be used to connect? Is selfsigned cert enough?

rlka avatar Oct 10 '19 15:10 rlka

You can put any domain with TLS 1.3 support. But of course, it is better to put behind your working domain and run proxy traffic on port 443. This can be done with NGINX settings (unfortunately, I won't tell you how), but you can also multiplex the connection from another port to 443 using SSLH.

The official version of MTProxy doesn't display a ready-made link for connection, so you can use the converter created specially for this purpose by one of the independent developers of the Erlang-version - http://seriyps.ru/mtpgen.html

Certificate can be made through Let's Encrypt

hookzof avatar Oct 10 '19 15:10 hookzof

For NGINX, try using this - https://github.com/alexbers/mtprotoproxy/issues/135#issuecomment-525046777

hookzof avatar Oct 10 '19 15:10 hookzof

I can't figure it out either. Is there some step by step instruction?

Right now I run proxy in "dd" mode. Let's say it responds on port 300. The startup command is: /opt/MTProxy/objs/bin/mtproto-proxy --ipv6 -u nobody -p 8888 -H 300 -S secret --aes-pwd /opt/MTProxy/proxy-secret /opt/MTProxy/proxy-multi.conf Clients connect to port 300 and key ddsecret and it works.

I restart the proxy with: /opt/MTProxy/objs/bin/mtproto-proxy --ipv6 -u nobody -p 8888 -H 300 -S secret --aes-pwd /opt/MTProxy/proxy-secret /opt/MTProxy/proxy-multi.conf -D google.com and change the key to: eesecret676f6f676c652e636f6d - and connection fails.

What do I do wrong?

SpcCw avatar Oct 15 '19 12:10 SpcCw

I can't figure it out either. Is there some step by step instruction?

Right now I run proxy in "dd" mode. Let's say it responds on port 300. The startup command is: /opt/MTProxy/objs/bin/mtproto-proxy --ipv6 -u nobody -p 8888 -H 300 -S secret --aes-pwd /opt/MTProxy/proxy-secret /opt/MTProxy/proxy-multi.conf Clients connect to port 300 and key ddsecret and it works.

I restart the proxy with: /opt/MTProxy/objs/bin/mtproto-proxy --ipv6 -u nobody -p 8888 -H 300 -S secret --aes-pwd /opt/MTProxy/proxy-secret /opt/MTProxy/proxy-multi.conf -D google.com and change the key to: eesecret676f6f676c652e636f6d - and connection fails.

What do I do wrong?

Is the last version of the proxy installed?

hookzof avatar Oct 15 '19 12:10 hookzof

Is the last version of the proxy installed?

Yes, just updated it today. If I run mtproto-proxy -h it does show new -D option.

mtproxy-0.01 compiled at Oct 15 2019 13:29:40 by gcc 6.3.0 20170516 64-bit after commit dc0c7f3de40530053189c572936ae4fd1567269b

--domain/-D <arg>                       adds allowed domain for TLS-transport mode, disables other transports; can be specified more than once

And it restarts with this option okay but I can't connect to it. Is the key correct? It is "ee"+secret+"676f6f676c652e636f6d" (last part is "google.com" in hex).

If I restart it without -D option and change key back to dd+secret it works.

SpcCw avatar Oct 15 '19 12:10 SpcCw

I seem to figure it out, the proxy needs to have access to the domain passed to it as -D argument.

SpcCw avatar Oct 15 '19 14:10 SpcCw

I seem to figure it out, the proxy needs to have access to the domain passed to it as -D argument.

Yeah, that's how it works. What region did you try to run a proxy from?

hookzof avatar Oct 15 '19 14:10 hookzof

What region did you try to run a proxy from?

Do you mean the server with proxy itself, the TLS domain or where clients connect to it? Servers are VPS in Europe, clients are mainly from Moscow, Russia.

SpcCw avatar Oct 15 '19 14:10 SpcCw

Another question: i configured nginx+letsencrypt, configured mtproxy to use my domain as fake tls domain, generated new secret with ee and domain-hex, everything works fine. then i noticed that my nginx server was down, but clients still were able to connect to my proxy. how does it work? is there something like fallback to 'dd' mode when tls server is down? is there any way to test if fake-tls being used at all? I still don't get it:-) if mtproxy actually does nothing with tls1.3 server directly (can't see anything in log), means you can start proxy with every random domain name? It is used only to fake tls handshake?

rlka avatar Oct 18 '19 16:10 rlka

It's just that two services on the same port won't work, I described the methods above. If the "-D" flag is set, the dd-mode will not work. Domain name can be any, DPI will see a reference to the site that is specified in the secret key. The recommendation was to "confuse DPI" not to give him any reason to doubt that users are actually visiting a real site.

hookzof avatar Oct 18 '19 17:10 hookzof

i think i got it, you can set every domain you want, but it will be 'suspicious' for DPI if such domain doesn't even exist or not using tls 1.3 :) thanks

rlka avatar Oct 18 '19 17:10 rlka

Why is the version (0.01) unchanged, since dd implemented ?

It bothers me a lot.

vskubriev avatar Oct 29 '19 16:10 vskubriev