Compare commits

..

6 Commits

Author SHA1 Message Date
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
6 changed files with 49 additions and 20 deletions
+18 -13
View File
@@ -1045,6 +1045,7 @@ class Bot
$this->update($this->input['chat'], $this->input['message_id'], implode("\n", $out));
$this->saveClients($json['wg']['clients']);
$this->restartWG($this->createConfig($json['wg']['server']), $switch_amnezia);
$this->iptablesWG();
}
// ad
if (!empty($json['ad'])) {
@@ -1099,7 +1100,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);
@@ -1235,29 +1236,33 @@ 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;
$this->setPacConf($c);
if ($c['blocktorrent']) {
$this->ssh('bash /block_torrent.sh');
} else {
$this->ssh('bash /unblock_torrent.sh');
}
$this->iptablesWG();
$this->answer($this->input['callback_id'], 'доступ к торрентам ' . ($c['blocktorrent'] ? 'заблокирован' : 'разблокирован'), true);
$this->menu('wg', $page);
}
public function iptablesWG()
{
$c = $this->getPacConf();
$this->ssh('iptables -F');
if ($c['exchange']) {
$this->ssh('bash /block_exchange.sh');
}
if ($c['blocktorrent']) {
$this->ssh('bash /block_torrent.sh');
}
}
public function switchExchange($page)
{
$c = $this->getPacConf();
$c['exchange'] = $c['exchange'] ? 0 : 1;
$this->setPacConf($c);
if ($c['exchange']) {
$this->ssh('bash /block_exchange.sh');
} else {
$this->ssh('bash /unblock_exchange.sh');
}
$this->iptablesWG();
$this->answer($this->input['callback_id'], 'обмен между пользователями ' . ($c['exchange'] ? 'заблокирован' : 'разблокирован'), true);
$this->menu('wg', $page);
}
@@ -1402,7 +1407,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);
+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;
+12 -2
View File
@@ -17,6 +17,7 @@ volumes:
services:
up:
image: mercurykd/vpnbot-up:1.1
build:
context: dockerfile
dockerfile: nginx.dockerfile
@@ -49,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
@@ -81,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:
@@ -123,6 +126,7 @@ services:
timeout: 5s
retries: 5
proxy:
image: mercurykd/vpnbot-ss:1.1
build:
dockerfile: dockerfile/shadowsocks.dockerfile
args:
@@ -148,6 +152,7 @@ services:
command: ["/bin/sh", "/start_proxy.sh"]
logging: *default-logging
wg:
image: mercurykd/vpnbot-wg:1.1
build:
dockerfile: dockerfile/wireguard.dockerfile
args:
@@ -159,9 +164,7 @@ 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
@@ -175,6 +178,7 @@ services:
TZ: ${TZ}
WGPORT: ${WGPORT}
ADDRESS: ${WGADDRESS}
ENV: /root/.ashrc
cap_add:
- NET_ADMIN
devices:
@@ -186,6 +190,7 @@ services:
ipv4_address: 10.10.0.4
logging: *default-logging
ad:
image: mercurykd/vpnbot-ad:1.1
build:
dockerfile: dockerfile/adguard.dockerfile
args:
@@ -219,6 +224,7 @@ services:
entrypoint: ["/bin/sh", "/start_ad.sh"]
logging: *default-logging
ss:
image: mercurykd/vpnbot-ss:1.1
build:
dockerfile: dockerfile/shadowsocks.dockerfile
args:
@@ -247,6 +253,7 @@ services:
ipv4_address: 10.10.0.6
logging: *default-logging
tg:
image: mercurykd/vpnbot-tg:1.1
build:
dockerfile: dockerfile/telegram.dockerfile
volumes:
@@ -273,6 +280,7 @@ services:
ipv4_address: 10.10.0.8
logging: *default-logging
xr:
image: mercurykd/vpnbot-xr:1.1
build:
dockerfile: dockerfile/xray.dockerfile
args:
@@ -297,6 +305,7 @@ services:
ipv4_address: 10.10.0.9
logging: *default-logging
oc:
image: mercurykd/vpnbot-oc:1.1
build:
dockerfile: dockerfile/ocserv.dockerfile
args:
@@ -327,6 +336,7 @@ services:
ipv4_address: 10.10.0.11
logging: *default-logging
np:
image: mercurykd/vpnbot-np:1.1
build:
dockerfile: dockerfile/naive.dockerfile
args:
+11 -5
View File
@@ -1,12 +1,12 @@
b:
docker compose build
u: # запуск контейнеров
IP=$(shell ip -4 addr | sed -ne 's|^.* inet \([^/]*\)/.* scope global.*$$|\1|p' | awk '{print $1}' | head -1) VER=$(shell git describe --tags) docker compose up -d --build --force-recreate
IP=$(shell ip -4 addr | sed -ne 's|^.* inet \([^/]*\)/.* scope global.*$$|\1|p' | awk '{print $1}' | head -1) VER=$(shell git describe --tags) docker compose up -d --force-recreate
d: # остановка контейнеров
docker compose down
dv: # остановка контейнеров
docker compose down -v
r: cleanf d u cleanf
r: d cleanf u cleanf
ps: # список контейнеров
docker compose ps
l: # логи из контейнеров
@@ -25,12 +25,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,8 +42,8 @@ cleanf:
docker image prune -f > /dev/null
docker builder prune -f > /dev/null
cleanall:
docker image prune -a
docker builder prune -a
docker image prune -a -f
docker builder prune -a -f
p:
git stash
git pull
@@ -49,3 +51,7 @@ p:
update: p r
cn:
docker compose exec ng nginx -t
push:
docker compose push
s:
git status -su
+6
View File
@@ -1,3 +1,9 @@
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 из исходников