роутинг для openconnect

This commit is contained in:
mercury
2024-11-21 00:24:50 +04:00
parent 7d8dc1dd2d
commit b394e769c6
3 changed files with 30 additions and 2 deletions
+2 -1
View File
@@ -24,4 +24,5 @@ override.html
override.php override.php
docker-compose.override.yml docker-compose.override.yml
backup.json backup.json
app/webapp/override/ app/webapp/override/
.rest
+27
View File
@@ -3137,6 +3137,9 @@ DNS-over-HTTPS with IP:
$this->setPacConf($c); $this->setPacConf($c);
$page = floor(count($c['subnets']) / $this->limit); $page = floor(count($c['subnets']) / $this->limit);
} }
if (!empty($openconnect)) {
$this->ocservRoute();
}
$this->subnet($wgpage, $page, $openconnect); $this->subnet($wgpage, $page, $openconnect);
} }
@@ -3145,9 +3148,33 @@ DNS-over-HTTPS with IP:
$c = $this->getPacConf(); $c = $this->getPacConf();
unset($c['subnets'][$k]); unset($c['subnets'][$k]);
$this->setPacConf($c); $this->setPacConf($c);
if (!empty($openconnect)) {
$this->ocservRoute();
}
$this->subnet($wgpage, $page, $openconnect); $this->subnet($wgpage, $page, $openconnect);
} }
public function ocservRoute()
{
$p = $this->getPacConf();
$c = file_get_contents('/config/ocserv.conf');
$t = preg_replace('~^route[^\n]+~sm', '', $c);
if (!empty($p['subnets'])) {
foreach ($p['subnets'] as $v) {
if (preg_match('~^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/\d{1,2}~', $v)) {
$t .= "route = $v";
$flag = true;
}
}
if (empty($flag)) {
$t .= 'route = default';
}
} else {
$t .= 'route = default';
}
$this->restartOcserv($t);
}
public function calc() public function calc()
{ {
$r = $this->send( $r = $this->send(
+1 -1
View File
@@ -505,7 +505,7 @@ ipv4-netmask = 255.255.255.0
# Whether to tunnel all DNS queries via the VPN. This is the default # Whether to tunnel all DNS queries via the VPN. This is the default
# when a default route is set. # when a default route is set.
#tunnel-all-dns = true tunnel-all-dns = true
# The advertised DNS server. Use multiple lines for # The advertised DNS server. Use multiple lines for
# multiple servers. # multiple servers.