Skip to content

sync: merge upstream/master through 9bf7222 (contrib/sni-router, docs, PROXY protocol v2)#28

Merged
dolonet merged 8 commits intomasterfrom
sync/upstream-2026-04-15
Apr 15, 2026
Merged

sync: merge upstream/master through 9bf7222 (contrib/sni-router, docs, PROXY protocol v2)#28
dolonet merged 8 commits intomasterfrom
sync/upstream-2026-04-15

Conversation

@dolonet
Copy link
Copy Markdown
Owner

@dolonet dolonet commented Apr 15, 2026

Summary

Merges 7 upstream commits from 9seconds/mtg into master.

Commit Description
0c1d001 Add docker-compose example with HAProxy SNI router
d0412b2 Fix ACME HTTP-01 passthrough in HAProxy config
170346b Pass real client IPs through with PROXY protocol v2
602f85d Document firehol_level1 RFC1918 gotcha in blocklist defaults
68a4685 Fix description of blocklist rejection behavior
5953f93 Merge PR 9seconds#462 (contrib/docker-sni-router)
9bf7222 Merge PR 9seconds#467 (docs/blocklist-lan-gotcha)

Net changes: 7 new files under contrib/sni-router/, additions to example.config.toml. No code changes.

Conflict resolution: README.md kept as fork version (fork README is independently maintained). example.config.toml auto-merged cleanly.

dolonet and others added 8 commits April 10, 2026 10:12
Turnkey deployment: HAProxy on :443 peeks at the TLS SNI and routes
Telegram clients to mtg while forwarding everything else (including DPI
probes) to a real Caddy web server with automatic HTTPS.

This is the setup recommended in BEST_PRACTICES.md, packaged so that
operators can clone and run it with minimal configuration.

Refs: 9seconds#458
Add an ACL that routes /.well-known/acme-challenge/ requests on :80
to Caddy instead of redirecting to HTTPS, so Let's Encrypt certificate
issuance works out of the box.

Also simplify Caddyfile to use Caddy's http_port/https_port directives.
The default [defense.blocklist] uses firehol_level1.netset, which
includes bogon networks and therefore all RFC1918 ranges. Clients
connecting from a LAN address (e.g. a phone on the home Wi-Fi when
mtg runs at home) are silently rejected with "ip was blacklisted"
and routed to the fronting domain. This is a recurring source of
confusion (see issue 9seconds#466 for the latest example).

Add a warning next to the urls list in example.config.toml and a
Troubleshooting section in README.md covering the symptom, the
cause, and three resolution paths (disable blocklist, swap for a
narrower list, or use hairpin NAT).

Docs only, no code changes.
The previous wording ("silently routed to the fronting domain")
is inaccurate. In mtglib/proxy.go the blocklist path calls
conn.Close() immediately with no further handshake or fronting;
domain fronting only happens on FakeTLS failures for non-blocked
IPs. Reword to "TCP connection is closed with no response" so
users searching the docs get the same symptom they actually see.
Without this, mtg and Caddy see HAProxy's container IP for every
connection, which breaks meaningful logging, abuse handling, and any
IP-based blocklist logic.  HAProxy sends a PROXY protocol v2 header on
its TCP backends; mtg enables proxy-protocol-listener, and Caddy wraps
:8443 with a proxy_protocol listener before tls.

The :80 path (ACME HTTP-01 passthrough) is unchanged — client IP there
is not useful and HAProxy's http mode already adds X-Forwarded-For if
anyone wants it.

Requested in 9seconds#462 review.
Add docker-compose example with HAProxy SNI router
docs: warn about firehol_level1 RFC1918 gotcha in default blocklist
Upstream commits included:
- 0c1d001 Add docker-compose example with HAProxy SNI router
- d0412b2 Fix ACME HTTP-01 passthrough in HAProxy config
- 602f85d Document firehol_level1 RFC1918 gotcha in blocklist defaults
- 68a4685 Fix description of blocklist rejection behavior
- 170346b Pass real client IPs through with PROXY protocol v2
- 5953f93 Merge PR 9seconds#462 from dolonet/contrib/docker-sni-router
- 9bf7222 Merge PR 9seconds#467 from dolonet/docs/blocklist-lan-gotcha

Conflict resolution: README.md kept as fork version (mtg-multi has its
own README describing multi-secret and per-user stats features).
example.config.toml auto-merged cleanly.
@dolonet dolonet merged commit 57b015e into master Apr 15, 2026
7 checks passed
@dolonet dolonet deleted the sync/upstream-2026-04-15 branch April 15, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants