Skip to content

run.sh: hardcoded port 443 in links and missing --http-stats flag #677

@sameas

Description

@sameas

Two issues found in run.sh

1. Port in generated links is hardcoded to 443

When running the proxy on a non-standard port (e.g. docker run -p 2053:443 ...),
the generated tg:// and t.me/ links in the logs always show port=443:

echo "[*]   tg:// link for secret $I auto configuration: tg://proxy?server=${IP}&port=443&secret=${S}"

This is misleading — users have to manually fix the port in every link.

Suggested fix: introduce a PORT environment variable (defaulting to 443) and use it in the link generation:

if [ -z "$PORT" ]; then PORT=443; fi
# ...
echo "[*]   tg:// link for secret $I: tg://proxy?server=${IP}&port=${PORT}&secret=${S}"

2. HTTP stats endpoint is not enabled by default

The proxy binary supports an --http-stats flag that enables HTTP access to the
/stats endpoint on port 2398. Without it, the port is open for internal RPC only
and curl http://localhost:2398/stats always returns Connection refused.

The flag is not present in the final exec call in run.sh:

exec /usr/local/bin/mtproto-proxy -p 2398 -H 443 -M "$WORKERS" -C 60000 \
  --aes-pwd ... -u root $CONFIG --allow-skip-dh \
  --nat-info "$INTERNAL_IP:$IP" $SECRET_CMD $TAG_CMD
  # ^ --http-stats is missing here

Suggested fix: either add --http-stats by default, or support an env variable
like HTTP_STATS=true to opt in.


Both issues are easy to reproduce with the official telegrammessenger/proxy:latest image.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions