Skip to content

Instantly share code, notes, and snippets.

@an9wer
Last active February 19, 2019 02:38
Show Gist options
  • Save an9wer/5277746952f4948d3a656ba78bf8622d to your computer and use it in GitHub Desktop.
Save an9wer/5277746952f4948d3a656ba78bf8622d to your computer and use it in GitHub Desktop.
# /usr/bin/env bash
set -e
# head -c 16 /dev/urandom | xxd -ps
sudo docker build -t tgproxy_image .
sudo docker run -d \
--network host \
--name tgproxy_container \
--restart unless-stopped \
--mount type=bind,source="$(pwd)"/config.py,target=/app/mtprotoproxy/config.py,readonly \
tgproxy_image
PORT = 3256
# name -> secret (32 hex chars)
USERS = {
"tg": "00000000000000000000000000000000",
"tg2": "0123456789abcdef0123456789abcdef"
}
# Tag for advertising, obtainable from @MTProxybot
# AD_TAG = "3c09c680b76ee91a4c25ad51f742267d"
# Uncommenting this do make a proxy harder to detect
# But it can be incompatible with old clients
# SECURE_ONLY = True
FROM alpine
LABEL maintainer.name="an9wer"
LABEL maintainer.email="an9wer@gmail.com"
SHELL ["/bin/sh", "-c"]
USER root:root
RUN apk update && apk upgrade
RUN apk add --no-cache git python3 py3-cryptography ca-certificates libcap
RUN setcap cap_net_bind_service=+ep $(realpath $(which python3))
RUN adduser -S tgproxy
RUN mkdir /app && chmod 1777 /app
USER tgproxy
WORKDIR /app
RUN git clone -b master https://github.com/alexbers/mtprotoproxy.git
WORKDIR /app/mtprotoproxy
CMD ["python3", "mtprotoproxy.py", "config.py"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment