Compare commits

...

20 Commits

Author SHA1 Message Date
mercury 6a7af1c30f fix import wg1 2024-03-05 00:14:36 +04:00
mercury 2a17b4f1f3 update version 2024-03-04 23:30:46 +04:00
mercury d005ccc919 fix start wg1 2024-03-04 23:26:09 +04:00
mercury 5df89e7f89 syncport fix 2024-03-04 16:51:18 +04:00
mercury f6d72800cb white ip 2024-03-04 16:38:37 +04:00
mercury 4ff1929a22 improve makefile 2024-03-03 19:53:52 +04:00
mercury 46d54ffeee fix gitignore 2024-03-03 19:45:57 +04:00
mercury 20cde272dd update self 2024-03-03 19:29:21 +04:00
mercury 4270ee5b23 update version 2024-03-02 15:56:18 +04:00
mercury cdcd6a7931 check webhook 2024-03-02 15:05:21 +04:00
mercury f360091c1a improve makefile 2024-03-02 00:30:12 +04:00
mercury 3e52c3650e two instance wireguard 2024-03-02 00:14:13 +04:00
mercury 757c704d38 update version 2024-03-01 11:50:51 +04:00
mercury 7c9f4d9815 fix iptables wg 2024-03-01 11:27:36 +04:00
mercury 9bfa7bd0c7 fix import 2024-03-01 02:48:24 +04:00
mercury d8620ef4f2 update version 2024-03-01 02:37:22 +04:00
mercury d4b9c4af48 fix long domain set 2024-03-01 02:17:29 +04:00
mercury c115661529 images from hub 2024-02-29 00:10:00 +04:00
mercury e0ee25127f update version 2024-02-28 15:22:16 +04:00
mercury ae2e9c0205 mirror 2024-02-28 14:53:11 +04:00
26 changed files with 600 additions and 157 deletions
+4 -2
View File
@@ -1,8 +1,10 @@
TZ=Europe/Samara
WGADDRESS=10.0.1.1/24
WGPORT=51820
WG1ADDRESS=10.0.3.1/24
WG1PORT=51821
SSPORT=8388
TGPORT=4443
SYSTEM=ubuntu
RELEASE=18.04
IMAGE=alpine:3.18.2
IP=
VER=
+3
View File
@@ -15,3 +15,6 @@
!/app/zapretlists/.gitkeep
.vscode/
.idea/
mirror/.env
update/*
!update/update.sh
+276 -95
View File
@@ -4,6 +4,7 @@ class Bot
{
public $input;
public $adguard;
public $update;
public function __construct($key, $i18n)
{
@@ -11,6 +12,7 @@ class Bot
$this->api = "https://api.telegram.org/bot$key/";
$this->file = "https://api.telegram.org/file/bot$key/";
$this->clients = '/config/clients.json';
$this->clients1 = '/config/clients1.json';
$this->pac = '/config/pac.json';
$this->ip = getenv('IP');
$this->i18n = $i18n;
@@ -18,6 +20,7 @@ class Bot
$this->dns = '1.1.1.1, 8.8.8.8';
$this->limit = $this->getPacConf()['limitpage'] ?: 5;
$this->adguard = '/config/AdGuardHome.yaml';
$this->update = '/update/json';
}
public function input()
@@ -117,16 +120,25 @@ class Bot
case preg_match('~^/menu (?P<type>addpeer) (?P<arg>(?:-)?\d+)$~', $this->input['callback'], $m):
case preg_match('~^/menu (?P<type>wg) (?P<arg>(?:-)?\d+)$~', $this->input['callback'], $m):
case preg_match('~^/menu (?P<type>client) (?P<arg>\d+(?:_(?:-)?\d+)?)$~', $this->input['callback'], $m):
case preg_match('~^/menu (?P<type>pac|adguard|config|ss|lang|oc|naive)$~', $this->input['callback'], $m):
case preg_match('~^/menu (?P<type>pac|adguard|config|ss|lang|oc|naive|mirror)$~', $this->input['callback'], $m):
case preg_match('~^/menu (?P<type>subzoneslist|reverselist|includelist|excludelist) (?P<arg>(?:-)?\d+)$~', $this->input['callback'], $m):
$this->menu(type: $m['type'] ?? false, arg: $m['arg'] ?? false);
break;
case preg_match('~^/changeWG (\d+)$~', $this->input['callback'], $m):
$this->changeWG($m[1]);
break;
case preg_match('~^/id$~', $this->input['message'], $m):
$this->send($this->input['chat'], $this->input['from'], $this->input['message_id']);
break;
case preg_match('~^/mtproto$~', $this->input['callback'], $m):
$this->mtproto();
break;
case preg_match('~^/updatebot$~', $this->input['callback'], $m):
$this->updatebot();
break;
case preg_match('~^/getMirror$~', $this->input['callback'], $m):
$this->getMirror();
break;
case preg_match('~^/logs$~', $this->input['callback'], $m):
$this->logs();
break;
@@ -930,12 +942,15 @@ class Bot
public function shutdownClient()
{
try {
$clients = $this->readClients();
if ($clients) {
foreach ($clients as $k => $v) {
if (!empty($v['interface']['## time'])) {
if (strtotime($v['interface']['## time']) < time()) {
$this->switchClient($k);
for ($i=0; $i < 2; $i++) {
$this->wg = $i;
$clients = $this->readClients();
if ($clients) {
foreach ($clients as $k => $v) {
if (!empty($v['interface']['## time'])) {
if (strtotime($v['interface']['## time']) < time()) {
$this->switchClient($k);
}
}
}
}
@@ -961,16 +976,24 @@ class Bot
public function readClients(): array
{
return json_decode(file_get_contents($this->clients), true) ?: [];
return json_decode(file_get_contents($this->getInstanceWG(1) ? $this->clients1 : $this->clients), true) ?: [];
}
public function export()
{
$this->wg = 0;
$wg = [
'server' => $this->readConfig(),
'clients' => json_decode(file_get_contents($this->clients), true) ?: [],
];
$this->wg = 1;
$wg1 = [
'server' => $this->readConfig(),
'clients' => json_decode(file_get_contents($this->clients1), true) ?: [],
];
$conf = [
'wg' => [
'server' => $this->readConfig(),
'clients' => json_decode(file_get_contents($this->clients), true) ?: [],
],
'wg' => $wg,
'wg1' => $wg1,
'ss' => $this->getSSConfig(),
'sl' => $this->getSSLocalConfig(),
'ad' => yaml_parse_file($this->adguard),
@@ -987,10 +1010,14 @@ class Bot
return json_encode($conf, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
}
public function exportManual()
public function exportManual($file = false)
{
$json = $this->export();
if (!empty($file)) {
file_put_contents($file, $json);
}
$bot = $this->request('getMyName', [])['result']['name'];
return $this->upload("{$bot}_export_" . date('d_m_Y_H_i') . '.json', $this->export());
return $this->upload("{$bot}_export_" . date('d_m_Y_H_i') . '.json', $json);
}
public function import()
@@ -1009,10 +1036,14 @@ class Bot
];
}
public function importFile()
public function importFile($file = false)
{
$r = $this->request('getFile', ['file_id' => $this->input['file_id']]);
$json = json_decode(file_get_contents($this->file . $r['result']['file_path']), true);
if (!empty($file)) {
$json = json_decode(file_get_contents($file), true);
} else {
$r = $this->request('getFile', ['file_id' => $this->input['file_id']]);
$json = json_decode(file_get_contents($this->file . $r['result']['file_path']), true);
}
if (empty($json) || !is_array($json)) {
$this->answer($this->input['callback_id'], 'error', true);
} else {
@@ -1030,6 +1061,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));
@@ -1040,8 +1074,19 @@ class Bot
if (!empty($json['wg'])) {
$out[] = 'update wireguard';
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
$this->wg = 0;
$this->saveClients($json['wg']['clients']);
$this->restartWG($this->createConfig($json['wg']['server']), $switch_amnezia);
$this->iptablesWG();
}
// wg1
if (!empty($json['wg1'])) {
$out[] = 'update wireguard 1';
$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_wg1amnezia);
$this->iptablesWG();
}
// ad
if (!empty($json['ad'])) {
@@ -1096,7 +1141,7 @@ class Bot
$t = file_get_contents('/config/nginx_default.conf');
if (!empty($json['pac']['domain'])) {
$t = preg_replace('/server_name([^\n]+)?/', "server_name {$json['pac']['domain']};", $t);
$t = preg_replace('/server_name ([^\n]+)?/', "server_name {$json['pac']['domain']};", $t);
preg_match_all('~#-domain.+?#-domain~s', $t, $m);
foreach ($m[0] as $k => $v) {
$t = preg_replace('~#-domain.+?#-domain~s', $this->uncomment($v, 'domain'), $t, 1);
@@ -1116,8 +1161,12 @@ class Bot
$out[] = "end import";
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
$this->language = $this->getPacConf()['language'] ?: 'en';
$this->limit = $this->getPacConf()['limitpage'] ?: 5;
sleep(3);
$this->menu();
if (empty($file)) {
$this->menu();
}
}
}
@@ -1165,14 +1214,14 @@ class Bot
public function switchAmnezia($page = 0)
{
$c = $this->getPacConf();
$c['amnezia'] = $c['amnezia'] ? 0 : 1;
$amnezia = $c[$this->getInstanceWG(1) . 'amnezia'] = $c[$this->getInstanceWG(1) . 'amnezia'] ? 0 : 1;
$this->setPacConf($c);
$pk = $this->presharedKey();
$ak = $this->amneziaKeys();
$clients = $this->readClients();
foreach ($clients as $k => $v) {
if (!empty($c['amnezia'])) {
if (!empty($amnezia)) {
$clients[$k]['peers'][0]['PresharedKey'] = $pk;
$clients[$k]['interface']['Jc'] = $ak['Jc'];
$clients[$k]['interface']['Jmin'] = $ak['Jmin'];
@@ -1199,7 +1248,7 @@ class Bot
$this->saveClients($clients);
$wg = $this->readConfig();
if (!empty($c['amnezia'])) {
if (!empty($amnezia)) {
$wg['interface']['Jc'] = $ak['Jc'];
$wg['interface']['Jmin'] = $ak['Jmin'];
$wg['interface']['Jmax'] = $ak['Jmax'];
@@ -1222,7 +1271,7 @@ class Bot
}
foreach ($wg['peers'] as $k => $v) {
if (!empty($c['amnezia'])) {
if (!empty($amnezia)) {
$wg['peers'][$k]['PresharedKey'] = $pk;
} else {
unset($wg['peers'][$k]['PresharedKey']);
@@ -1232,30 +1281,34 @@ class Bot
$this->menu('wg', $page);
}
public function switchTorrent($page)
public function switchTorrent($page = 0, $restart = false)
{
$c = $this->getPacConf();
$c['blocktorrent'] = $c['blocktorrent'] ? 0 : 1;
$c[$this->getInstanceWG(1) . 'blocktorrent'] = $c[$this->getInstanceWG(1) . 'blocktorrent'] ? 0 : 1;
$this->setPacConf($c);
if ($c['blocktorrent']) {
$this->ssh('bash /block_torrent.sh');
} else {
$this->ssh('bash /unblock_torrent.sh');
}
$this->answer($this->input['callback_id'], 'доступ к торрентам ' . ($c['blocktorrent'] ? 'заблокирован' : 'разблокирован'), true);
$this->iptablesWG();
$this->answer($this->input['callback_id'], 'доступ к торрентам ' . ($c[$this->getInstanceWG(1) . 'blocktorrent'] ? 'заблокирован' : 'разблокирован'), true);
$this->menu('wg', $page);
}
public function iptablesWG()
{
$c = $this->getPacConf();
$this->ssh('iptables -F', $this->getInstanceWG());
if ($c['exchange']) {
$this->ssh('bash /block_exchange.sh', $this->getInstanceWG());
}
if ($c['blocktorrent']) {
$this->ssh('bash /block_torrent.sh', $this->getInstanceWG());
}
}
public function switchExchange($page)
{
$c = $this->getPacConf();
$c['exchange'] = $c['exchange'] ? 0 : 1;
$c[$this->getInstanceWG(1) . 'exchange'] = $c[$this->getInstanceWG(1) . 'exchange'] ? 0 : 1;
$this->setPacConf($c);
if ($c['exchange']) {
$this->ssh('bash /block_exchange.sh');
} else {
$this->ssh('bash /unblock_exchange.sh');
}
$this->answer($this->input['callback_id'], 'обмен между пользователями ' . ($c['exchange'] ? 'заблокирован' : 'разблокирован'), true);
$this->iptablesWG();
$this->answer($this->input['callback_id'], 'обмен между пользователями ' . ($c[$this->getInstanceWG(1) . 'exchange'] ? 'заблокирован' : 'разблокирован'), true);
$this->menu('wg', $page);
}
@@ -1399,7 +1452,7 @@ class Bot
$conf = $this->getPacConf();
$conf['domain'] = idn_to_ascii($domain);
$nginx = file_get_contents('/config/nginx.conf');
$t = preg_replace('/server_name([^\n]+)?/', "server_name {$conf['domain']};", $nginx);
$t = preg_replace('/server_name ([^\n]+)?/', "server_name {$conf['domain']};", $nginx);
preg_match_all('~#-domain.+?#-domain~s', $t, $m);
foreach ($m[0] as $k => $v) {
$t = preg_replace('~#-domain.+?#-domain~s', $this->uncomment($v, 'domain'), $t, 1);
@@ -2115,15 +2168,22 @@ DNS-over-HTTPS with IP:
return $text;
}
public function getTitleWG()
{
$c = $this->getPacConf();
return $this->i18n($c[$this->getInstanceWG(1) . 'amnezia'] ? 'amnezia' : 'wg_title') . ' ' . $c['wg_instance'];
}
public function statusWg(int $page = 0)
{
$c = $this->getPacConf();
$conf = $this->readConfig();
$status = $this->readStatus();
$clients = $this->getClients($page);
$bt = $this->getPacConf()['blocktorrent'];
$ex = $this->getPacConf()['exchange'];
$dns = $this->getPacConf()['dns'];
$am = $this->getPacConf()['amnezia'];
$bt = $c[$this->getInstanceWG(1) . 'blocktorrent'];
$ex = $c[$this->getInstanceWG(1) . 'exchange'];
$dns = $c[$this->getInstanceWG(1) . 'dns'];
$am = $c[$this->getInstanceWG(1) . 'amnezia'];
$data = [
[
[
@@ -2204,7 +2264,7 @@ DNS-over-HTTPS with IP:
]);
}
}
$text = "Menu -> Wireguard\n\n<code>" . implode(PHP_EOL, $text ?: []) . '</code>';
$text = "Menu -> " . $this->getTitleWG() . "\n\n<code>" . implode(PHP_EOL, $text ?: []) . '</code>';
$data[] = [
[
'text' => $this->i18n('update status'),
@@ -2241,9 +2301,9 @@ DNS-over-HTTPS with IP:
{
$c = $this->getPacConf();
if ($text) {
$c['dns'] = $text;
$c[$this->getInstanceWG(1) . 'dns'] = $text;
} else {
unset($c['dns']);
unset($c[$this->getInstanceWG(1) . 'dns']);
}
$this->setPacConf($c);
$this->menu('wg', $page);
@@ -2483,7 +2543,7 @@ DNS-over-HTTPS with IP:
$name = $this->getName($clients[$client]['interface']);
$conf = $this->createConfig($clients[$client]);
return [
'text' => "<code>$conf</code>\n\n<b>$name</b>",
'text' => "<code>$conf</code>\n\n<b>$name</b> ({$this->getTitleWG()})",
'data' => [
[
[
@@ -2890,30 +2950,28 @@ DNS-over-HTTPS with IP:
return $this->i18n[$menu][$this->language] ?: $menu;
}
public function changeWG($i)
{
$c = $this->getPacConf();
$c['wg_instance'] = $i;
$this->setPacConf($c);
$this->menu('wg', 0);
}
public function menu($type = false, $arg = false, $return = false)
{
$menu = [
'main' => [
'text' => $this->i18n('menu'),
'text' => 'v' . getenv('VER'),
'data' => [
[
[
'text' => $this->i18n($this->getPacConf()['amnezia'] ? 'amnezia' : 'wg_title'),
'callback_data' => "/menu wg 0",
'callback_data' => "/changeWG 0",
],
[
'text' => $this->i18n('ad_title'),
'callback_data' => "/menu adguard",
],
],
[
[
'text' => $this->i18n('sh_title'),
'callback_data' => "/menu ss",
],
[
'text' => $this->i18n('ocserv'),
'callback_data' => "/menu oc",
'text' => $this->i18n($this->getPacConf()['wg1_amnezia'] ? 'amnezia' : 'wg_title'),
'callback_data' => "/changeWG 1",
],
],
[
@@ -2921,6 +2979,16 @@ DNS-over-HTTPS with IP:
'text' => $this->i18n('xray'),
'callback_data' => "/xray",
],
[
'text' => $this->i18n('naive'),
'callback_data' => "/menu naive",
],
],
[
[
'text' => $this->i18n('ocserv'),
'callback_data' => "/menu oc",
],
[
'text' => $this->i18n('mtproto'),
'callback_data' => "/mtproto",
@@ -2928,8 +2996,18 @@ DNS-over-HTTPS with IP:
],
[
[
'text' => $this->i18n('naive'),
'callback_data' => "/menu naive",
'text' => $this->i18n('sh_title'),
'callback_data' => "/menu ss",
],
[
'text' => $this->i18n('mirror'),
'callback_data' => "/menu mirror",
],
],
[
[
'text' => $this->i18n('ad_title'),
'callback_data' => "/menu adguard",
],
[
'text' => $this->i18n('pac'),
@@ -2951,7 +3029,7 @@ DNS-over-HTTPS with IP:
'text' => $this->i18n('donate'),
'url' => "https://yoomoney.ru/to/410011827900450",
],
]
],
],
],
'wg' => $type == 'wg' ? $this->statusWg($arg) : false,
@@ -2968,6 +3046,7 @@ DNS-over-HTTPS with IP:
'lang' => $type == 'lang' ? $this->menuLang() : false,
'oc' => $type == 'oc' ? $this->ocMenu() : false,
'naive' => $type == 'naive' ? $this->naiveMenu() : false,
'mirror' => $type == 'mirror' ? $this->mirrorMenu() : false,
];
$text = $menu[$type ?: 'main' ]['text'];
@@ -3034,6 +3113,72 @@ DNS-over-HTTPS with IP:
];
}
public function mirrorMenu()
{
$ip = $this->getPacConf()['domain'] ?: $this->ip;
$hash = substr(md5($this->key), 0, 8);
$scheme = empty($this->nginxGetTypeCert()) ? 'http' : 'https';
$text[] = "Menu -> Mirror";
$text[] = <<<PNG
<pre>client -> intermediate VPS -> vpnbot
^ |
| install |
| mirror |
-----------
</pre>
PNG;
$text[] = "<code>$scheme://$ip/pac?h=$hash&t=mirror</code>";
$data[] = [
[
'text' => $this->i18n('download'),
'callback_data' => "/getMirror",
],
];
$data[] = [
[
'text' => $this->i18n('back'),
'callback_data' => "/menu",
],
];
return [
'text' => implode("\n", $text),
'data' => $data,
];
}
public function getMirror()
{
unlink('/config/mirror.tar.gz');
unlink('/config/mirror.tar');
$s = file_get_contents('/mirror/start_socat.sh');
$t = preg_replace([
'~{ip}~',
'~{tg}~',
'~{ss}~',
'~{wg}~',
], [
getenv('IP'),
getenv('TGPORT'),
getenv('SSPORT'),
getenv('WGPORT'),
], $s);
file_put_contents('/mirror/start_socat.sh', $t);
$a = new PharData('/config/mirror.tar');
$a->buildFromDirectory('/mirror');
$a->compress(Phar::GZ);
if (!empty($this->input)) {
$this->sendFile($this->input['from'], curl_file_create('/config/mirror.tar.gz'));
} else {
header('Content-Disposition: attachment; filename=mirror.tar.gz');
header('Content-Type: application/tar+gzip');
echo file_get_contents('/config/mirror.tar.gz');
exit;
}
unlink('/config/mirror.tar.gz');
unlink('/config/mirror.tar');
file_put_contents('/mirror/start_socat.sh', $s);
}
public function ocMenu()
{
$pac = $this->getPacConf();
@@ -3212,7 +3357,7 @@ DNS-over-HTTPS with IP:
public function addWg($page)
{
$text = "Menu -> Wireguard -> Add peer\n\n";
$text = "Menu -> {$this->getTitleWG()} -> Add peer\n\n";
$data[] = [
[
'text' => $this->i18n('all traffic'),
@@ -3353,6 +3498,15 @@ DNS-over-HTTPS with IP:
return openssl_x509_parse($c)["validTo_time_t"] ?: false;
}
public function updatebot()
{
$this->exportManual($this->update);
$r = $this->send($this->input['from'], 'update...');
file_put_contents('/update/reload_message', "{$this->input['from']}:{$r['result']['message_id']}");
file_put_contents('/update/pipe', '1');
$this->delete($this->input['from'], $this->input['message_id']);
}
public function configMenu()
{
$conf = $this->getPacConf();
@@ -3463,6 +3617,12 @@ DNS-over-HTTPS with IP:
'callback_data' => "/debug",
],
];
$data[] = [
[
'text' => $this->i18n('update bot'),
'callback_data' => "/updatebot",
],
];
$data[] = [
[
'text' => $this->i18n('back'),
@@ -3624,9 +3784,17 @@ DNS-over-HTTPS with IP:
}
}
public function getInstanceWG($k = false)
{
if (!empty($k)) {
return ($this->wg ?? $this->getPacConf()['wg_instance']) ? 'wg1_' : '';
}
return ($this->wg ?? $this->getPacConf()['wg_instance']) ? 'wg1' : 'wg';
}
public function readConfig()
{
$r = $this->ssh('cat /etc/wireguard/wg0.conf');
$r = $this->ssh('cat /etc/wireguard/wg0.conf', $this->getInstanceWG());
$r = explode(PHP_EOL, $r);
$r = array_filter($r);
$i = 0;
@@ -3664,7 +3832,7 @@ DNS-over-HTTPS with IP:
public function readStatus()
{
$r = $this->ssh($this->getWGType());
$r = $this->ssh($this->getWGType(), $this->getInstanceWG());
$r = explode(PHP_EOL, $r);
$r = array_filter($r);
$i = 0;
@@ -3709,7 +3877,7 @@ DNS-over-HTTPS with IP:
$conf[] = "[Interface]";
if (empty($data['interface']['ListenPort'])) {
if (empty($data['interface']['DNS'])) {
$data['interface']['DNS'] = $this->getPacConf()['dns'] ?: $this->dns;
$data['interface']['DNS'] = $this->getPacConf()[$this->getInstanceWG(1) . 'dns'] ?: $this->dns;
}
}
foreach ($data['interface'] as $k => $v) {
@@ -3721,7 +3889,7 @@ DNS-over-HTTPS with IP:
$conf[] = '';
$conf[] = $peer['# PublicKey'] ? '# [Peer]' : '[Peer]';
if (!empty($peer['Endpoint'])) {
$peer['Endpoint'] = ($pac['domain'] && !$pac['amnezia'] ? $pac['domain'] : $this->ip) . ":" . getenv('WGPORT');
$peer['Endpoint'] = ($pac['domain'] && !$pac[$this->getInstanceWG(1) . 'amnezia'] ? $pac['domain'] : $this->ip) . ":" . getenv($this->getInstanceWG(1) ? 'WG1PORT' : 'WGPORT');
}
foreach ($peer as $k => $v) {
$conf[] = "$k = $v";
@@ -3734,18 +3902,18 @@ DNS-over-HTTPS with IP:
public function presharedKey()
{
$c = $this->getPacConf();
if (empty($c['presharedkey'])) {
$c['presharedkey'] = trim($this->ssh("{$this->getWGType()} genpsk"));
if (empty($c[$this->getInstanceWG(1) . 'presharedkey'])) {
$c[$this->getInstanceWG(1) . 'presharedkey'] = trim($this->ssh("{$this->getWGType()} genpsk", $this->getInstanceWG()));
$this->setPacConf($c);
}
return $c['presharedkey'];
return $c[$this->getInstanceWG(1) . 'presharedkey'];
}
public function amneziaKeys()
{
$c = $this->getPacConf();
if (empty($c['amnezia_keys'])) {
$c['amnezia_keys'] = [
if (empty($c[$this->getInstanceWG(1) . 'amnezia_keys'])) {
$c[$this->getInstanceWG(1) . 'amnezia_keys'] = [
'Jc' => rand(3, 10),
'Jmin' => 50,
'Jmax' => 1000,
@@ -3758,7 +3926,7 @@ DNS-over-HTTPS with IP:
];
$this->setPacConf($c);
}
return $c['amnezia_keys'];
return $c[$this->getInstanceWG(1) . 'amnezia_keys'];
}
public function createPeer($ips_user = false, $name = false)
@@ -3781,9 +3949,9 @@ DNS-over-HTTPS with IP:
break;
}
}
$public_server_key = trim($this->ssh("echo {$conf['interface']['PrivateKey']} | {$this->getWGType()} pubkey"));
$private_peer_key = trim($this->ssh("{$this->getWGType()} genkey"));
$public_peer_key = trim($this->ssh("echo $private_peer_key | {$this->getWGType()} pubkey"));
$public_server_key = trim($this->ssh("echo {$conf['interface']['PrivateKey']} | {$this->getWGType()} pubkey", $this->getInstanceWG()));
$private_peer_key = trim($this->ssh("{$this->getWGType()} genkey", $this->getInstanceWG()));
$public_peer_key = trim($this->ssh("echo $private_peer_key | {$this->getWGType()} pubkey", $this->getInstanceWG()));
$name = ($name ? "$name" : '') . time();
@@ -3792,7 +3960,7 @@ DNS-over-HTTPS with IP:
'PublicKey' => $public_peer_key,
'AllowedIPs' => "$client_ip/32",
],
$this->getPacConf()['amnezia'] ? ['PresharedKey' => $this->presharedKey()] : []
$this->getPacConf()[$this->getInstanceWG(1) . 'amnezia'] ? ['PresharedKey' => $this->presharedKey()] : []
);
$client_conf = [
'interface' => array_merge(
@@ -3802,7 +3970,7 @@ DNS-over-HTTPS with IP:
'Address' => "$client_ip/32",
'MTU' => 1350,
],
$this->getPacConf()['amnezia'] ? $this->amneziaKeys() : []
$this->getPacConf()[$this->getInstanceWG(1) . 'amnezia'] ? $this->amneziaKeys() : []
),
'peers' => [
array_merge(
@@ -3811,7 +3979,7 @@ DNS-over-HTTPS with IP:
'AllowedIPs' => $ips_user ?: "0.0.0.0/0",
'PersistentKeepalive' => 20,
],
$this->getPacConf()['amnezia'] ? ['PresharedKey' => $this->presharedKey()] : []
$this->getPacConf()[$this->getInstanceWG(1) . 'amnezia'] ? ['PresharedKey' => $this->presharedKey()] : []
),
],
];
@@ -3836,39 +4004,47 @@ DNS-over-HTTPS with IP:
public function syncPortClients()
{
$endpoint = $this->ip . ':' . getenv('WGPORT');
$clients = $this->readClients();
foreach ($clients as $k => $v) {
foreach ($v['peers'] as $i => $j) {
$clients[$k]['peers'][$i]['Endpoint'] = $endpoint;
$endpoint = [
$this->ip . ':' . getenv('WGPORT'),
$this->ip . ':' . getenv('WG1PORT'),
];
for ($i=0; $i < 2; $i++) {
$this->wg = $i;
$clients = $this->readClients();
foreach ($clients as $k => $v) {
foreach ($v['peers'] as $i => $j) {
$clients[$k]['peers'][$i]['Endpoint'] = $endpoint[$i];
}
}
$this->saveClients($clients);
}
$this->saveClients($clients);
unset($this->wg);
}
public function saveClients(array $clients)
{
$domain = ($this->getPacConf()['domain'] ?: $this->ip) . ":" . getenv('WGPORT');
$c = $this->getPacConf();
$domain = ($c['domain'] ?: $this->ip) . ":" . getenv($this->getInstanceWG(1) ? 'WG1PORT' : 'WGPORT');
foreach ($clients as $k => $v) {
$clients[$k]['peers'][0]['Endpoint'] = $domain;
}
file_put_contents($this->clients, json_encode($clients, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
file_put_contents($this->getInstanceWG(1) ? $this->clients1 : $this->clients, json_encode($clients, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
}
public function getWGType($revert = 0)
{
$wg = $this->getPacConf()['amnezia'];
$wg = $this->getPacConf()[$this->getInstanceWG(1) . 'amnezia'];
return ($revert ? !$wg : $wg) ? 'awg' : 'wg';
}
public function restartWG($conf_str, $switch = false)
{
$this->ssh("echo '$conf_str' > /etc/wireguard/wg0.conf");
$this->ssh("echo '$conf_str' > /etc/wireguard/wg0.conf", $this->getInstanceWG());
if (!empty($switch)) {
$this->ssh("{$this->getWGType(1)}-quick down wg0");
$this->ssh("{$this->getWGType()}-quick up wg0");
$this->ssh("{$this->getWGType(1)}-quick down wg0", $this->getInstanceWG());
$this->ssh("{$this->getWGType()}-quick up wg0", $this->getInstanceWG());
} else {
$this->ssh("{$this->getWGType()} syncconf wg0 <({$this->getWGType()}-quick strip wg0)");
$this->ssh("{$this->getWGType()} syncconf wg0 <({$this->getWGType()}-quick strip wg0)", $this->getInstanceWG());
}
return true;
}
@@ -3930,10 +4106,15 @@ DNS-over-HTTPS with IP:
die('нет айпи');
}
echo "$ip\n";
var_dump($this->request('setWebhook', [
var_dump($r = $this->request('setWebhook', [
'url' => "https://$ip/tlgrm?k={$this->key}",
'certificate' => curl_file_create('/certs/self_public'),
]));
if (!empty($r['result']) && $r['result'] == true) {
file_put_contents('/start', 1);
} else {
die("set webhook fail\n");
}
}
public function setcommands()
+12
View File
@@ -293,4 +293,16 @@ $i = [
'en' => 'dns',
'ru' => 'днс',
],
'mirror' => [
'en' => 'mirror',
'ru' => 'зеркало',
],
'download' => [
'en' => 'download',
'ru' => 'скачать',
],
'update bot' => [
'en' => 'update bot',
'ru' => 'обновить бота',
],
];
+18 -11
View File
@@ -22,17 +22,24 @@ $address = $_GET['a'] ?: '127.0.0.1';
$port = $_GET['p'] ?: '1080';
$hash = $_GET['h'];
if ($hash == substr(md5($c['key']), 0, 8)) {
if (file_exists($file = __DIR__ . "/zapretlists/$type")) {
$pac = file_get_contents($file);
header('Content-Type: text/plain');
echo str_replace([
'~address~',
'~port~',
], [
$address,
$port,
], $pac);
exit;
if ($type == 'mirror') {
require __DIR__ . '/bot.php';
require __DIR__ . '/i18n.php';
$bot = new Bot($c['key'], $i);
$bot->getMirror();
} else {
if (file_exists($file = __DIR__ . "/zapretlists/$type")) {
$pac = file_get_contents($file);
header('Content-Type: text/plain');
echo str_replace([
'~address~',
'~port~',
], [
$address,
$port,
], $pac);
exit;
}
}
}
-6
View File
@@ -11,9 +11,3 @@ $bot = new Bot($c['key'], $i);
$bot->setwebhook();
$bot->setcommands();
$bot->syncPortClients();
if (!empty($c['admin'])) {
$ip = getenv('IP');
foreach ($c['admin'] as $k => $v) {
$bot->send($v, "start $ip");
}
}
+38
View File
@@ -0,0 +1,38 @@
<?php
require __DIR__ . '/timezone.php';
// require __DIR__ . '/debug.php';
require __DIR__ . '/bot.php';
require __DIR__ . '/config.php';
require __DIR__ . '/i18n.php';
$bot = new Bot($c['key'], $i);
if (!empty($c['admin'])) {
$ip = getenv('IP');
$rm = explode(':', trim(file_get_contents('/update/reload_message')));
$m = file_get_contents('/update/message');
foreach ($c['admin'] as $k => $v) {
$r = $bot->send($v, "start $ip");
$bot->input['chat'] = $v;
$bot->input['message_id'] = $r['result']['message_id'];
if (file_exists($bot->update)) {
if (!empty($m)) {
$bot->send($v, "<pre>$m</pre>", $v == $rm[0] ? $rm[1] : 0);
}
$r = $bot->send($v, "import settings");
$bot->input['chat'] = $v;
$bot->input['message_id'] = $r['result']['message_id'];
$bot->input['callback_id'] = $r['result']['message_id'];
if (empty($flag)) {
$bot->importFile($bot->update);
unlink($bot->update);
$flag = true;
}
}
}
}
file_put_contents('/update/message', '');
file_put_contents('/update/reload_message', '');
$bot->menu();
+1
View File
@@ -0,0 +1 @@
[]
+1
View File
@@ -9,6 +9,7 @@ events {
}
http {
server_names_hash_bucket_size 64;
include include.conf;
include /etc/nginx/mime.types;
default_type application/octet-stream;
+1
View File
@@ -9,6 +9,7 @@ events {
}
http {
server_names_hash_bucket_size 64;
include include.conf;
include /etc/nginx/mime.types;
default_type application/octet-stream;
View File
+116 -2
View File
@@ -17,6 +17,7 @@ volumes:
services:
up:
image: mercurykd/vpnbot-up:1.1
build:
context: dockerfile
dockerfile: nginx.dockerfile
@@ -32,6 +33,7 @@ services:
ports:
- 443:443
hostname: upstream
container_name: upstream-${VER}
depends_on:
php:
condition: service_healthy
@@ -48,6 +50,7 @@ services:
ipv4_address: 10.10.0.10
logging: *default-logging
ng:
image: mercurykd/vpnbot-ng:1.1
build:
context: dockerfile
dockerfile: nginx.dockerfile
@@ -66,6 +69,7 @@ services:
ports:
- 80:80
hostname: nginx
container_name: nginx-${VER}
depends_on:
up:
condition: service_started
@@ -79,6 +83,7 @@ services:
ipv4_address: 10.10.0.2
logging: *default-logging
php:
image: mercurykd/vpnbot-php:1.1
build:
dockerfile: dockerfile/php.dockerfile
args:
@@ -94,14 +99,21 @@ services:
- ./scripts/start_php.sh:/start_php.sh
- ./scripts/check_file.sh:/check_file.sh
- ./version:/version
- ./mirror:/mirror
- ./.env:/mirror/.env
- ./update:/update
environment:
TZ: ${TZ}
IP: ${IP}
ADDRESS: ${WGADDRESS}
WGPORT: ${WGPORT}
WG1ADDRESS: ${WG1ADDRESS}
WG1PORT: ${WG1PORT}
SSPORT: ${SSPORT}
TGPORT: ${TGPORT}
VER: ${VER}
hostname: php
container_name: php-${VER}
restart: unless-stopped
stop_grace_period: 1s
command: ["/bin/sh", "/start_php.sh"]
@@ -117,7 +129,57 @@ services:
interval: 5s
timeout: 5s
retries: 5
service:
image: mercurykd/vpnbot-php:1.1
build:
dockerfile: dockerfile/php.dockerfile
args:
image: ${IMAGE}
volumes:
- ./config/.profile:/root/.ashrc:ro
- ./config/php.ini:/etc/php81/php.ini
- ./config/:/config/
- ./certs/:/certs/
- ./ssh:/ssh
- ./app:/app
- ./logs/:/logs/
- ./update:/update
- ./scripts/start_service.sh:/start_service.sh
environment:
TZ: ${TZ}
IP: ${IP}
ADDRESS: ${WGADDRESS}
WGPORT: ${WGPORT}
WG1ADDRESS: ${WG1ADDRESS}
WG1PORT: ${WG1PORT}
SSPORT: ${SSPORT}
TGPORT: ${TGPORT}
VER: ${VER}
hostname: service
container_name: service-${VER}
# restart: unless-stopped
stop_grace_period: 1s
command: ["/bin/sh", "/start_service.sh"]
working_dir: /app
networks:
default:
ipv4_address: 10.10.0.15
logging: *default-logging
depends_on:
- up
- ng
- php
- proxy
- wg
- wg1
- ad
- ss
- tg
- xr
- oc
- np
proxy:
image: mercurykd/vpnbot-ss:1.1
build:
dockerfile: dockerfile/shadowsocks.dockerfile
args:
@@ -129,6 +191,7 @@ services:
- ./config/sshd_config:/etc/ssh/sshd_config
- ./scripts/start_proxy.sh:/start_proxy.sh
hostname: proxy
container_name: proxy-${VER}
depends_on:
php:
condition: service_healthy
@@ -142,6 +205,7 @@ services:
command: ["/bin/sh", "/start_proxy.sh"]
logging: *default-logging
wg:
image: mercurykd/vpnbot-wg:1.1
build:
dockerfile: dockerfile/wireguard.dockerfile
args:
@@ -153,12 +217,11 @@ services:
- ./scripts/start_wg.sh:/start_wg.sh
- ./scripts/reset_wg.sh:/reset_wg.sh
- ./scripts/block_torrent.sh:/block_torrent.sh
- ./scripts/unblock_torrent.sh:/unblock_torrent.sh
- ./scripts/block_exchange.sh:/block_exchange.sh
- ./scripts/unblock_exchange.sh:/unblock_exchange.sh
- ./ssh:/ssh
- ./config/sshd_config:/etc/ssh/sshd_config
hostname: wireguard
container_name: wireguard-${VER}
depends_on:
php:
condition: service_healthy
@@ -168,6 +231,7 @@ services:
TZ: ${TZ}
WGPORT: ${WGPORT}
ADDRESS: ${WGADDRESS}
ENV: /root/.ashrc
cap_add:
- NET_ADMIN
devices:
@@ -178,7 +242,46 @@ services:
default:
ipv4_address: 10.10.0.4
logging: *default-logging
wg1:
image: mercurykd/vpnbot-wg:1.1
build:
dockerfile: dockerfile/wireguard.dockerfile
args:
image: ${IMAGE}
volumes:
- ./config/.profile:/root/.ashrc:ro
- ./config/wg1.conf:/etc/wireguard/wg0.conf
- ./config/pac.json:/pac.json
- ./scripts/start_wg.sh:/start_wg.sh
- ./scripts/reset_wg.sh:/reset_wg.sh
- ./scripts/block_torrent.sh:/block_torrent.sh
- ./scripts/block_exchange.sh:/block_exchange.sh
- ./ssh:/ssh
- ./config/sshd_config:/etc/ssh/sshd_config
hostname: wireguard1
container_name: wireguard1-${VER}
depends_on:
php:
condition: service_healthy
ports:
- ${WG1PORT}:${WG1PORT}/udp
environment:
TZ: ${TZ}
WGPORT: ${WG1PORT}
ADDRESS: ${WG1ADDRESS}
ENV: /root/.ashrc
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun:/dev/net/tun
stop_grace_period: 1s
command: ["/bin/sh", "/start_wg.sh"]
networks:
default:
ipv4_address: 10.10.0.14
logging: *default-logging
ad:
image: mercurykd/vpnbot-ad:1.1
build:
dockerfile: dockerfile/adguard.dockerfile
args:
@@ -197,6 +300,7 @@ services:
- ./logs/:/logs/
- ./scripts/start_ad.sh:/start_ad.sh
hostname: adguard
container_name: adguard-${VER}
depends_on:
php:
condition: service_healthy
@@ -211,6 +315,7 @@ services:
entrypoint: ["/bin/sh", "/start_ad.sh"]
logging: *default-logging
ss:
image: mercurykd/vpnbot-ss:1.1
build:
dockerfile: dockerfile/shadowsocks.dockerfile
args:
@@ -222,6 +327,7 @@ services:
- ./config/sshd_config:/etc/ssh/sshd_config
- ./scripts/start_ss.sh:/start_ss.sh
hostname: shadowsocks
container_name: shadowsocks-${VER}
depends_on:
php:
condition: service_healthy
@@ -238,6 +344,7 @@ services:
ipv4_address: 10.10.0.6
logging: *default-logging
tg:
image: mercurykd/vpnbot-tg:1.1
build:
dockerfile: dockerfile/telegram.dockerfile
volumes:
@@ -247,6 +354,7 @@ services:
- ./scripts/start_tg.sh:/start_tg.sh
- ./config/mtprotosecret:/mtprotosecret
hostname: telegram
container_name: mtproto-${VER}
depends_on:
php:
condition: service_healthy
@@ -263,6 +371,7 @@ services:
ipv4_address: 10.10.0.8
logging: *default-logging
xr:
image: mercurykd/vpnbot-xr:1.1
build:
dockerfile: dockerfile/xray.dockerfile
args:
@@ -274,6 +383,7 @@ services:
- ./config/xray.json:/xray.json
- ./scripts/start_xray.sh:/start_xray.sh
hostname: xray
container_name: xray-${VER}
depends_on:
php:
condition: service_healthy
@@ -286,6 +396,7 @@ services:
ipv4_address: 10.10.0.9
logging: *default-logging
oc:
image: mercurykd/vpnbot-oc:1.1
build:
dockerfile: dockerfile/ocserv.dockerfile
args:
@@ -298,6 +409,7 @@ services:
- ./certs:/certs
- ./scripts/start_oc.sh:/start_oc.sh
hostname: ocserv
container_name: openconnect-${VER}
depends_on:
php:
condition: service_healthy
@@ -315,6 +427,7 @@ services:
ipv4_address: 10.10.0.11
logging: *default-logging
np:
image: mercurykd/vpnbot-np:1.1
build:
dockerfile: dockerfile/naive.dockerfile
args:
@@ -327,6 +440,7 @@ services:
- ./certs:/certs
- ./scripts/start_np.sh:/start_np.sh
hostname: naive
container_name: naive-${VER}
depends_on:
php:
condition: service_healthy
+1
View File
@@ -3,6 +3,7 @@ FROM $image
RUN apk add --no-cache --update php81 \
php81-mbstring \
php81-session \
php81-phar \
php81-curl \
php81-opcache \
php81-openssl \
+20 -13
View File
@@ -1,12 +1,14 @@
b:
docker compose build
u: # запуск контейнеров
IP=$(shell ip -4 addr | sed -ne 's|^.* inet \([^/]*\)/.* scope global.*$$|\1|p' | awk '{print $1}' | head -1) docker compose up -d --build --force-recreate
bash ./update/update.sh &
IP=$(shell curl https://ipinfo.io/ip) VER=$(shell git describe --tags) docker compose up -d --force-recreate
d: # остановка контейнеров
docker compose down
-kill -9 $(shell cat ./update/update_pid) > /dev/null
docker compose down --remove-orphans
dv: # остановка контейнеров
docker compose down -v
r: cleanf d u cleanf
r: d cleanf u cleanf
ps: # список контейнеров
docker compose ps
l: # логи из контейнеров
@@ -15,6 +17,8 @@ php: # консоль сервиса
docker compose exec php /bin/sh
wg: # консоль сервиса
docker compose exec wg /bin/sh
wg1: # консоль сервиса
docker compose exec wg1 /bin/sh
ss: # консоль сервиса
docker compose exec ss /bin/sh
ng: # консоль сервиса
@@ -25,12 +29,14 @@ up: # консоль сервиса
docker compose exec up /bin/sh
ad: # консоль сервиса
docker compose exec ad /bin/sh
wp: # консоль сервиса
docker compose exec wp bash
proxy: # консоль сервиса
docker compose exec proxy /bin/sh
tg: # консоль сервиса
docker compose exec tg /bin/sh
xr: # консоль сервиса
docker compose exec xr /bin/shec tg /bin/sh
docker compose exec xr /bin/sh
oc: # консоль сервиса
docker compose exec oc /bin/sh
clean:
@@ -40,12 +46,13 @@ cleanf:
docker image prune -f > /dev/null
docker builder prune -f > /dev/null
cleanall:
docker image prune -a
docker builder prune -a
p:
git stash
git pull
git stash pop stash@{0}
update: p r
cn:
docker compose exec ng nginx -t
docker image prune -a -f
docker builder prune -a -f
push:
docker compose push
s:
git status -su
c:
git add config/
git checkout .
git reset
+18
View File
@@ -0,0 +1,18 @@
version: "3"
services:
socat:
build:
dockerfile: ./dockerfile
ports:
- 80:80
- 443:443
- 853:853
- ${TGPORT}:${TGPORT}
- ${SSPORT}:${SSPORT}
- ${SSPORT}:${SSPORT}/udp
- ${WGPORT}:${WGPORT}/udp
volumes:
- ./start_socat.sh:/start_socat.sh
command: /bin/sh /start_socat.sh
stop_grace_period: 1s
+2
View File
@@ -0,0 +1,2 @@
FROM alpine:3.18
RUN apk add socat htop net-tools
+11
View File
@@ -0,0 +1,11 @@
b:
docker compose build --no-cache
u:
docker compose up -d --build
d:
docker compose down
ps:
docker compose ps
e:
docker compose exec socat sh
r: d u
+8
View File
@@ -0,0 +1,8 @@
socat TCP-LISTEN:80,fork TCP:{ip}:80 &
socat TCP-LISTEN:443,fork TCP:{ip}:443 &
socat TCP-LISTEN:853,fork TCP:{ip}:853 &
socat TCP-LISTEN:{tg},fork TCP:{ip}:{tg} &
socat TCP-LISTEN:{ss},fork TCP:{ip}:{ss} &
socat UDP-LISTEN:{ss},fork UDP:{ip}:{ss} &
socat UDP-LISTEN:{wg},fork UDP:{ip}:{wg} &
tail -f /dev/null
+1 -1
View File
@@ -1,4 +1,4 @@
if [[ -f "/ssh/key.pub" && -s "/ssh/key.pub" ]]; then
if [[ -f "/start" && -f "/ssh/key.pub" && -s "/ssh/key.pub" ]]; then
exit 0;
else
exit 1;
+1
View File
@@ -1,4 +1,5 @@
route add -net 10.0.1.0 netmask 255.255.255.0 gw wg
route add -net 10.0.3.0 netmask 255.255.255.0 gw wg1
route add -net 10.0.2.0 netmask 255.255.255.0 gw oc
cat /ssh/key.pub > /root/.ssh/authorized_keys
ssh-keygen -A
+1
View File
@@ -0,0 +1 @@
php service.php
+33 -14
View File
@@ -1,3 +1,7 @@
cat /ssh/key.pub > /root/.ssh/authorized_keys
ssh-keygen -A
exec /usr/sbin/sshd -D -e "$@" &
INTERFACE=$(route | grep '^default' | grep -o '[^ ]*$')
if [ $(cat /etc/wireguard/wg0.conf | wc -c) -eq 0 ]
then
@@ -13,21 +17,36 @@ fi
iptables -t nat -A POSTROUTING --destination 10.10.0.5 -j ACCEPT
iptables -t nat -A POSTROUTING -o $INTERFACE -j MASQUERADE
ln -s /etc/wireguard/wg0.conf /etc/amnezia/amneziawg/wg0.conf
if [ $(cat /pac.json | jq .amnezia) -eq 1 ]
if [ "$HOSTNAME" = "wireguard1" ]
then
awg-quick up wg0
if [ $(cat /pac.json | jq .wg1_amnezia) -eq 1 ]
then
awg-quick up wg0
else
wg-quick up wg0
fi
if [ $(cat /pac.json | jq .wg1_blocktorrent) -eq 1 ]
then
sh /block_torrent.sh
fi
if [ $(cat /pac.json | jq .wg1_exchange) -eq 1 ]
then
sh /block_exchange.sh
fi
else
wg-quick up wg0
fi
cat /ssh/key.pub > /root/.ssh/authorized_keys
ssh-keygen -A
exec /usr/sbin/sshd -D -e "$@" &
if [ $(cat /pac.json | jq .blocktorrent) -eq 1 ]
then
sh /block_torrent.sh
fi
if [ $(cat /pac.json | jq .exchange) -eq 1 ]
then
sh /block_exchange.sh
if [ $(cat /pac.json | jq .amnezia) -eq 1 ]
then
awg-quick up wg0
else
wg-quick up wg0
fi
if [ $(cat /pac.json | jq .blocktorrent) -eq 1 ]
then
sh /block_torrent.sh
fi
if [ $(cat /pac.json | jq .exchange) -eq 1 ]
then
sh /block_exchange.sh
fi
fi
tail -f /dev/null
-1
View File
@@ -1 +0,0 @@
iptables -D FORWARD -i wg0 -o wg0 -j REJECT
-12
View File
@@ -1,12 +0,0 @@
iptables -D FORWARD -p tcp -m ipp2p --bit -j DROP
iptables -D FORWARD -p udp -m ipp2p --bit -j DROP
iptables -D FORWARD -m string --algo bm --string "BitTorrent" -j DROP
iptables -D FORWARD -m string --algo bm --string "BitTorrent protocol" -j DROP
iptables -D FORWARD -m string --algo bm --string "peer_id=" -j DROP
iptables -D FORWARD -m string --algo bm --string ".torrent" -j DROP
iptables -D FORWARD -m string --algo bm --string "announce.php?passkey=" -j DROP
iptables -D FORWARD -m string --algo bm --string "torrent" -j DROP
iptables -D FORWARD -m string --algo bm --string "announce" -j DROP
iptables -D FORWARD -m string --algo bm --string "info_hash" -j DROP
iptables -D OUTPUT -p tcp -m ipp2p --bit -j DROP
iptables -D OUTPUT -p udp -m ipp2p --bit -j DROP
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
pwd=`pwd`
> $pwd/update/pipe
echo "$$" > $pwd/update/update_pid
while true
do
cmd=$(cat $pwd/update/pipe)
if [[ -n "$cmd" ]]
then
docker compose down --remove-orphans
git reset --hard
git pull > ./update/message
IP=$(curl https://ipinfo.io/ip) VER=$(git describe --tags) docker compose up -d --force-recreate
bash $pwd/update/update.sh &
exit 0
fi
sleep 1
done
+15
View File
@@ -1,3 +1,18 @@
04.03.2024
- решение "серого айпи" при запуске
- фикс стартового скрипта второго контейнера wireguard
03.03.2024 возможность обновления бота по кнопке из самого бота
- <code>git pull && make r</code>
02.03.2024 2 сервера wireguard, для возможности один запускать как wireguard а второй как amnezia
- <code>git pull && make r</code>
01.03.2024 фикс блокировок торрентов и обмена между пользователями
- <code>git pull && make r</code>
01.03.2024 фикс установки домена с длинным названием
- <code>make update</code>
29.02.2024 образы теперь будут скачиваться с docker hub
- <code>git pull && make d cleanall u</code>
28.02.2024 v1.1 добавлен раздел "зеркало"
- <code>git pull && make r</code>
27.02.2024 оптимизация размеров образов, сборка naive из исходников
- <code>git pull && make r</code>
19.02.2024 добавлен NaiveProxy