You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 5, 2026. It is now read-only.
Cap concurrent connections per secret to prevent a leaked secret from
consuming all proxy resources. When the limit is reached, new TLS
connections are proxied to the configured domain (indistinguishable from
a normal website), and obfuscated2 connections are silently dropped.
Existing connections and other secrets are unaffected.
- CLI: -S secret:label:1000 (limit is optional, backward-compatible)
- Docker: SECRET_LIMIT_N env vars
- Stats: secret_<label>_limit, secret_<label>_rejected
- Prometheus: mtproxy_secret_connection_limit, mtproxy_secret_connections_rejected_total
- Multi-worker: limit divided across workers for approximate enforcement
Closes#66
Copy file name to clipboardExpand all lines: CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,11 @@
2
2
3
3
All notable changes to this project will be documented in this file.
4
4
5
+
## [3.4.0] - 2026-03-27
6
+
7
+
### Added
8
+
-**Per-secret connection limits** — cap concurrent connections per secret to prevent a leaked or widely-shared secret from consuming all proxy resources. Syntax: `-S secret:label:1000`. Fake-TLS connections are proxied to the domain on rejection (indistinguishable from a normal website); obfuscated2 connections are silently dropped. Docker: `SECRET_LIMIT_N` env vars. New stats: `secret_<label>_limit`, `secret_<label>_rejected`, and Prometheus equivalents ([#66](https://github.com/GetPageSpeed/MTProxy/issues/66))
-`nobody` is the username. `mtproto-proxy` calls `setuid()` to drop privilegies.
163
163
-`443` is the port, used by clients to connect to the proxy.
164
164
-`8888` is the local port for statistics (requires `--http-stats`). Like `curl http://localhost:8888/stats`. Stats are accessible from private networks (loopback, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) but not from public IPs.
165
-
-`<secret>` is the secret generated at step 3. Also you can set multiple secrets: `-S <secret1> -S <secret2>`. Each secret can have an optional label: `-S <secret>:family -S <secret>:friends`. Labels appear in logs and stats instead of raw secrets, making it easy to identify which secret a connection used.
165
+
-`<secret>` is the secret generated at step 3. Also you can set multiple secrets: `-S <secret1> -S <secret2>`. Each secret can have an optional label: `-S <secret>:family -S <secret>:friends`. Labels appear in logs and stats instead of raw secrets, making it easy to identify which secret a connection used. You can also set a per-secret connection limit: `-S <secret>:family:1000` (see [Per-Secret Connection Limits](#per-secret-connection-limits)).
166
166
-`--aes-pwd proxy-secret` points to the `proxy-secret` file downloaded at step 1, which contains the encryption key used for MTProto key exchange with Telegram DCs.
167
167
-`proxy-secret` and `proxy-multi.conf` are obtained at steps 1 and 2.
168
168
-`1` is the number of workers. You can increase the number of workers, if you have a powerful server.
@@ -487,6 +487,7 @@ docker run -d \
487
487
- If both `SECRET` and `SECRET_N` are set, all are combined
488
488
- Maximum 16 secrets (binary limit)
489
489
-`SECRET_LABEL_1`, `SECRET_LABEL_2`, ...: Optional labels for numbered secrets (e.g. `SECRET_LABEL_1=family`). See [Secret Labels](#secret-labels)
parse_option ("proxy-tag", required_argument, 0, 'P', "16-byte proxy tag in hex mode to be passed along with all forwarded queries");
2532
2574
parse_option ("domain", required_argument, 0, 'D', "adds allowed domain or host:port for TLS-transport mode, disables other transports; can be specified more than once");
2533
2575
parse_option ("max-special-connections", required_argument, 0, 'C', "sets maximal number of accepted client connections per worker");
0 commit comments