diff --git a/app/bot.php b/app/bot.php index 16bab3c..0e2200c 100644 --- a/app/bot.php +++ b/app/bot.php @@ -728,11 +728,11 @@ class Bot public function restartTG() { $secret = file_get_contents('/config/mtprotosecret'); - $fakedomain = file_get_contents('/config/mtprotodomain') ?: 'vk.com'; + $fakedomain = file_get_contents('/config/mtprotodomain') ?: 'yandex.ru'; $this->ssh('pkill mtproto-proxy', 'tg'); if (preg_match('~^\w{32}$~', $secret)) { $p = getenv('TGPORT'); - $this->ssh("mtproto-proxy --domain $fakedomain -u nobody -H $p --nat-info 10.10.0.8:{$this->ip} -S $secret --aes-pwd /proxy-secret /proxy-multi.conf -M 1 >/dev/null 2>&1 &", 'tg'); + $this->ssh("mtproto-proxy --domain $fakedomain -u nobody -H $p --nat-info 10.10.0.8:{$this->ip} -S $secret --aes-pwd /proxy-secret /proxy-multi.conf -M 1", 'tg', false, '/logs/mtproto'); } } @@ -820,15 +820,15 @@ class Bot { $s = file_get_contents('/config/mtprotosecret'); $p = getenv('TGPORT'); - $d = trim(file_get_contents('/config/mtprotodomain') ?: 'vk.com'); + $d = trim(file_get_contents('/config/mtprotodomain') ?: 'yandex.ru'); $d = exec("echo $d | tr -d '\\n' | xxd -ps -c 200"); - $ip = $this->getPacConf()['domain'] ?: $this->ip; + $ip = $this->getDomain(); return "https://t.me/proxy?server=$ip&port=$p&secret=ee$s$d"; } public function mtproto() { - $d = file_get_contents('/config/mtprotodomain') ?: 'vk.com'; + $d = file_get_contents('/config/mtprotodomain') ?: 'yandex.ru'; $st = $this->ssh('pgrep mtproto-proxy', 'tg') ? 'on' : 'off'; $text[] = "Menu -> MTProto\n"; $text[] = "status: $st\n"; @@ -9077,7 +9077,7 @@ DNS-over-HTTPS with IP: $x = $this->getXray(); $h = $this->getHashBot(); - $p['reality']['domain'] = $p['reality']['domain'] ?: 'web.telegram.org'; + $p['reality']['domain'] = $p['reality']['domain'] ?: 'yandex.ru'; $p['reality']['destination'] = $p['reality']['destination'] ?: $p['reality']['domain'] . ':443'; $p['transport'] = $transport; diff --git a/docker-compose.yml b/docker-compose.yml index c87e5c4..10b3e0e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -325,15 +325,16 @@ services: entrypoint: ["/bin/sh", "/start_ad.sh"] logging: *default-logging tg: - image: mercurykd/vpnbot-tg:1.2 + image: mercurykd/vpnbot-tg:1.3 build: dockerfile: dockerfile/telegram.dockerfile volumes: - - ./config/.profile:/root/.ashrc:ro + - ./config/.profile:/root/.bashrc:ro - ./ssh:/ssh - ./config/sshd_config:/etc/ssh/sshd_config - ./scripts/start_tg.sh:/start_tg.sh - ./config/mtprotosecret:/mtprotosecret + - ./logs/:/logs/ hostname: telegram container_name: mtproto-${VER} depends_on: diff --git a/dockerfile/telegram.dockerfile b/dockerfile/telegram.dockerfile index 3ae5468..73dbc08 100644 --- a/dockerfile/telegram.dockerfile +++ b/dockerfile/telegram.dockerfile @@ -1,13 +1,33 @@ -FROM alpine:3.6 -RUN apk add --no-cache --virtual .build-deps alpine-sdk linux-headers openssl-dev \ - && git clone --single-branch --depth 1 https://github.com/TelegramMessenger/MTProxy.git /mtproxy/sources \ - && mkdir /mtproxy/patches && wget -P /mtproxy/patches https://raw.githubusercontent.com/alexdoesh/mtproxy/master/patches/randr_compat.patch \ - && cd /mtproxy/sources && patch -p0 -i /mtproxy/patches/randr_compat.patch \ - && make \ - && mkdir /root/.ssh \ - && cp /mtproxy/sources/objs/bin/mtproto-proxy /usr/bin \ - && rm -rf /mtproxy \ - && apk del .build-deps\ - && apk add --no-cache --update curl openssh \ - && ln -s /usr/lib/libcrypto.so.41 /usr/lib/libcrypto.so.1.0.0 -ENV ENV="/root/.ashrc" +# Build stage +FROM ubuntu:22.04 AS builder + +RUN apt-get update && apt-get install -y --no-install-recommends \ + git \ + build-essential \ + libssl-dev \ + zlib1g-dev \ + ca-certificates \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /src +RUN git clone --single-branch --depth 1 https://github.com/GetPageSpeed/MTProxy . \ + && make -j$(nproc) \ + && strip objs/bin/mtproto-proxy + +# Runtime stage - minimal Ubuntu +FROM ubuntu:22.04 + +RUN apt-get update && apt-get install -y --no-install-recommends \ + libssl3 \ + zlib1g \ + curl \ + openssh-client \ + openssh-server \ + ca-certificates \ + vim-common \ + && rm -rf /var/lib/apt/lists/* \ + && mkdir -p /root/.ssh /var/run/sshd + +COPY --from=builder /src/objs/bin/mtproto-proxy /usr/local/bin/mtproto-proxy + +ENV PATH="/usr/local/bin:$PATH" diff --git a/scripts/start_tg.sh b/scripts/start_tg.sh index 151b71f..fbec13d 100755 --- a/scripts/start_tg.sh +++ b/scripts/start_tg.sh @@ -1,4 +1,3 @@ -echo 'root:dummy_passwd'|chpasswd cat /ssh/key.pub > /root/.ssh/authorized_keys ssh-keygen -A exec /usr/sbin/sshd -D -e "$@" &