Compare commits

..

4 Commits

Author SHA1 Message Date
mercury bd17e5cd14 improve ip detect on start 2024-10-22 23:55:05 +04:00
mercury c3975549db openconnect: isolate-workers = false 2024-10-22 22:42:20 +04:00
mercury 3087bee82d openconnect: expose-iroutes on/off 2024-10-21 22:19:13 +04:00
mercury 96fbf5a3c3 openconnect: limit cpu and memory 2024-10-21 21:09:50 +04:00
5 changed files with 37 additions and 4 deletions
+21 -1
View File
@@ -271,6 +271,9 @@ class Bot
case preg_match('~^/addOcUser$~', $this->input['callback'], $m): case preg_match('~^/addOcUser$~', $this->input['callback'], $m):
$this->addOcUser(); $this->addOcUser();
break; break;
case preg_match('~^/changeOcExpose$~', $this->input['callback'], $m):
$this->changeOcExpose();
break;
case preg_match('~^/addXrUser$~', $this->input['callback'], $m): case preg_match('~^/addXrUser$~', $this->input['callback'], $m):
$this->addXrUser(); $this->addXrUser();
break; break;
@@ -4129,7 +4132,9 @@ DNS-over-HTTPS with IP:
preg_match('~^camouflage_secret[^\n]+?"([^"]+)*"~sm', $ocserv, $m); preg_match('~^camouflage_secret[^\n]+?"([^"]+)*"~sm', $ocserv, $m);
$cs = $m[1]; $cs = $m[1];
preg_match('~^dns = ([^\n]+)~sm', $ocserv, $m); preg_match('~^dns = ([^\n]+)~sm', $ocserv, $m);
$dns = $m[1]; $dns = $m[1];
preg_match('~^expose-iroutes = (true)~sm', $ocserv, $m);
$expose = $m[1];
$pass = htmlspecialchars($pac['ocserv']); $pass = htmlspecialchars($pac['ocserv']);
$text[] = "Menu -> OpenConnect"; $text[] = "Menu -> OpenConnect";
if (!empty($m[1])) { if (!empty($m[1])) {
@@ -4150,6 +4155,12 @@ DNS-over-HTTPS with IP:
'callback_data' => "/changeOcDns", 'callback_data' => "/changeOcDns",
], ],
]; ];
$data[] = [
[
'text' => $this->i18n('expose-iroutes') . ' ' . $this->i18n($expose ? 'on' : 'off'),
'callback_data' => "/changeOcExpose",
],
];
$data[] = [ $data[] = [
[ [
'text' => $this->i18n('add peer'), 'text' => $this->i18n('add peer'),
@@ -4177,6 +4188,15 @@ DNS-over-HTTPS with IP:
]; ];
} }
public function changeOcExpose()
{
$c = file_get_contents('/config/ocserv.conf');
preg_match('~^expose-iroutes = ([^\n]+)~sm', $c, $m);
$t = preg_replace('~^expose-iroutes[^\n]+~sm', "expose-iroutes = " . ($m[1] == 'true' ? 'false' : 'true'), $c);
$this->restartOcserv($t);
$this->menu('oc');
}
public function deloc($i) public function deloc($i)
{ {
$clients = $this->getClientsOc(); $clients = $this->getClientsOc();
+4
View File
@@ -341,4 +341,8 @@ $i = [
'en' => 'fake html', 'en' => 'fake html',
'ru' => 'фейк заглушка', 'ru' => 'фейк заглушка',
], ],
'expose-iroutes' => [
'en' => 'expose-iroutes',
'ru' => 'изоляция клиентов',
],
]; ];
+2 -2
View File
@@ -180,7 +180,7 @@ server-key = /certs/cert_private
# the isolation was tested at. If you get random failures on worker processes, try # the isolation was tested at. If you get random failures on worker processes, try
# disabling that option and report the failures you, along with system and debugging # disabling that option and report the failures you, along with system and debugging
# information at: https://gitlab.com/openconnect/ocserv/issues # information at: https://gitlab.com/openconnect/ocserv/issues
isolate-workers = true isolate-workers = false
# A banner to be displayed on clients after connection # A banner to be displayed on clients after connection
#banner = "Welcome" #banner = "Welcome"
@@ -584,7 +584,7 @@ route = default
# When set to true, all client's iroutes are made visible to all # When set to true, all client's iroutes are made visible to all
# connecting clients except for the ones offering them. This option # connecting clients except for the ones offering them. This option
# only makes sense if config-per-user is set. # only makes sense if config-per-user is set.
#expose-iroutes = true expose-iroutes = false
# Groups that a client is allowed to select from. # Groups that a client is allowed to select from.
# A client may belong in multiple groups, and in certain use-cases # A client may belong in multiple groups, and in certain use-cases
+2 -1
View File
@@ -1,9 +1,10 @@
b: b:
docker compose build docker compose build
u: # запуск контейнеров u: # запуск контейнеров
$(eval IP := $(shell curl -s -t 1 2ip.io || curl -s -t 1 ipinfo.io/ip || curl -s -t 1 ifconfig.me))
bash ./update/update.sh & bash ./update/update.sh &
touch ./override.env touch ./override.env
IP=$(shell curl ipinfo.io/ip) VER=$(shell git describe --tags) docker compose --env-file ./.env --env-file ./override.env up -d --force-recreate IP=$(IP) VER=$(shell git describe --tags) docker compose --env-file ./.env --env-file ./override.env up -d --force-recreate
d: # остановка контейнеров d: # остановка контейнеров
-kill -9 $(shell cat ./update/update_pid) > /dev/null -kill -9 $(shell cat ./update/update_pid) > /dev/null
docker compose down --remove-orphans docker compose down --remove-orphans
+8
View File
@@ -1,3 +1,11 @@
22.10.2024 v1.76
- улучшение определения ip бота при старте
22.10.2024 v1.75
- openconnect: isolate-workers = false
21.10.2024 v1.74
- openconnect: expose-iroutes on/off
21.10.2024 v1.73
- openconnect: ограничение контейнера по цпу и памяти
21.10.2024 v1.72 21.10.2024 v1.72
- xray: теги в кастомных шаблонах - xray: теги в кастомных шаблонах
21.10.2024 v1.71 21.10.2024 v1.71