|
|
|
@ -22,7 +22,7 @@ require_once('openvpn.inc'); |
|
|
|
|
require_once("service-utils.inc"); |
|
|
|
|
|
|
|
|
|
//For System |
|
|
|
|
require_once('pkg-utils.inc'); |
|
|
|
|
require_once('pkg-utils.inc'); |
|
|
|
|
|
|
|
|
|
//For DHCP |
|
|
|
|
|
|
|
|
@ -95,7 +95,7 @@ function pfz_interface_discovery() { |
|
|
|
|
$ifaces = get_interface_arr(); |
|
|
|
|
$ifcs=array(); |
|
|
|
|
|
|
|
|
|
$json_string = '{"data":['; |
|
|
|
|
$json_string = '['; |
|
|
|
|
|
|
|
|
|
foreach ($ifdescrs as $ifname => $ifdescr){ |
|
|
|
|
$ifinfo = get_interface_info($ifname); |
|
|
|
@ -118,7 +118,7 @@ function pfz_interface_discovery() { |
|
|
|
|
$json_string .= '},'; |
|
|
|
|
} |
|
|
|
|
$json_string = rtrim($json_string,","); |
|
|
|
|
$json_string .= "]}"; |
|
|
|
|
$json_string .= "]"; |
|
|
|
|
|
|
|
|
|
echo $json_string; |
|
|
|
|
} |
|
|
|
@ -136,7 +136,7 @@ function pfz_openvpn_get_all_servers(){ |
|
|
|
|
function pfz_openvpn_serverdiscovery() { |
|
|
|
|
$servers = pfz_openvpn_get_all_servers(); |
|
|
|
|
|
|
|
|
|
$json_string = '{"data":['; |
|
|
|
|
$json_string = '['; |
|
|
|
|
|
|
|
|
|
foreach ($servers as $server){ |
|
|
|
|
$name = trim(preg_replace('/\w{3}(\d)?\:\d{4,5}/i', '', $server['name'])); |
|
|
|
@ -146,7 +146,7 @@ function pfz_openvpn_serverdiscovery() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$json_string = rtrim($json_string,","); |
|
|
|
|
$json_string .= "]}"; |
|
|
|
|
$json_string .= "]"; |
|
|
|
|
|
|
|
|
|
echo $json_string; |
|
|
|
|
} |
|
|
|
@ -195,7 +195,7 @@ function pfz_openvpn_servervalue($server_id,$valuekey){ |
|
|
|
|
function pfz_openvpn_server_userdiscovery(){ |
|
|
|
|
$servers = pfz_openvpn_get_all_servers(); |
|
|
|
|
|
|
|
|
|
$json_string = '{"data":['; |
|
|
|
|
$json_string = '['; |
|
|
|
|
|
|
|
|
|
foreach ($servers as $server){ |
|
|
|
|
if ( ($server['mode']=='server_user') || ($server['mode']=='server_tls_user') ) { |
|
|
|
@ -214,7 +214,7 @@ function pfz_openvpn_server_userdiscovery(){ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$json_string = rtrim($json_string,","); |
|
|
|
|
$json_string .= "]}"; |
|
|
|
|
$json_string .= "]"; |
|
|
|
|
|
|
|
|
|
echo $json_string; |
|
|
|
|
} |
|
|
|
@ -243,7 +243,7 @@ function pfz_openvpn_server_uservalue($unique_id, $valuekey, $default=""){ |
|
|
|
|
function pfz_openvpn_clientdiscovery() { |
|
|
|
|
$clients = openvpn_get_active_clients(); |
|
|
|
|
|
|
|
|
|
$json_string = '{"data":['; |
|
|
|
|
$json_string = '['; |
|
|
|
|
|
|
|
|
|
foreach ($clients as $client){ |
|
|
|
|
$name = trim(preg_replace('/\w{3}(\d)?\:\d{4,5}/i', '', $client['name'])); |
|
|
|
@ -253,7 +253,7 @@ function pfz_openvpn_clientdiscovery() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$json_string = rtrim($json_string,","); |
|
|
|
|
$json_string .= "]}"; |
|
|
|
|
$json_string .= "]"; |
|
|
|
|
|
|
|
|
|
echo $json_string; |
|
|
|
|
} |
|
|
|
@ -284,7 +284,7 @@ function pfz_openvpn_clientvalue($client_id, $valuekey, $default="none"){ |
|
|
|
|
function pfz_services_discovery(){ |
|
|
|
|
$services = get_services(); |
|
|
|
|
|
|
|
|
|
$json_string = '{"data":['; |
|
|
|
|
$json_string = '['; |
|
|
|
|
|
|
|
|
|
foreach ($services as $service){ |
|
|
|
|
if (!empty($service['name'])) { |
|
|
|
@ -304,7 +304,7 @@ function pfz_services_discovery(){ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$json_string = rtrim($json_string,","); |
|
|
|
|
$json_string .= "]}"; |
|
|
|
|
$json_string .= "]"; |
|
|
|
|
|
|
|
|
|
echo $json_string; |
|
|
|
|
|
|
|
|
@ -388,13 +388,13 @@ function pfz_gw_rawstatus() { |
|
|
|
|
function pfz_gw_discovery() { |
|
|
|
|
$gws = return_gateways_status(true); |
|
|
|
|
|
|
|
|
|
$json_string = '{"data":['; |
|
|
|
|
$json_string = '['; |
|
|
|
|
foreach ($gws as $gw){ |
|
|
|
|
$json_string .= '{"{#GATEWAY}":"' . $gw['name'] . '"'; |
|
|
|
|
$json_string .= '},'; |
|
|
|
|
} |
|
|
|
|
$json_string = rtrim($json_string,","); |
|
|
|
|
$json_string .= "]}"; |
|
|
|
|
$json_string .= "]"; |
|
|
|
|
|
|
|
|
|
echo $json_string; |
|
|
|
|
} |
|
|
|
@ -419,7 +419,7 @@ function pfz_ipsec_discovery_ph1(){ |
|
|
|
|
init_config_arr(array('ipsec', 'phase1')); |
|
|
|
|
$a_phase1 = &$config['ipsec']['phase1']; |
|
|
|
|
|
|
|
|
|
$json_string = '{"data":['; |
|
|
|
|
$json_string = '['; |
|
|
|
|
|
|
|
|
|
foreach ($a_phase1 as $data) { |
|
|
|
|
$json_string .= '{"{#IKEID}":"' . $data['ikeid'] . '"'; |
|
|
|
@ -428,7 +428,7 @@ function pfz_ipsec_discovery_ph1(){ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$json_string = rtrim($json_string,","); |
|
|
|
|
$json_string .= "]}"; |
|
|
|
|
$json_string .= "]"; |
|
|
|
|
|
|
|
|
|
echo $json_string; |
|
|
|
|
|
|
|
|
@ -475,7 +475,7 @@ function pfz_ipsec_discovery_ph2(){ |
|
|
|
|
init_config_arr(array('ipsec', 'phase2')); |
|
|
|
|
$a_phase2 = &$config['ipsec']['phase2']; |
|
|
|
|
|
|
|
|
|
$json_string = '{"data":['; |
|
|
|
|
$json_string = '['; |
|
|
|
|
|
|
|
|
|
foreach ($a_phase2 as $data) { |
|
|
|
|
$json_string .= '{"{#IKEID}":"' . $data['ikeid'] . '"'; |
|
|
|
@ -487,7 +487,7 @@ function pfz_ipsec_discovery_ph2(){ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$json_string = rtrim($json_string,","); |
|
|
|
|
$json_string .= "]}"; |
|
|
|
|
$json_string .= "]"; |
|
|
|
|
|
|
|
|
|
echo $json_string; |
|
|
|
|
|
|
|
|
@ -649,7 +649,7 @@ function pfz_dhcpfailover_discovery(){ |
|
|
|
|
require_once("system.inc"); |
|
|
|
|
$leases = system_get_dhcpleases(); |
|
|
|
|
|
|
|
|
|
$json_string = '{"data":['; |
|
|
|
|
$json_string = '['; |
|
|
|
|
|
|
|
|
|
if (count($leases['failover']) > 0){ |
|
|
|
|
foreach ($leases['failover'] as $data){ |
|
|
|
@ -658,7 +658,7 @@ function pfz_dhcpfailover_discovery(){ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$json_string = rtrim($json_string,","); |
|
|
|
|
$json_string .= "]}"; |
|
|
|
|
$json_string .= "]"; |
|
|
|
|
|
|
|
|
|
echo $json_string; |
|
|
|
|
} |
|
|
|
|