An MTProto inbound must not relay a stranger's connection to a public host
picked by an SNI the panel never configured, and every byte it moves must
show up in the inbound's traffic.
mtg relays whatever it cannot serve as a proxy to the fronting target, byte
for byte, and the target answers by the SNI of that connection. With the
default FakeTLS domain on a CDN, anybody could reach any site of that CDN
through the inbound ("clean IP"). mtg dials the target itself, past the
Xray bridge and outside every secret, so neither the clients nor the
inbound showed that traffic.
- The generated config sets [domain-fronting] require-sni-match (mtg-multi
1.17.0) unless the fronting IP is a loopback, private or link-local
address, i.e. the operator's own web server. mtg then relays only a
ClientHello naming the FakeTLS domain and closes the rest. An older mtg
ignores the key.
- The /stats "fronting" counters are scraped per process and added to the
inbound's total, for routed inbounds too.
TestRenderConfig pinned the old rule (a bare config has no
[domain-fronting] section) and now expects the section without a host.
Catch the panel up to the mtg-multi README (v1.14.0):
- Each client can now carry its own 32-hex advertising tag overriding the
inbound-level one. The tag lives on the client (settings JSON is the
source of truth, clients.ad_tag is the UI projection), is rendered into
the fork's [secret-ad-tags] section for active secrets only (mtg rejects
a config whose override names an unknown secret), is pushed per entry
through PUT /secrets, and is part of the reload fingerprint so a tag
edit hot-applies without dropping connections.
- The loopback management API can replace the whole secret set, so every
mtg process now gets a random per-process api-token; the manager sends
it as a bearer token on PUT /secrets and GET /stats and reuses it across
config rewrites, because mtg reads the token only at startup.
- Malformed tags are rejected at every save path and additionally dropped
in InstanceFromInbound: one bad tag would otherwise fail the whole
generated config and take every client of the inbound down with it.
- SyncInbound never copied a re-keyed mtproto secret into the canonical
clients table, so the clients page and subscription links kept serving
the old secret, which mtg then rejects. It is now guarded-copied like
the other credentials.
Replace the upstream 9seconds/mtg sidecar with the dolonet/mtg-multi fork so a single MTProto inbound can serve many per-user secrets. Each panel client is now one named FakeTLS secret in the fork's [secrets] section: clients are first-class (attach/detach, limits, expiry, per-client tg:// links) exactly like every other protocol, mirroring the WireGuard multi-client model. Per-client traffic and online status come from the fork's /stats JSON API (its Prometheus output has no per-user label), fed into the existing email-keyed client_traffics accumulator; an optional throttle caps concurrent connections. A one-time seeder converts each legacy single-secret inbound into a one-client inbound.
The fork ships only linux/darwin amd64/arm64 binaries but is pure Go, so provisioning builds it from source for every supported platform (release.yml, DockerInit.sh) while keeping the panel-expected mtg-<os>-<arch> filename and the 'run' verb, so process.go is untouched. Also fixes a pre-existing update.sh gap that never renamed the mtg binary for armv6/armv7 updates.