Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
nexdpi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
sysadmin
nexdpi
Commits
8da73f73
Commit
8da73f73
authored
Feb 06, 2022
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better managed offline devices asking for a vpn
parent
3f0e4e5e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
nsproxy
nsproxy
+2
-1
route.php
web/public/route.php
+14
-1
No files found.
nsproxy
View file @
8da73f73
...
...
@@ -28,7 +28,8 @@ proxy_ports = {
5301
:
'tun10'
,
5302
:
'tun11'
,
5303
:
'tun12'
,
5304
:
'tun14'
5304
:
'tun14'
,
5305
:
'tun800'
}
# Customize the address and port of the external DNS server
...
...
web/public/route.php
View file @
8da73f73
...
...
@@ -20,6 +20,10 @@ function vpnNeeded($name) {
return
(
str_replace
(
"
\n
"
,
""
,
shell_exec
(
"sudo -u root /usr/local/bin/vpn_needed
$name
"
)));
}
function
vpnUsers
(
$name
)
{
return
(
explode
(
"
\n
"
,
shell_exec
(
"sudo -u root /usr/local/bin/vpn_needed
$name
list"
)));
}
foreach
(
$hosts
as
$line
)
{
$part
=
explode
(
" "
,
$line
);
if
(
count
(
$part
)
>
4
&&
str_starts_with
(
$part
[
2
],
$localnet
))
{
...
...
@@ -45,9 +49,18 @@ foreach($fixed as $host => $ip) {
foreach
(
$vpns
as
$vpnname
=>
$vpnvars
)
{
$vpnvars
[
'vpnstatus'
]
=
vpnStatus
(
$vpnname
);
$vpnvars
[
'vpnneeded'
]
=
vpnNeeded
(
$vpnname
);
$vpnvars
[
'vpnusers'
]
=
array_filter
(
vpnUsers
(
$vpnname
));
$VPN
[
$vpnname
]
=
$vpnvars
;
foreach
(
$vpnvars
[
'vpnusers'
]
as
$$uip
)
{
if
(
!
in_array
(
$uip
,
array_keys
(
$DHCPIP
))
&&
!
in_array
(
$uip
,
array_keys
(
$FIXEDIP
)))
{
$ip
=
$uip
;
$route
=
getRoute
(
$ip
);
$name
=
'OFFLINE DEVICE'
;
$DHCPIP
[
$ip
]
=
array
(
"name"
=>
$name
,
"ip"
=>
$ip
,
"route"
=>
$route
);
$ROUTESTRING
.=
$route
;
}
}
}
print
(
json_encode
(
array
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment