Environment
- MTProxyMax manager v1.4.0-LTS, telemt engine v3.5.6-3693d1e
- Mask backend is a local HTTPS server on the same host that terminates the proxy
tls_domain with a valid cert
Summary
When the mask backend is a local/loopback server, mtproxymax does not honor MASKING_HOST/MASKING_PORT
from settings.conf. Every regeneration of the telemt config.toml instead hard-codes the mask to
mask_host = CUSTOM_IP and mask_port = PROXY_PORT. Relaying to the public host causes the client's original
ClientHello (SNI = the proxy tls_domain) to route back into the proxy, so the TLS handshake never completes and
HTTPS access to the mask/tls_domain site fails.
Settings vs generated config
settings.conf (intended):
MASKING_ENABLED='true'
MASKING_HOST='127.0.0.1'
MASKING_PORT='8443'
UNKNOWN_SNI_ACTION='mask'
CUSTOM_IP='<PUBLIC_CONNECT_HOST>'
PROXY_DOMAIN='<TLS_DOMAIN>'
PROXY_PORT='443'
config.toml produced by the manager after mtproxymax mask-backend 127.0.0.1:8443:
[censorship]
tls_domain = "<TLS_DOMAIN>"
unknown_sni_action = "mask"
mask = true
mask_port = 443 # expected 8443
mask_host = "<PUBLIC_CONNECT_HOST>" # expected "127.0.0.1"
Passing a non-loopback LAN address behaves the same: mtproxymax mask-backend <LAN_IP>:8443 still yields
mask_host = "<PUBLIC_CONNECT_HOST>", mask_port = 443.
Repro
- Set MASKING_HOST='127.0.0.1', MASKING_PORT='8443' in settings.conf, with a real HTTPS server for the
tls_domain on that address/port.
- Run mtproxymax mask-backend 127.0.0.1:8443 → it prints "Mask backend set to 127.0.0.1:8443", regenerates
config.toml, and restarts the engine.
- Inspect config.toml → mask_host/mask_port are CUSTOM_IP/PROXY_PORT, not 127.0.0.1/8443.
- curl -v https://<TLS_DOMAIN>/ from an external host → TLS handshake never completes
(error:0A000126:SSL routines::unexpected eof while reading).
Expected behavior
UNKNOWN_SNI_ACTION='mask'
CUSTOM_IP='<PUBLIC_CONNECT_HOST>'
PROXY_DOMAIN='<TLS_DOMAIN>'
PROXY_PORT='443'
config.toml produced by the manager after mtproxymax mask-backend 127.0.0.1:8443:
[censorship]
tls_domain = "<TLS_DOMAIN>"
unknown_sni_action = "mask"
mask = true
mask_port = 443 # expected 8443
mask_host = "<PUBLIC_CONNECT_HOST>" # expected "127.0.0.1"
Passing a non-loopback LAN address behaves the same: mtproxymax mask-backend <LAN_IP>:8443 still yields
mask_host = "<PUBLIC_CONNECT_HOST>", mask_port = 443.
Repro
- Set MASKING_HOST='127.0.0.1', MASKING_PORT='8443' in settings.conf, with a real HTTPS server for the
tls_domain on that address/port.
- Run mtproxymax mask-backend 127.0.0.1:8443 → it prints "Mask backend set to 127.0.0.1:8443", regenerates
config.toml, and restarts the engine.
- Inspect config.toml → mask_host/mask_port are CUSTOM_IP/PROXY_PORT, not 127.0.0.1/8443.
- curl -v https://<TLS_DOMAIN>/ from an external host → TLS handshake never completes
(error:0A000126:SSL routines::unexpected eof while reading).
Expected behavior
config.toml should reflect the configured backend verbatim:
mask = true
mask_port = 8443
mask_host = "127.0.0.1"
so non-Telegram TLS is relayed to the local server that actually terminates the tls_domain.
Sample screenshots
Config shown in the TUI:
Config of telemt shown in the TUI (v command):
Related issues about masking: #71, #72
Environment
tls_domainwith a valid certSummary
When the mask backend is a local/loopback server,
mtproxymaxdoes not honorMASKING_HOST/MASKING_PORTfrom
settings.conf. Every regeneration of the telemtconfig.tomlinstead hard-codes the mask tomask_host = CUSTOM_IPandmask_port = PROXY_PORT. Relaying to the public host causes the client's originalClientHello (SNI = the proxy
tls_domain) to route back into the proxy, so the TLS handshake never completes andHTTPS access to the mask/tls_domain site fails.
Settings vs generated config
settings.conf(intended):config.tomlproduced by the manager aftermtproxymax mask-backend 127.0.0.1:8443:Passing a non-loopback LAN address behaves the same: mtproxymax mask-backend <LAN_IP>:8443 still yields
mask_host = "<PUBLIC_CONNECT_HOST>", mask_port = 443.
Repro
tls_domain on that address/port.
config.toml, and restarts the engine.
(error:0A000126:SSL routines::unexpected eof while reading).
Expected behavior
config.tomlproduced by the manager aftermtproxymax mask-backend 127.0.0.1:8443:Passing a non-loopback LAN address behaves the same: mtproxymax mask-backend <LAN_IP>:8443 still yields
mask_host = "<PUBLIC_CONNECT_HOST>", mask_port = 443.
Repro
tls_domain on that address/port.
config.toml, and restarts the engine.
(error:0A000126:SSL routines::unexpected eof while reading).
Expected behavior
config.toml should reflect the configured backend verbatim:
so non-Telegram TLS is relayed to the local server that actually terminates the tls_domain.
Sample screenshots
Config shown in the TUI:
Config of telemt shown in the TUI (
vcommand):Related issues about masking: #71, #72