Просмотр исходного кода

Merge pull request #55 from 9seconds/secure-mode-readme

Add explanation on secure mode
tags/0.15.1^2
Sergey Arkhipov 7 лет назад
Родитель
Сommit
f81f29cbb4
Аккаунт пользователя с таким Email не найден
1 измененных файлов: 11 добавлений и 9 удалений
  1. 11
    9
      README.md

+ 11
- 9
README.md Просмотреть файл

113
 
113
 
114
 ## Secure mode
114
 ## Secure mode
115
 
115
 
116
-If you want to support new secure mode, please prepend `dd` to the
117
-secret. For example, secret `cf18fa8ea0267057e2c61a5f7322a8e7` should
118
-be `ddcf18fa8ea0267057e2c61a5f7322a8e7`. But pay attention that some
119
-old clients won't support this mode. If this is not your case, I would
120
-suggest to go with this mode.
116
+Secure mode is not the best name and of course, it creates a lot of confusion. To explain what it means, we need to tell you some bits on dd-secrets.
117
+
118
+MTPROTO proxy protocol requires 16-byte secret. You usually propagate it as a 32 characters hexadecimal string like `282831900f371ca182feb0e4e1e1aeef` (if you decode this string to bytes, you will get a real secret which is used in the protocol). Everything went quite good until the moment when developers found an evidence that [protocol is quite weak to DPI](https://github.com/TelegramMessenger/MTProxy/issues/35) and some enthusiasts even created simple proofs of concepts on [detecting MTPROTO traffic](https://github.com/darkk/poormansmtproto).
119
+
120
+Telegram team has introduced a patch called dd-secrets. If you have a secret `282831900f371ca182feb0e4e1e1aeef` then your dd-secret is `dd282831900f371ca182feb0e4e1e1aeef`. That is, you just add dd prefix to the secret, prepend it with dd. In that case, original secret `282831900f371ca182feb0e4e1e1aeef` is used but client and server start to act a little bit different: they start to add random noise to the packets so they can't be detected by their length. In order to keep backward compatibility, all proxies a quite liberal to the secrets to use: if the client uses plain secret, without dd prefix, they fall back to the normal behavior. If dd-secret is used (proxy can extract this information on the handshake), then more secured, the hardened behavior is used.
121
+
122
+Yes, it can look like a hack but it is as it is.
123
+
124
+Now going back to the secure mode: if you do not pass `-s` flag to the mtg, then it checks what mode is requested by the client. If the client uses plain secret, without dd prefix, then proxy falls back to the original behavior and do not play with paddings. If dd-secret is used and client demands this mode, then proxy start to add that random noise to the packets. But if you pass `-s`, then only clients with dd-secrets can connect. How to migrate existing clients then? If a client is new enough, you can just prepend the secret with dd string in the settings. If it is an old guy, then nothing to do, sorry.
125
+
126
+Why this mode matters? We do not have evidence but there is quite a big suspicion that some ISPs start to filter MTPROTO traffic. If they detect the IP address which acts as a proxy, they block it and no clients can use this proxy. This is an attempt to prevent such a situation.
121
 
127
 
122
 Oneliners to generate such secrets:
128
 Oneliners to generate such secrets:
123
 
129
 
131
 echo dd$(head -c 512 /dev/urandom | md5sum | cut -f 1 -d ' ')
137
 echo dd$(head -c 512 /dev/urandom | md5sum | cut -f 1 -d ' ')
132
 ```
138
 ```
133
 
139
 
134
-If you want to enforce the usage of secure mode, please pass `-s` or
135
-`--secure-only` flags. In that case, clients which do not use dd-secrets
136
-are going to be disconnected from the proxy.
137
-
138
 
140
 
139
 ## Environment variables
141
 ## Environment variables
140
 
142
 

Загрузка…
Отмена
Сохранить