alexbers / mtprotoproxy

Async MTProto proxy for Telegram
MIT License
1.59k stars 351 forks source link

How to add new user and restart #233

Open miladjafary opened 4 years ago

miladjafary commented 4 years ago

How can I add a user and restart the service? How can I create the password? If the proxy has been started by Docker, how can I restart the service? if the proxy has been started without Docker how can I restart the service?

weasonn commented 4 years ago

You can edit config.py and set tg2, tg3 and so on with random secret. And that secret is also the password so when you share the tg link then you give that user's password to others. You can use command "ps -ef | grep python3" to find the pid then use command "kill -9 pid" to kill it. Afterwards you can use "python3 mtprotoproxy.py" to start it.

miladjafary commented 4 years ago

My problem is how can I generate the password since it's a hash.

`# name -> secret (32 hex chars) USERS = { "tg": "00000000000000000000000000000001",

"tg2": "0123456789abcdef0123456789abcdef",

}`

As you can see, I have to create 32 hex chars for the password while I don't know how can I creat it. Meanwhile I wanna to create a just simple user as the follow: # name -> secret (32 hex chars) USERS = { "milad": "password" } `

weasonn commented 4 years ago

https://onlinerandomtools.com/generate-random-hexadecimal-numbers

I used google and found this website to help you generate the hex chars. If you want to know how to setup password then you should contact the developer @alexbers

WH-2099 commented 3 years ago
  1. openssl rand -hex 16
  2. head -c 16 /dev/urandom | xxd -ps
myfingerhurt commented 2 years ago

shorter version xxd -l 16 -p /dev/urandom

A5DkjGQUZx commented 2 years ago

Any method to add new users w/o restart so the logs are not wiped?!

pouryare commented 2 years ago

Any method to add new users w/o restart so the logs are not wiped?!

After adding user, run this: ps -ef | grep */mtprotoproxy.py | awk '{print $2}' | xargs sudo kill -SIGUSR2

A5DkjGQUZx commented 2 years ago

I guess might work but with minor modification: ps -ef | grep mtprotoproxy.py | awk '{print $2}' | xargs sudo kill -SIGUSR2