Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon How do I obtain a Telegram secret for my MTProxy server


How do I obtain a Telegram secret for my MTProxy server


To obtain a secret for your MTProxy server, you can follow these steps:

1. Install Dependencies: Ensure you have the necessary packages installed on your server. For Ubuntu/Debian, you can run:

bash
   sudo apt install git curl build-essential libssl-dev zlib1g-dev
   

2. Download the Proxy Secret: Use the `curl` command to download the proxy secret directly from Telegram's official server. Execute the following command:

bash
   curl -s https://core.telegram.org/getProxySecret -o proxy-secret
   

3. Download the Proxy Configuration: Similarly, download the current configuration file using:

bash
   curl -s https://core.telegram.org/getProxyConfig -o proxy-multi.conf
   

4. Generate Your Own Secret: You also need to generate a unique 16-character secret for authenticating users with your proxy. You can do this with:

bash
   head -c 16 /dev/urandom | xxd -ps
   

5. Run the MTProxy Server: Finally, start your MTProxy server using the downloaded secret and configuration files. An example command to run the server might look like this:

bash
   ./mtproto-proxy -u nobody -p 8888 -H 443 -S <your_generated_secret> --aes-pwd proxy-secret proxy-multi.conf -M 1
   

Replace `` with the secret you generated in the previous step.

These steps will set up your MTProxy server with the necessary secret to connect to Telegram's servers[1][4].

Citations:
[1] https://www.gadgethow2.com/2022/03/07/how-to-set-up-an-mtproto-mtproxy-telegram-proxy-server/
[2] https://www.adeoclouds.eu/aws-mtproxy.php
[3] https://aws.amazon.com/marketplace/pp/prodview-zefbfz6am5gu2
[4] https://gist.github.com/rameerez/8debfc790e965009ca2949c3b4580b91?permalink_comment_id=4999582
[5] https://v2how.github.io/post/2021-02-18-camouflage-telegram-mtproto-proxy-ubuntu-20-04/
[6] https://core.telegram.org/mtproto/mtproto-transports
[7] https://mtpro.xyz
[8] https://github.com/TelegramMessenger/MTProxy/actions