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