Files
mirror-3x-ui/internal
Sanaei 3e1fc3c24f fix(mtproto): stop relaying strangers to the fronting CDN, count fronted traffic
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.
2026-11-29 12:05:06 +03:30
..
2026-10-25 20:08:14 +01:00