From 27e9e518d78da992a3252349beb5ad2c8fb1bb6e Mon Sep 17 00:00:00 2001 From: Chris Buechler Date: Thu, 11 Feb 2010 21:50:22 -0500 Subject: fix text --- usr/local/www/vpn_ipsec_phase2.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'usr') diff --git a/usr/local/www/vpn_ipsec_phase2.php b/usr/local/www/vpn_ipsec_phase2.php index 9c99ef1..b08cb3f 100644 --- a/usr/local/www/vpn_ipsec_phase2.php +++ b/usr/local/www/vpn_ipsec_phase2.php @@ -123,7 +123,7 @@ if ($_POST) { switch ($pconfig['localid_type']) { case "network": if (!$pconfig['localid_netbits'] || !is_numeric($pconfig['localid_netbits'])) - $input_errors[] = "A valid local network bit count must be specified.."; + $input_errors[] = "A valid local network bit count must be specified."; case "address": if (!$pconfig['localid_address'] || !is_ipaddr($pconfig['localid_address'])) $input_errors[] = "A valid local network IP address must be specified."; @@ -133,7 +133,7 @@ if ($_POST) { switch ($pconfig['remoteid_type']) { case "network": if (!$pconfig['remoteid_netbits'] || !is_numeric($pconfig['remoteid_netbits'])) - $input_errors[] = "A valid remote network bit count must be specified.."; + $input_errors[] = "A valid remote network bit count must be specified."; case "address": if (!$pconfig['remoteid_address'] || !is_ipaddr($pconfig['remoteid_address'])) $input_errors[] = "A valid remote network IP address must be specified."; -- cgit v1.1 From 184d50b5646e7aeaca6d754e588c3e93ebf4c9f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ermal=20Lu=E7i?= Date: Fri, 12 Feb 2010 16:33:01 +0000 Subject: Ticket #352. Allow 0 mask in remote network bits. --- usr/local/www/vpn_ipsec_phase2.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'usr') diff --git a/usr/local/www/vpn_ipsec_phase2.php b/usr/local/www/vpn_ipsec_phase2.php index b08cb3f..f2899e6 100644 --- a/usr/local/www/vpn_ipsec_phase2.php +++ b/usr/local/www/vpn_ipsec_phase2.php @@ -122,7 +122,7 @@ if ($_POST) { { switch ($pconfig['localid_type']) { case "network": - if (!$pconfig['localid_netbits'] || !is_numeric($pconfig['localid_netbits'])) + if (($pconfig['localid_netbits'] != 0 && !$pconfig['localid_netbits']) || !is_numeric($pconfig['localid_netbits'])) $input_errors[] = "A valid local network bit count must be specified."; case "address": if (!$pconfig['localid_address'] || !is_ipaddr($pconfig['localid_address'])) @@ -132,7 +132,7 @@ if ($_POST) { switch ($pconfig['remoteid_type']) { case "network": - if (!$pconfig['remoteid_netbits'] || !is_numeric($pconfig['remoteid_netbits'])) + if (($pconfig['remoteid_netbits'] != 0 && !$pconfig['remoteid_netbits']) || !is_numeric($pconfig['remoteid_netbits'])) $input_errors[] = "A valid remote network bit count must be specified."; case "address": if (!$pconfig['remoteid_address'] || !is_ipaddr($pconfig['remoteid_address'])) @@ -401,11 +401,12 @@ function change_protocol() { / -- cgit v1.1 From 9a76a52a7be6320a87e3a0868d68b9e86710b417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ermal=20Lu=E7i?= Date: Fri, 12 Feb 2010 16:47:01 +0000 Subject: Ticket #353. Add neccessary include. --- usr/local/www/status_services.php | 1 + 1 file changed, 1 insertion(+) (limited to 'usr') diff --git a/usr/local/www/status_services.php b/usr/local/www/status_services.php index 9ccda16..25d3de5 100755 --- a/usr/local/www/status_services.php +++ b/usr/local/www/status_services.php @@ -39,6 +39,7 @@ require("guiconfig.inc"); require_once("service-utils.inc"); +require_once("ipsec.inc"); require_once("vpn.inc"); function gentitle_pkg($pgname) { -- cgit v1.1 From 5949124cc3ebba7a01d97131852c0ad2a8b17702 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Fri, 12 Feb 2010 18:15:06 -0500 Subject: Adding 802.1X Authentication support --- usr/local/www/interfaces.php | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'usr') diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index 1ff6dcc..a2a07ed 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -228,6 +228,9 @@ if (isset($wancfg['wireless'])) { $pconfig['apbridge_enable'] = isset($wancfg['wireless']['apbridge']['enable']); $pconfig['authmode'] = $wancfg['wireless']['authmode']; $pconfig['hidessid_enable'] = isset($wancfg['wireless']['hidessid']['enable']); + $pconfig['auth_server_addr'] = $wancfg['wireless']['auth_server_addr']; + $pconfig['auth_server_port'] = $wancfg['wireless']['auth_server_port']; + $pconfig['auth_server_shared_secret'] = $wancfg['wireless']['auth_server_shared_secret']; if (is_array($wancfg['wireless']['wpa'])) { $pconfig['debug_mode'] = $wancfg['wireless']['wpa']['debug_mode']; $pconfig['macaddr_acl'] = $wancfg['wireless']['wpa']['macaddr_acl']; @@ -703,6 +706,9 @@ function handle_wireless_post() { $wancfg['wireless']['wpa']['wpa_gmk_rekey'] = $_POST['wpa_gmk_rekey']; $wancfg['wireless']['wpa']['passphrase'] = $_POST['passphrase']; $wancfg['wireless']['wpa']['ext_wpa_sw'] = $_POST['ext_wpa_sw']; + $wancfg['wireless']['auth_server_addr'] = $_POST['auth_server_addr']; + $wancfg['wireless']['auth_server_port'] = $_POST['auth_server_port']; + $wancfg['wireless']['auth_server_shared_secret'] = $_POST['auth_server_shared_secret']; if ($_POST['hidessid_enable'] == "yes") $wancfg['wireless']['hidessid']['enable'] = true; else if (isset($wancfg['wireless']['hidessid']['enable'])) @@ -1490,12 +1496,33 @@ $types = array("none" => "None", "static" => "Static", "dhcp" => "DHCP", "pppoe" - Enable IEEE802.1X + Enable IEEE802.1X Authentication >
Setting this option will enable 802.1x authentication. + + 802.1X Authentication Server IP Address + + +
Enter the IP address of the 802.1X Authentication Server. This is commonly a Radius server (FreeRadius, Internet Authentication Services, etc.) + + + + 802.1X Authentication Server Port + + +
Leave blank for the default 1812 port. + + + + 802.1X Authentication Server Shared Secret + + +
+ + -- cgit v1.1 From 74d1479537063d49fd71d40cccac1f90a6460a3a Mon Sep 17 00:00:00 2001 From: jim-p Date: Mon, 15 Feb 2010 08:59:56 -0500 Subject: Fix RRD colors in Code Red theme. Resolves #330 --- usr/local/www/themes/code-red/rrdcolors.inc.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'usr') diff --git a/usr/local/www/themes/code-red/rrdcolors.inc.php b/usr/local/www/themes/code-red/rrdcolors.inc.php index d04762e..9b03bd8 100755 --- a/usr/local/www/themes/code-red/rrdcolors.inc.php +++ b/usr/local/www/themes/code-red/rrdcolors.inc.php @@ -30,10 +30,10 @@ /* This file is included by the RRD graphing page and sets the colors */ -$colortrafficup = "666666"; -$colortrafficdown = "990000"; -$colorpacketsup = "666666"; -$colorpacketsdown = "990000"; +$colortrafficup = array("666666", "CCCCCC"); +$colortrafficdown = array("666666", "CCCCCC"); +$colorpacketsup = array("666666", "CCCCCC"); +$colorpacketsdown = array("666666", "CCCCCC"); $colorstates = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colorprocessor = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colormemory = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); -- cgit v1.1 From a5070443e9c5e3703bbdb6c49fd0b262b4367291 Mon Sep 17 00:00:00 2001 From: jim-p Date: Mon, 15 Feb 2010 09:16:47 -0500 Subject: Fix memory graph for the_wall theme. --- usr/local/www/themes/the_wall/rrdcolors.inc.php | 1 + 1 file changed, 1 insertion(+) (limited to 'usr') diff --git a/usr/local/www/themes/the_wall/rrdcolors.inc.php b/usr/local/www/themes/the_wall/rrdcolors.inc.php index e657259..e3153fd 100644 --- a/usr/local/www/themes/the_wall/rrdcolors.inc.php +++ b/usr/local/www/themes/the_wall/rrdcolors.inc.php @@ -36,6 +36,7 @@ $colorpacketsup = array("666666", "CCCCCC"); $colorpacketsdown = array("990000", "CC0000"); $colorstates = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colorprocessor = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); +$colormemory = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colorqueuesup = array('000000','7B0000','990000','BB0000','CC0000','D90000','EE0000','FF0000','CC0000'); $colorqueuesdown = array('000000','7B7B7B','999999','BBBBBB','CCCCCC','D9D9D9','EEEEEE','FFFFFF','CCCCCC'); $colorqueuesdropup = array('000000','7B0000','990000','BB0000','CC0000','D90000','EE0000','FF0000','CC0000'); -- cgit v1.1 From bb641bf8978c07e54b57885f56b0f9543a7cd39f Mon Sep 17 00:00:00 2001 From: jim-p Date: Mon, 15 Feb 2010 10:00:32 -0500 Subject: Missing counter variable initialization. --- usr/local/www/status_rrd_graph_img.php | 1 + 1 file changed, 1 insertion(+) (limited to 'usr') diff --git a/usr/local/www/status_rrd_graph_img.php b/usr/local/www/status_rrd_graph_img.php index 905413d..63657d0 100644 --- a/usr/local/www/status_rrd_graph_img.php +++ b/usr/local/www/status_rrd_graph_img.php @@ -703,6 +703,7 @@ elseif((strstr($curdatabase, "-queuedrops.rrd")) && (file_exists("$rrddbpath$cur $graphcmd .= "--height 200 --width 620 -x \"$scale\" "; if ($altq) { $a_queues =& $altq->get_queue_list(); + $t = 0; } else { $a_queues = array(); $i = 0; -- cgit v1.1 From b3e79d5ee5ee3089943242517a19683c8aa68097 Mon Sep 17 00:00:00 2001 From: jim-p Date: Mon, 15 Feb 2010 13:01:12 -0500 Subject: Fix double printing of log entries --- usr/local/bin/filterparser.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'usr') diff --git a/usr/local/bin/filterparser.php b/usr/local/bin/filterparser.php index d432419..3460e3e 100755 --- a/usr/local/bin/filterparser.php +++ b/usr/local/bin/filterparser.php @@ -73,7 +73,9 @@ while(!feof($log)) { dstip - Destination IP dstport - Destination Port */ - if ($flent != "") + if ($flent != "") { echo "{$flent['time']} {$flent['act']} {$flent['realint']} {$flent['proto']} {$flent['src']} {$flent['dst']}\n"; + $flent = ""; + } } fclose($log); ?> \ No newline at end of file -- cgit v1.1 From dcdf955c107fb7d077d462d71c55bccf1ca6c80c Mon Sep 17 00:00:00 2001 From: jim-p Date: Mon, 15 Feb 2010 14:02:00 -0500 Subject: Fix copypasta error. Had the wrong colors. --- usr/local/www/themes/code-red/rrdcolors.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'usr') diff --git a/usr/local/www/themes/code-red/rrdcolors.inc.php b/usr/local/www/themes/code-red/rrdcolors.inc.php index 9b03bd8..cbd6a8d 100755 --- a/usr/local/www/themes/code-red/rrdcolors.inc.php +++ b/usr/local/www/themes/code-red/rrdcolors.inc.php @@ -31,9 +31,9 @@ /* This file is included by the RRD graphing page and sets the colors */ $colortrafficup = array("666666", "CCCCCC"); -$colortrafficdown = array("666666", "CCCCCC"); +$colortrafficdown = array("990000", "CC0000"); $colorpacketsup = array("666666", "CCCCCC"); -$colorpacketsdown = array("666666", "CCCCCC"); +$colorpacketsdown = array("990000", "CC0000"); $colorstates = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colorprocessor = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); $colormemory = array('990000','a83c3c','b36666','bd9090','cccccc','000000'); -- cgit v1.1 From d31e9455e0592483a22f909f3f51aa1aaa6b34d6 Mon Sep 17 00:00:00 2001 From: Chris Buechler Date: Mon, 15 Feb 2010 17:53:41 -0500 Subject: clarify text --- usr/local/www/services_dyndns_edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'usr') diff --git a/usr/local/www/services_dyndns_edit.php b/usr/local/www/services_dyndns_edit.php index e5e73b1..c79734a 100644 --- a/usr/local/www/services_dyndns_edit.php +++ b/usr/local/www/services_dyndns_edit.php @@ -175,7 +175,7 @@ include("head.inc"); - Hostname/Interface + Hostname
-- cgit v1.1 From a6efee267f54eabe0ba51cfc0dab43e92a141e61 Mon Sep 17 00:00:00 2001 From: jim-p Date: Mon, 15 Feb 2010 17:59:18 -0500 Subject: Fix typo --- usr/local/www/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'usr') diff --git a/usr/local/www/index.php b/usr/local/www/index.php index 77cfaaa..3e2cf8d 100755 --- a/usr/local/www/index.php +++ b/usr/local/www/index.php @@ -553,7 +553,7 @@ echo $jscriptstr; $inputdisplay = "hide"; $showWidget = "inline"; $mindiv = "none"; - berak; + break; case "close": $divdisplay = "none"; $display = "block"; -- cgit v1.1 From e1135f7bc689d6be552382c21e581d4a63409cae Mon Sep 17 00:00:00 2001 From: jim-p Date: Mon, 15 Feb 2010 18:23:10 -0500 Subject: Change variable name to avoid clobbering one by the same name in the Dashboard. Fixes all kinds of fun Dashboard issues. Any widget directly after the Services Status one would mess up in some way. --- .../www/widgets/widgets/services_status.widget.php | 86 +++++++++++----------- 1 file changed, 43 insertions(+), 43 deletions(-) (limited to 'usr') diff --git a/usr/local/www/widgets/widgets/services_status.widget.php b/usr/local/www/widgets/widgets/services_status.widget.php index a7a88f8..ec20421 100644 --- a/usr/local/www/widgets/widgets/services_status.widget.php +++ b/usr/local/www/widgets/widgets/services_status.widget.php @@ -54,23 +54,23 @@ $services = $config['installedpackages']['service']; * */ if(isset($config['dnsmasq']['enable'])) { - $pconfig['name'] = "dnsmasq"; - $pconfig['description'] = "DNS Forwarder"; - $services[] = $pconfig; - unset($pconfig); + $sconfig['name'] = "dnsmasq"; + $sconfig['description'] = "DNS Forwarder"; + $services[] = $sconfig; + unset($sconfig); } -$pconfig['name'] = "ntpd"; -$pconfig['description'] = "NTP clock sync"; -$services[] = $pconfig; -unset($pconfig); +$sconfig['name'] = "ntpd"; +$sconfig['description'] = "NTP clock sync"; +$services[] = $sconfig; +unset($sconfig); if(isset($config['captiveportal']['enable'])) { - $pconfig['name'] = "lighttpd"; - $pconfig['description'] = "Captive Portal"; - $services[] = $pconfig; - $pconfig = ""; - unset($pconfig); + $sconfig['name'] = "lighttpd"; + $sconfig['description'] = "Captive Portal"; + $services[] = $sconfig; + $sconfig = ""; + unset($sconfig); } $iflist = array(); @@ -87,45 +87,45 @@ foreach($iflist as $if) { } if($show_dhcprelay == true) { - $pconfig['name'] = "dhcrelay"; - $pconfig['description'] = "DHCP Relay"; - $services[] = $pconfig; - unset($pconfig); + $sconfig['name'] = "dhcrelay"; + $sconfig['description'] = "DHCP Relay"; + $services[] = $sconfig; + unset($sconfig); } if(is_dhcp_server_enabled()) { - $pconfig['name'] = "dhcpd"; - $pconfig['description'] = "DHCP Service"; - $services[] = $pconfig; - unset($pconfig); + $sconfig['name'] = "dhcpd"; + $sconfig['description'] = "DHCP Service"; + $services[] = $sconfig; + unset($sconfig); } if(isset($config['snmpd']['enable'])) { - $pconfig['name'] = "bsnmpd"; - $pconfig['description'] = "SNMP Service"; - $services[] = $pconfig; - unset($pconfig); + $sconfig['name'] = "bsnmpd"; + $sconfig['description'] = "SNMP Service"; + $services[] = $sconfig; + unset($sconfig); } if (count($config['igmpproxy']['igmpentry']) > 0) { - $pconfig['name'] = "igmpproxy"; - $pconfig['descritption'] = "IGMP proxy"; - $services[] = $pconfig; - unset($pconfig); + $sconfig['name'] = "igmpproxy"; + $sconfig['descritption'] = "IGMP proxy"; + $services[] = $sconfig; + unset($sconfig); } if($config['installedpackages']['miniupnpd']['config'][0]['enable']) { - $pconfig['name'] = "miniupnpd"; - $pconfig['description'] = gettext("UPnP Service"); - $services[] = $pconfig; - unset($pconfig); + $sconfig['name'] = "miniupnpd"; + $sconfig['description'] = gettext("UPnP Service"); + $services[] = $sconfig; + unset($sconfig); } if (isset($config['ipsec']['enable'])) { - $pconfig['name'] = "racoon"; - $pconfig['description'] = gettext("IPsec VPN"); - $services[] = $pconfig; - unset($pconfig); + $sconfig['name'] = "racoon"; + $sconfig['description'] = gettext("IPsec VPN"); + $services[] = $sconfig; + unset($sconfig); } foreach (array('server', 'client') as $mode) { @@ -133,12 +133,12 @@ foreach (array('server', 'client') as $mode) { foreach ($config['installedpackages']["openvpn$mode"]['config'] as $id => $settings) { $setting = $config['installedpackages']["openvpn$mode"]['config'][$id]; if (!$setting['disable']) { - $pconfig['name'] = "openvpn"; - $pconfig['mode'] = $mode; - $pconfig['id'] = $id; - $pconfig['description'] = "OpenVPN ".$mode.": ".htmlspecialchars($setting['description']); - $services[] = $pconfig; - unset($pconfig); + $sconfig['name'] = "openvpn"; + $sconfig['mode'] = $mode; + $sconfig['id'] = $id; + $sconfig['description'] = "OpenVPN ".$mode.": ".htmlspecialchars($setting['description']); + $services[] = $sconfig; + unset($sconfig); } } } -- cgit v1.1 From 3a738983119776d36460cb7aa115f39de68a3b4a Mon Sep 17 00:00:00 2001 From: jim-p Date: Mon, 15 Feb 2010 19:23:05 -0500 Subject: Fix typo --- usr/local/www/widgets/widgets/services_status.widget.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'usr') diff --git a/usr/local/www/widgets/widgets/services_status.widget.php b/usr/local/www/widgets/widgets/services_status.widget.php index ec20421..11d448e 100644 --- a/usr/local/www/widgets/widgets/services_status.widget.php +++ b/usr/local/www/widgets/widgets/services_status.widget.php @@ -109,7 +109,7 @@ if(isset($config['snmpd']['enable'])) { if (count($config['igmpproxy']['igmpentry']) > 0) { $sconfig['name'] = "igmpproxy"; - $sconfig['descritption'] = "IGMP proxy"; + $sconfig['description'] = "IGMP proxy"; $services[] = $sconfig; unset($sconfig); } -- cgit v1.1 From 870318b9a0eb81e79f40abe461e6259f67a62580 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ermal=20Lu=E7i?= Date: Tue, 16 Feb 2010 19:47:57 +0000 Subject: Fix setting unsetting of disable option for OpenVPN. --- usr/local/www/vpn_openvpn_server.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'usr') diff --git a/usr/local/www/vpn_openvpn_server.php b/usr/local/www/vpn_openvpn_server.php index c0ecede..4617e5c 100644 --- a/usr/local/www/vpn_openvpn_server.php +++ b/usr/local/www/vpn_openvpn_server.php @@ -79,7 +79,7 @@ if($_GET['act']=="edit"){ if (isset($id) && $a_server[$id]) { - $pconfig['disable'] = $a_server[$id]['disable']; + $pconfig['disable'] = isset($a_server[$id]['disable']); $pconfig['mode'] = $a_server[$id]['mode']; $pconfig['protocol'] = $a_server[$id]['protocol']; $pconfig['interface'] = $a_server[$id]['interface']; @@ -257,7 +257,8 @@ if ($_POST) { else $server['vpnid'] = openvpn_vpnid_next(); - $server['disable'] = $pconfig['disable']; + if ($_POST['disable'] == "yes") + $server['disable'] = true; $server['mode'] = $pconfig['mode']; $server['protocol'] = $pconfig['protocol']; list($server['interface'], $server['ipaddr']) = explode ("|",$pconfig['interface']); @@ -1147,7 +1148,7 @@ function netbios_change() { $i = 0; foreach($a_server as $server): $disabled = "NO"; - if ($server['disable']) + if (isset($server['disable'])) $disabled = "YES"; ?> -- cgit v1.1 From d0f6649c8fc45e4261cbd651fbcda136205d29de Mon Sep 17 00:00:00 2001 From: pierrepomes Date: Tue, 16 Feb 2010 17:19:08 -0500 Subject: Add statistics for OpenVPN client instances --- usr/local/www/status_openvpn.php | 149 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 147 insertions(+), 2 deletions(-) (limited to 'usr') diff --git a/usr/local/www/status_openvpn.php b/usr/local/www/status_openvpn.php index fdd03c0..1132fd8 100644 --- a/usr/local/www/status_openvpn.php +++ b/usr/local/www/status_openvpn.php @@ -148,8 +148,8 @@ if (is_array($config['openvpn']['openvpn-server'])) { } else { $conn = array(); $conn['common_name'] = "[error]"; - $conn['remote_host'] = "No Management Daemon"; - $conn['virtual_addr'] = "See Note Below"; + $conn['remote_host'] = "Management Daemon Unreachable"; + $conn['virtual_addr'] = ""; $conn['bytes_recv'] = 0; $conn['bytes_sent'] = 0; $conn['connect_time'] = 0; @@ -159,6 +159,91 @@ if (is_array($config['openvpn']['openvpn-server'])) { $servers[] = $server; } } + + +if (is_array($config['openvpn']['openvpn-client'])) { + foreach ($config['openvpn']['openvpn-client'] as & $settings) { + + $prot = $settings['protocol']; + $port = $settings['local_port']; + + $client = array(); + $client['port'] = $settings['local_port']; + if ($settings['description']) + $client['name'] = "{$settings['description']} {$prot}:{$port}"; + else + $client['name'] = "Client {$prot}:{$port}"; + + $tcpcli = "tcp://127.0.0.1:{$port}"; + $errval; + $errstr; + + $client['status']="down"; + + /* open a tcp connection to the management port of each cli */ + $fp = @stream_socket_client($tcpcli, $errval, $errstr, 1); + if ($fp) { + + /* send our status request */ + fputs($fp, "state 1\n"); + + /* recv all response lines */ + while (!feof($fp)) { + /* read the next line */ + $line = fgets($fp, 1024); + + /* Get the client state */ + if (strstr($line,"CONNECTED")) { + $client['status']="up"; + $list = explode(",", $line); + + $client['connect_time'] = date("D M j G:i:s Y", $list[0]); + $client['virtual_addr'] = $list[3]; + $client['remote_host'] = $list[4]; + } + /* parse end of output line */ + if (strstr($line, "END")) + break; + } + + /* If up, get read/write stats */ + if (strcmp($client['status'], "up") == 0) { + fputs($fp, "status 2\n"); + /* recv all response lines */ + while (!feof($fp)) { + /* read the next line */ + $line = fgets($fp, 1024); + + if (strstr($line,"TCP/UDP read bytes")) { + $list = explode(",", $line); + $client['bytes_recv'] = $list[1]; + } + + if (strstr($line,"TCP/UDP write bytes")) { + $list = explode(",", $line); + $client['bytes_sent'] = $list[1]; + } + + /* parse end of output line */ + if (strstr($line, "END")) + break; + } + } + + fclose($fp); + + } else { + $DisplayNote=true; + $client['remote_host'] = "No Management Daemon"; + $client['virtual_addr'] = "See Note Below"; + $client['bytes_recv'] = 0; + $client['bytes_sent'] = 0; + $client['connect_time'] = 0; + } + + $clients[] = $client; + } +} include("head.inc"); ?> "> @@ -254,5 +339,65 @@ include("head.inc"); ?> +
+ + + + + + + +
+ OpenVPN client instances statistics +
+ + + + + + + + + + + + '> + + + + + + + + + +
NameStatusConnected SinceVirtual AddrRemote HostBytes SentBytes Received
+ + + + + + + + + + + + + +
+ + + +NOTE: You need to bind each OpenVPN client to enable its management daemon: use 'Local port' setting in the OpenVPN client screen"; +} +?> + + + -- cgit v1.1