tailscale-proxy: switch Telegram proxy to Telemt; rework Grafana dashboard

alexbers/mtprotoproxy's Fake-TLS handshake was rejected by real Telegram
clients (server/clock/secret/egress all verified good), so replace it with
Telemt (ghcr.io/telemt/telemt:3.4.25) - the same proven implementation as the
Hetzner endpoint. Config: Fake-TLS on :1080, use_middle_proxy=false (direct-to-DC,
required with a SOCKS5 upstream) and [[upstreams]] socks5 ts-proxy:1055 so only
DC-bound traffic exits via the Tailscale exit node. Secret in host-only
telemt.toml; config.py.example (alexbers) removed. Telemt stays on json-file
(its tracing logs don't ship cleanly via the syslog driver).

Dashboard: retarget the working 3proxy queries from :1080 to the HTTP front
:3128 (the old HTTP section used stale tinyproxy patterns), drop the retired
SOCKS5 section, add a Telegram/Telemt info panel.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-24 14:48:11 +03:00
co-authored by Claude Opus 4.8
parent ebf94e668b
commit 8f95385b89
4 changed files with 103 additions and 452 deletions
+16 -10
View File
@@ -36,21 +36,27 @@ services:
tag: tailscale-proxy
networks: [proxynet]
# Telegram-only Fake-TLS MTProto proxy on :1080 (replaces the TSPU-blocked
# generic SOCKS5). Chains its Telegram-DC connections through the Tailscale
# userspace SOCKS5 (SOCKS5_HOST=ts-proxy:1055 in config.py) so egress still
# rides the Hetzner exit node. Client-facing hop is domestic Fake-TLS; the
# foreign leg is the WireGuard tunnel that already carries the HTTP proxy.
# config.py is host-only (0600, uid 10000, NOT in git) - holds the secret.
mtproto:
image: alexbers/mtprotoproxy:latest
container_name: ts-lan-mtproto
# Telegram Fake-TLS MTProto proxy on :1080. Uses Telemt (the same proven
# implementation as the Hetzner endpoint) after alexbers/mtprotoproxy's
# Fake-TLS handshake was rejected by real clients (see the mtproto diagnostic).
# Only DC-bound traffic is chained out through the Tailscale userspace SOCKS5
# ([[upstreams]] socks5 ts-proxy:1055 in telemt.toml), so egress rides the
# Hetzner exit node; the client-facing hop is direct Fake-TLS.
# telemt.toml is host-only (0600, uid 65532/nonroot, NOT in git) - holds the secret.
telemt:
image: ghcr.io/telemt/telemt:3.4.25
container_name: ts-lan-telemt
restart: unless-stopped
depends_on: [ts-proxy]
environment:
NO_COLOR: "1" # cleaner `docker logs` (no ANSI escapes)
volumes:
- "/mnt/containers/tailscale-proxy/mtproto/config.py:/home/tgproxy/config.py:ro,z"
- "/mnt/containers/tailscale-proxy/telemt/telemt.toml:/app/config.toml:ro,z"
ports:
- "192.168.0.35:1080:1080"
# Stays on json-file: telemt's tracing logs don't ship cleanly over the
# syslog driver, and `docker logs ts-lan-telemt` is worth keeping for this
# critical service. Observe it there (or wire its Prometheus metrics later).
networks: [proxynet]
networks:
-34
View File
@@ -1,34 +0,0 @@
# alexbers/mtprotoproxy config for the tekhnohim Telegram Fake-TLS MTProto proxy.
#
# The REAL config.py is host-only at /mnt/containers/tailscale-proxy/mtproto/config.py
# (mode 0600, owned by uid 10000 = the container's `tgproxy` user, NOT in git),
# because USERS holds the proxy secret. This file is the secret-free template.
#
# Egress: SOCKS5_HOST/SOCKS5_PORT point at the Tailscale userspace SOCKS5
# (ts-proxy:1055), so every Telegram-DC connection exits via the Hetzner exit
# node (89.167.72.79). The client-facing side is Fake-TLS (looks like HTTPS to
# TLS_DOMAIN), which survives TSPU where the retired raw SOCKS5 did not.
PORT = 1080
# username -> 32-hex-char secret (16 bytes). Generate: openssl rand -hex 16
USERS = {
"tekhnohim": "00000000000000000000000000000000",
}
# Fake-TLS only (best obfuscation). classic/secure are easier to fingerprint.
MODES = {
"classic": False,
"secure": False,
"tls": True,
}
# SNI presented in the Fake-TLS handshake. Must be a real, reachable HTTPS host.
# Tunable if a given domain is filtered on the client path.
TLS_DOMAIN = "www.google.com"
# Upstream SOCKS5 = the Tailscale userspace proxy -> Hetzner exit node.
SOCKS5_HOST = "ts-proxy"
SOCKS5_PORT = 1055
SOCKS5_USER = None
SOCKS5_PASS = None
@@ -0,0 +1,38 @@
# Telemt config for the tekhnohim Telegram Fake-TLS MTProto proxy (docker host).
#
# The REAL telemt.toml is host-only at
# /mnt/containers/tailscale-proxy/telemt/telemt.toml (mode 0600, owned by the
# image's nonroot uid 65532, NOT in git) because [access.users] holds the
# proxy secret. This is the secret-free template.
#
# Egress: [[upstreams]] socks5 -> ts-proxy:1055 (Tailscale userspace SOCKS5),
# so ONLY Telegram-DC traffic exits via the Hetzner exit node (89.167.72.79).
# The client-facing side is direct Fake-TLS on :1080.
# Direct-to-DC mode: with a SOCKS5 upstream, only DC-bound traffic is chained,
# so use_middle_proxy MUST be false (middle-proxy/ME servers are not routed
# through the upstream and fail to init behind the Tailscale SOCKS5).
[general]
use_middle_proxy = false
[general.modes]
classic = false
secure = false
tls = true # ee / FakeTLS
[server]
port = 1080
[censorship]
tls_domain = "www.google.com" # SNI presented in the Fake-TLS handshake; tunable
[access.users]
# username = 32-hex-char secret (16 bytes). Generate: openssl rand -hex 16
tekhnohim = "00000000000000000000000000000000"
# Chain Telegram-DC connections out through the Tailscale userspace SOCKS5.
[[upstreams]]
type = "socks5"
address = "ts-proxy:1055"
weight = 1
enabled = true