Use the MTProxy Docker image
masterTelegram provides an official Docker image for MTProxy. Note that the image is currently marked as outdated.
Image URL: https://hub.docker.com/r/telegrammessenger/proxy/
repository·master·Indexed 27 days ago
https://github.com/telegrammessenger/mtproxyMTProxy is a simple MT-Proto proxy designed to facilitate Telegram connections, featuring random padding to evade ISP detection. This documentation covers building from source, running the mtproto-proxy binary, CLI options reference, systemd service configuration, and the official Docker image.
Telegram provides an official Docker image for MTProxy. Note that the image is currently marked as outdated.
Image URL: https://hub.docker.com/r/telegrammessenger/proxy/
To run MTProxy as a background service on Linux, create a systemd service file at /etc/systemd/system/MTProxy.service. After creating the file, reload the daemon, start the service, and enable it for autostart on reboot.
# 1. Create the service file
# File content for /etc/systemd/system/MTProxy.service:
[Unit]
Description=MTProxy
After=network.target
[Service]
Type=simple
WorkingDirectory=/opt/MTProxy
ExecStart=/opt/MTProxy/mtproto-proxy -u nobody -p 8888 -H 443 -S <secret> -P <proxy tag> <other params>
Restart=on-failure
[Install]
WantedBy=multi-user.target
# 2. Apply changes
systemctl daemon-reload
systemctl restart MTProxy.service
systemctl enable MTProxy.serviceTo run the proxy, you need to perform several preparation steps:
curl -s https://core.telegram.org/getProxySecret -o proxy-secret.curl -s https://core.telegram.org/getProxyConfig -o proxy-multi.conf.head -c 16 /dev/urandom | xxd -ps.Then, execute the binary with the required flags. To enable random padding (to evade ISP detection), prefix your user secret with dd (e.g., dd<secret>).
./mtproto-proxy -u nobody -p 8888 -H 443 -S <secret> --aes-pwd proxy-secret proxy-multi.conf -M 1To build MTProxy, you must first install the necessary development dependencies for openssl and zlib. After cloning the repository, use make to compile the binary. The resulting binary will be located in objs/bin/mtproto-proxy. If a build fails, run make clean before attempting to build again.
# On Debian/Ubuntu
apt install git curl build-essential libssl-dev zlib1g-dev
# On CentOS/RHEL
yum install openssl-devel zlib-devel
yum groupinstall "Development Tools"
# Build process
git clone https://github.com/TelegramMessenger/MTProxy
cd MTProxy
make && cd objs/binThe mtproto-proxy binary accepts the following command-line arguments:
-u <username>: The username to use when calling setuid() to drop privileges (e.g., nobody).-p <port>: The local port used to retrieve statistics via loopback (e.g., wget localhost:8888/stats).-H <port>: The port used by clients to connect to the proxy.-S <secret>: The secret used by clients to connect. You can specify multiple secrets by repeating this flag.-P <proxy tag>: The proxy tag received from @MTProxybot.--aes-pwd <file>: Path to the file containing the secret obtained from Telegram servers.<config_file>: Path to the Telegram configuration file (proxy-multi.conf).-M <number>: The number of worker processes to spawn.