Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b390fe7dd8 | |||
| fe0414cc59 | |||
| 48a1eba67e | |||
| 714cff7d76 | |||
| 0e8bab5c4c | |||
| 387e6e4986 | |||
| 6a7af1c30f |
@@ -0,0 +1,14 @@
|
||||
import sys
|
||||
from PyQt5.QtCore import *
|
||||
|
||||
|
||||
def enc(s):
|
||||
ba = qCompress(QByteArray(s.encode()))
|
||||
ba = ba.toBase64(QByteArray.Base64Option.Base64UrlEncoding | QByteArray.Base64Option.OmitTrailingEquals)
|
||||
print('vpn://' + str(ba, 'utf-8'))
|
||||
|
||||
s = ''
|
||||
for line in sys.stdin:
|
||||
s += line
|
||||
s = s.strip()
|
||||
enc(s)
|
||||
+53
-2
@@ -1005,6 +1005,7 @@ class Bot
|
||||
'mtproto' => file_get_contents('/config/mtprotosecret'),
|
||||
'xray' => json_decode(file_get_contents('/config/xray.json'), true),
|
||||
'oc' => file_get_contents('/config/ocserv.conf'),
|
||||
'ocu' => file_get_contents('/config/ocserv.passwd'),
|
||||
|
||||
];
|
||||
return json_encode($conf, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
@@ -1061,6 +1062,9 @@ class Bot
|
||||
if ($this->getPacConf()['amnezia'] != $json['pac']['amnezia']) {
|
||||
$switch_amnezia = 1;
|
||||
}
|
||||
if ($this->getPacConf()['wg1_amnezia'] != $json['pac']['wg1_amnezia']) {
|
||||
$switch_wg1amnezia = 1;
|
||||
}
|
||||
$this->setPacConf($json['pac']);
|
||||
$out[] = 'update naiveproxy';
|
||||
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
||||
@@ -1082,7 +1086,7 @@ class Bot
|
||||
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
||||
$this->wg = 1;
|
||||
$this->saveClients($json['wg1']['clients']);
|
||||
$this->restartWG($this->createConfig($json['wg1']['server']), $switch_amnezia);
|
||||
$this->restartWG($this->createConfig($json['wg1']['server']), $switch_wg1amnezia);
|
||||
$this->iptablesWG();
|
||||
}
|
||||
// ad
|
||||
@@ -1126,6 +1130,7 @@ class Bot
|
||||
if (!empty($json['oc'])) {
|
||||
$out[] = 'update ocserv';
|
||||
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
|
||||
file_put_contents('/config/ocserv.passwd', $json['ocu']);
|
||||
$this->restartOcserv($json['oc']);
|
||||
}
|
||||
if (!empty($json['pac']['domain'])) {
|
||||
@@ -2533,14 +2538,60 @@ DNS-over-HTTPS with IP:
|
||||
$this->menu('client', "{$k}_$page");
|
||||
}
|
||||
|
||||
public function getAmneziaShortLink($client)
|
||||
{
|
||||
$dns = explode(',', $client['interface']['DNS']);
|
||||
$c = json_encode([
|
||||
"containers" => [
|
||||
[
|
||||
"awg" => [
|
||||
"isThirdPartyConfig" => True,
|
||||
"last_config" => json_encode([
|
||||
"H1" => "{$client['interface']['H1']}",
|
||||
"H2" => "{$client['interface']['H2']}",
|
||||
"H3" => "{$client['interface']['H3']}",
|
||||
"H4" => "{$client['interface']['H4']}",
|
||||
"Jc" => "{$client['interface']['Jc']}",
|
||||
"Jmax" => "{$client['interface']['Jmax']}",
|
||||
"Jmin" => "{$client['interface']['Jmin']}",
|
||||
"S1" => "{$client['interface']['S1']}",
|
||||
"S2" => "{$client['interface']['S2']}",
|
||||
"client_ip" => explode('/', $client['interface']['Address'])[0],
|
||||
"client_priv_key" => $client['interface']['PrivateKey'],
|
||||
"client_pub_key" => "0",
|
||||
"config" => $this->createConfig($client),
|
||||
"hostName" => $this->ip,
|
||||
"port" => (int) getenv('WG1PORT'),
|
||||
"psk_key" => $client['peers'][0]['PresharedKey'],
|
||||
"server_pub_key" => $client['peers'][0]['PublicKey']
|
||||
]),
|
||||
"port" => (int) getenv('WG1PORT'),
|
||||
"transport_proto" => "udp"
|
||||
],
|
||||
"container" => "amnezia-awg"
|
||||
]
|
||||
],
|
||||
"defaultContainer" => "amnezia-awg",
|
||||
"description" => $client['interface']['## name'],
|
||||
"dns1" => $dns[0],
|
||||
"dns2" => $dns[1] ?: '',
|
||||
"hostName" => $this->ip
|
||||
]);
|
||||
exec("echo '$c' | python amnezia.py", $o);
|
||||
return $o[0];
|
||||
}
|
||||
|
||||
public function getClient($client, $page)
|
||||
{
|
||||
$clients = $this->readClients();
|
||||
if ($clients) {
|
||||
$name = $this->getName($clients[$client]['interface']);
|
||||
$conf = $this->createConfig($clients[$client]);
|
||||
if ($this->getInstanceWG(1)) {
|
||||
$sl = $this->getAmneziaShortLink($clients[$client]);
|
||||
}
|
||||
return [
|
||||
'text' => "<code>$conf</code>\n\n<b>$name</b> ({$this->getTitleWG()})",
|
||||
'text' => "<pre>$conf</pre>\n\n<code>$sl</code>\n\n<b>$name</b> ({$this->getTitleWG()})",
|
||||
'data' => [
|
||||
[
|
||||
[
|
||||
|
||||
+1
-1
@@ -243,7 +243,7 @@ $i = [
|
||||
],
|
||||
'backup' => [
|
||||
'en' => 'auto backup',
|
||||
'ru' => 'бэкап',
|
||||
'ru' => 'автобэкап',
|
||||
],
|
||||
'logs' => [
|
||||
'en' => 'logs',
|
||||
|
||||
+2
-2
@@ -83,7 +83,7 @@ services:
|
||||
ipv4_address: 10.10.0.2
|
||||
logging: *default-logging
|
||||
php:
|
||||
image: mercurykd/vpnbot-php:1.1
|
||||
image: mercurykd/vpnbot-php:1.2
|
||||
build:
|
||||
dockerfile: dockerfile/php.dockerfile
|
||||
args:
|
||||
@@ -396,7 +396,7 @@ services:
|
||||
ipv4_address: 10.10.0.9
|
||||
logging: *default-logging
|
||||
oc:
|
||||
image: mercurykd/vpnbot-oc:1.1
|
||||
image: mercurykd/vpnbot-oc:1.2
|
||||
build:
|
||||
dockerfile: dockerfile/ocserv.dockerfile
|
||||
args:
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
ARG image
|
||||
FROM $image
|
||||
RUN apk add --update openssh iptables \
|
||||
&& apk add --no-cache --virtual .build-deps \
|
||||
curl \
|
||||
g++ \
|
||||
RUN apk add --update openssh \
|
||||
iptables \
|
||||
gnutls-dev \
|
||||
gpgme \
|
||||
libev-dev \
|
||||
libnl3-dev \
|
||||
libseccomp-dev \
|
||||
linux-headers \
|
||||
linux-pam-dev \
|
||||
lz4-dev \
|
||||
libseccomp-dev \
|
||||
&& apk add --no-cache --virtual .build-deps \
|
||||
xz \
|
||||
linux-headers \
|
||||
libnl3-dev \
|
||||
g++ \
|
||||
gpgme \
|
||||
curl \
|
||||
make \
|
||||
readline-dev \
|
||||
tar \
|
||||
xz \
|
||||
autoconf \
|
||||
automake \
|
||||
gperf \
|
||||
|
||||
@@ -19,6 +19,7 @@ RUN apk add --no-cache --update php81 \
|
||||
openssh \
|
||||
openssl \
|
||||
curl \
|
||||
py3-qt5 \
|
||||
&& wget https://github.com/ameshkov/dnslookup/releases/download/v1.9.1/dnslookup-linux-amd64-v1.9.1.tar.gz \
|
||||
&& tar -xf dnslookup-linux-amd64-v1.9.1.tar.gz \
|
||||
&& mv linux-amd64/dnslookup /usr/bin \
|
||||
|
||||
@@ -4,8 +4,8 @@ Requires=docker.service
|
||||
After=docker.service
|
||||
[Service]
|
||||
WorkingDirectory=/root/vpnbot
|
||||
ExecStart=/bin/sh -c "IP=$(ip -4 addr | sed -ne 's|^.* inet \([^/]*\)/.* scope global.*$|\1|p' | awk '{print $1}' | head -1) docker compose up --build --force-recreate"
|
||||
ExecStop=/usr/bin/docker compose down
|
||||
ExecStart=/bin/sh -c "IP=$(curl https://ipinfo.io/ip) VER=$(git describe --tags) docker compose up -d --force-recreate && bash ./update/update.sh &"
|
||||
ExecStop=/bin/sh -c "kill -9 $(cat ./update/update_pid) > /dev/null && docker compose down --remove-orphans"
|
||||
TimeoutStartSec=0
|
||||
Restart=on-failure
|
||||
[Install]
|
||||
|
||||
Reference in New Issue
Block a user