mirror of
https://github.com/unraid/webgui.git
synced 2026-01-13 21:20:01 -06:00
Docker: add route for remote WireGuard access
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2018, Lime Technology
|
||||
* Copyright 2014-2018, Guilherme Jardim, Eric Schultz, Jon Panozzo.
|
||||
* Copyright 2012-2018, Bergware International.
|
||||
/* Copyright 2005-2022, Lime Technology
|
||||
* Copyright 2014-2022, Guilherme Jardim, Eric Schultz, Jon Panozzo.
|
||||
* Copyright 2012-2022, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -26,5 +26,8 @@ if (file_exists($user_prefs)) {
|
||||
array_multisort($sort, ($action=='start'?SORT_ASC:SORT_DESC), SORT_NUMERIC, $containers);
|
||||
}
|
||||
|
||||
foreach ($containers as $ct) DockerUtil::docker("$action $ct >/dev/null");
|
||||
foreach ($containers as $ct) {
|
||||
DockerUtil::docker("$action $ct >/dev/null");
|
||||
addRoute($ct);
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -16,7 +16,7 @@ function addRoute($ct) {
|
||||
// add static route(s) for remote WireGuard access
|
||||
[$pid,$net] = explode(' ',exec("docker inspect --format='{{.State.Pid}} {{.NetworkSettings.Networks}}' $ct"));
|
||||
$net = substr($net,4,strpos($net,':')-4);
|
||||
if ($net != 'br0') return;
|
||||
if ($pid==0 || $net!='br0') return;
|
||||
$thisip = ipaddr();
|
||||
foreach (glob('/etc/wireguard/wg*.cfg') as $cfg) {
|
||||
$network = exec("grep -Pom1 '^Network:0=\"\\K[^\"]+' $cfg");
|
||||
|
||||
Reference in New Issue
Block a user