mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Merge branch 'master' into gettext
This commit is contained in:
commit
36a0f816a9
@ -2196,7 +2196,7 @@ EOD;
|
||||
}
|
||||
|
||||
$mpdconf .= <<<EOD
|
||||
set ipcp yes vjcomp
|
||||
set ipcp no vjcomp
|
||||
set ipcp ranges 0.0.0.0/0 0.0.0.0/0
|
||||
create link static {$interface}L1 pppoe
|
||||
set link disable incoming
|
||||
@ -2798,16 +2798,11 @@ function link_interface_to_vlans($int, $action = "") {
|
||||
if (empty($int))
|
||||
return;
|
||||
|
||||
$real_if = get_real_interface($int);
|
||||
if (is_array($config['vlans']['vlan'])) {
|
||||
foreach ($config['vlans']['vlan'] as $vlan) {
|
||||
if ($real_if == $vlan['if']) {
|
||||
if ($int == $vlan['if']) {
|
||||
if ($action == "update") {
|
||||
foreach ($config['interfaces'] as $ifname => $ifcfg) {
|
||||
if ($ifcfg['if'] == $vlan['vlanif'])
|
||||
interface_vlan_configure($vlan);
|
||||
interface_configure($ifname);
|
||||
}
|
||||
interfaces_bring_up($int);
|
||||
} else if ($action == "")
|
||||
return $vlan;
|
||||
}
|
||||
|
||||
@ -441,7 +441,7 @@ function openvpn_reconfigure($mode,& $settings) {
|
||||
}
|
||||
|
||||
// The port we'll listen at
|
||||
// If local_port is used, bing the management port
|
||||
// If local_port is used, bind the management port
|
||||
if ($settings['local_port']) {
|
||||
$conf .= "lport {$settings['local_port']}\n";
|
||||
$conf .= "management 127.0.0.1 {$settings['local_port']}\n";
|
||||
@ -704,4 +704,167 @@ function openvpn_resync_all($interface = "") {
|
||||
|
||||
}
|
||||
|
||||
function openvpn_get_active_servers() {
|
||||
$servers = array();
|
||||
global $config;
|
||||
if (is_array($config['openvpn']['openvpn-server'])) {
|
||||
foreach ($config['openvpn']['openvpn-server'] as & $settings) {
|
||||
|
||||
$prot = $settings['protocol'];
|
||||
$port = $settings['local_port'];
|
||||
|
||||
$server = array();
|
||||
$server['port'] = $settings['local_port'];
|
||||
if ($settings['description'])
|
||||
$server['name'] = "{$settings['description']} {$prot}:{$port}";
|
||||
else
|
||||
$server['name'] = "Server {$prot}:{$port}";
|
||||
$server['conns'] = array();
|
||||
|
||||
$tcpsrv = "tcp://127.0.0.1:{$port}";
|
||||
$errval;
|
||||
$errstr;
|
||||
|
||||
/* open a tcp connection to the management port of each server */
|
||||
$fp = @stream_socket_client($tcpsrv, $errval, $errstr, 1);
|
||||
if ($fp) {
|
||||
|
||||
/* send our status request */
|
||||
fputs($fp, "status 2\n");
|
||||
|
||||
/* recv all response lines */
|
||||
while (!feof($fp)) {
|
||||
|
||||
/* read the next line */
|
||||
$line = fgets($fp, 1024);
|
||||
|
||||
/* parse header list line */
|
||||
if (strstr($line, "HEADER"))
|
||||
continue;
|
||||
|
||||
/* parse end of output line */
|
||||
if (strstr($line, "END"))
|
||||
break;
|
||||
|
||||
/* parse client list line */
|
||||
if (strstr($line, "CLIENT_LIST")) {
|
||||
$list = explode(",", $line);
|
||||
$conn = array();
|
||||
$conn['common_name'] = $list[1];
|
||||
$conn['remote_host'] = $list[2];
|
||||
$conn['virtual_addr'] = $list[3];
|
||||
$conn['bytes_recv'] = $list[4];
|
||||
$conn['bytes_sent'] = $list[5];
|
||||
$conn['connect_time'] = $list[6];
|
||||
$server['conns'][] = $conn;
|
||||
}
|
||||
}
|
||||
|
||||
/* cleanup */
|
||||
fclose($fp);
|
||||
} else {
|
||||
$conn = array();
|
||||
$conn['common_name'] = "[error]";
|
||||
$conn['remote_host'] = "Management Daemon Unreachable";
|
||||
$conn['virtual_addr'] = "";
|
||||
$conn['bytes_recv'] = 0;
|
||||
$conn['bytes_sent'] = 0;
|
||||
$conn['connect_time'] = 0;
|
||||
$server['conns'][] = $conn;
|
||||
}
|
||||
|
||||
$servers[] = $server;
|
||||
}
|
||||
}
|
||||
return $servers;
|
||||
}
|
||||
|
||||
function openvpn_get_active_clients() {
|
||||
$clients = array();
|
||||
global $config;
|
||||
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;
|
||||
}
|
||||
}
|
||||
return $clients;
|
||||
}
|
||||
?>
|
||||
|
||||
@ -61,12 +61,16 @@ if(empty($argument)) {
|
||||
|
||||
log_error("rc.newwanip: on (IP address: {$curwanip}) (interface: {$interface}) (real interface: {$interface_real}).");
|
||||
|
||||
if($curwanip == "0.0.0.0") {
|
||||
if($curwanip == "0.0.0.0" || !is_ipaddr($curwanip)) {
|
||||
log_error("rc.newwanip: Failed to update {$interface} IP, restarting...");
|
||||
interface_configure($interface);
|
||||
exit;
|
||||
}
|
||||
|
||||
$oldip = "0.0.0.0";
|
||||
if (file_exists("{$g['vardb_path']}/{$interface}_cacheip"))
|
||||
$oldip = file_get_contents("{$g['vardb_path']}/{$interface}_cacheip");
|
||||
|
||||
/* regenerate resolv.conf if DNS overrides are allowed */
|
||||
system_resolvconf_generate(true);
|
||||
|
||||
@ -75,6 +79,10 @@ services_dnsupdate_process($interface);
|
||||
|
||||
/* write current WAN IP to file */
|
||||
file_put_contents("{$g['vardb_path']}/{$interface}_ip", $curwanip);
|
||||
file_put_contents("{$g['vardb_path']}/{$interface}_cacheip", $curwanip);
|
||||
|
||||
if (is_ipaddr($oldip) && $curwanip == $oldip)
|
||||
exit;
|
||||
|
||||
/* signal dyndns update */
|
||||
file_put_contents("{$g['tmp_path']}/update_dyndns", $interface);
|
||||
@ -98,7 +106,7 @@ enable_rrd_graphing();
|
||||
/* restart packages */
|
||||
mwexec_bg("/usr/local/sbin/ntpdate_sync_once.sh");
|
||||
mwexec_bg("/etc/rc.start_packages");
|
||||
log_error("{$g['product_name']} package system has detected an ip change $old_ip -> $curwanip ... Restarting packages.");
|
||||
log_error("{$g['product_name']} package system has detected an ip change $oldip -> $curwanip ... Restarting packages.");
|
||||
|
||||
/* reconfigure our gateway monitor */
|
||||
setup_gateways_monitor();
|
||||
|
||||
@ -47,8 +47,13 @@ if (($_POST['submit'] == "Download") && file_exists($_POST['dlPath'])) {
|
||||
header("Content-Length: " . filesize($_POST['dlPath']));
|
||||
header("Content-Disposition: attachment; filename=\"" .
|
||||
trim(htmlentities(basename($_POST['dlPath']))) . "\"");
|
||||
header("Pragma: private");
|
||||
header("Cache-Control: private, must-revalidate");
|
||||
if (isset($_SERVER['HTTPS'])) {
|
||||
header('Pragma: ');
|
||||
header('Cache-Control: ');
|
||||
} else {
|
||||
header("Pragma: private");
|
||||
header("Cache-Control: private, must-revalidate");
|
||||
}
|
||||
|
||||
fpassthru($fd);
|
||||
exit;
|
||||
|
||||
@ -246,6 +246,7 @@ if ($_GET['act'] == "del") {
|
||||
$input_errors[] = "The interface is part of a gif tunnel. Please delete the tunnel to continue";
|
||||
else {
|
||||
unset($config['interfaces'][$id]['enable']);
|
||||
$realid = get_real_interface($id);
|
||||
interface_bring_down($id); /* down the interface */
|
||||
|
||||
unset($config['interfaces'][$id]); /* delete the specified OPTn or LAN*/
|
||||
@ -290,7 +291,7 @@ if ($_GET['act'] == "del") {
|
||||
unset($config['dhcpd']['wan']);
|
||||
}
|
||||
|
||||
link_interface_to_vlans($id, "update");
|
||||
link_interface_to_vlans($realid, "update");
|
||||
|
||||
$savemsg = "Interface has been deleted.";
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* $Id$ */
|
||||
/*
|
||||
pkg.php
|
||||
Copyright (C) 2004, 2005 Scott Ullrich
|
||||
Copyright (C) 2004-2010 Scott Ullrich <sullrich@gmail.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* $Id$ */
|
||||
/*
|
||||
pkg_edit.php
|
||||
Copyright (C) 2004 Scott Ullrich
|
||||
Copyright (C) 2004-2010 Scott Ullrich <sullrich@gmail.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -851,4 +851,4 @@ function parse_package_templates() {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
@ -2,7 +2,7 @@
|
||||
/* $Id$ */
|
||||
/*
|
||||
pkg_mgr.php
|
||||
Copyright (C) 2004, 2005 Scott Ullrich
|
||||
Copyright (C) 2004-2010 Scott Ullrich <sullrich@gmail.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@ -3,7 +3,8 @@
|
||||
/*
|
||||
pkg_mgr_install.php
|
||||
part of pfSense (http://www.pfSense.com)
|
||||
Copyright (C) 2005 Scott Ullrich and Colin Smith
|
||||
Copyright (C) 2004-2010 Scott Ullrich <sullrich@gmail.com>
|
||||
Copyright (C) 2005 Colin Smith
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -227,4 +228,4 @@ if($fd_log)
|
||||
/* read only fs */
|
||||
conf_mount_ro();
|
||||
|
||||
?>
|
||||
?>
|
||||
@ -2,7 +2,7 @@
|
||||
/* $Id$ */
|
||||
/*
|
||||
pkg_mgr.php
|
||||
Copyright (C) 2004 Scott Ullrich
|
||||
Copyright (C) 2004-2010 Scott Ullrich <sullrich@gmail.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
pkg_mgr_settings.php
|
||||
part of pfSense
|
||||
Copyright (C) 2009 Jim Pingle <jimp@pfsense.org>
|
||||
Copyright (C) 2008 Scott Ullrich <sullrich@gmail.com>
|
||||
Copyright (C) 2004-2010 Scott Ullrich <sullrich@gmail.com>
|
||||
Copyright (C) 2005 Colin Smith
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
|
||||
$pgtitle = array("Status", "OpenVPN");
|
||||
require("guiconfig.inc");
|
||||
require_once("vpn.inc");
|
||||
require_once("openvpn.inc");
|
||||
|
||||
/* Handle AJAX */
|
||||
if($_GET['action']) {
|
||||
@ -88,163 +88,9 @@ function kill_client($port, $remipp) {
|
||||
return $killed;
|
||||
}
|
||||
|
||||
$servers = array();
|
||||
$clients = array();
|
||||
$servers = openvpn_get_active_servers();
|
||||
$clients = openvpn_get_active_clients();
|
||||
|
||||
if (is_array($config['openvpn']['openvpn-server'])) {
|
||||
foreach ($config['openvpn']['openvpn-server'] as & $settings) {
|
||||
|
||||
$prot = $settings['protocol'];
|
||||
$port = $settings['local_port'];
|
||||
|
||||
$server = array();
|
||||
$server['port'] = $settings['local_port'];
|
||||
if ($settings['description'])
|
||||
$server['name'] = "{$settings['description']} {$prot}:{$port}";
|
||||
else
|
||||
$server['name'] = "Server {$prot}:{$port}";
|
||||
$server['conns'] = array();
|
||||
|
||||
$tcpsrv = "tcp://127.0.0.1:{$port}";
|
||||
$errval;
|
||||
$errstr;
|
||||
|
||||
/* open a tcp connection to the management port of each server */
|
||||
$fp = @stream_socket_client($tcpsrv, $errval, $errstr, 1);
|
||||
if ($fp) {
|
||||
|
||||
/* send our status request */
|
||||
fputs($fp, "status 2\n");
|
||||
|
||||
/* recv all response lines */
|
||||
while (!feof($fp)) {
|
||||
|
||||
/* read the next line */
|
||||
$line = fgets($fp, 1024);
|
||||
|
||||
/* parse header list line */
|
||||
if (strstr($line, "HEADER"))
|
||||
continue;
|
||||
|
||||
/* parse end of output line */
|
||||
if (strstr($line, "END"))
|
||||
break;
|
||||
|
||||
/* parse client list line */
|
||||
if (strstr($line, "CLIENT_LIST")) {
|
||||
$list = explode(",", $line);
|
||||
$conn = array();
|
||||
$conn['common_name'] = $list[1];
|
||||
$conn['remote_host'] = $list[2];
|
||||
$conn['virtual_addr'] = $list[3];
|
||||
$conn['bytes_recv'] = $list[4];
|
||||
$conn['bytes_sent'] = $list[5];
|
||||
$conn['connect_time'] = $list[6];
|
||||
$server['conns'][] = $conn;
|
||||
}
|
||||
}
|
||||
|
||||
/* cleanup */
|
||||
fclose($fp);
|
||||
} else {
|
||||
$conn = array();
|
||||
$conn['common_name'] = "[error]";
|
||||
$conn['remote_host'] = "Management Daemon Unreachable";
|
||||
$conn['virtual_addr'] = "";
|
||||
$conn['bytes_recv'] = 0;
|
||||
$conn['bytes_sent'] = 0;
|
||||
$conn['connect_time'] = 0;
|
||||
$server['conns'][] = $conn;
|
||||
}
|
||||
|
||||
$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"); ?>
|
||||
|
||||
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?=$jsevents["body"]["onload"];?>">
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -487,6 +487,7 @@ ul#wzdnav a:active {
|
||||
border-bottom: 1px solid #999999;
|
||||
}
|
||||
.formfld {
|
||||
padding-left: 19px;
|
||||
font-size: small;
|
||||
}
|
||||
.formselect {
|
||||
|
||||
@ -487,6 +487,7 @@ ul#wzdnav a:active {
|
||||
border-bottom: 1px solid #999999;
|
||||
}
|
||||
.formfld {
|
||||
padding-left: 19px;
|
||||
font-size: small;
|
||||
}
|
||||
.formselect {
|
||||
|
||||
@ -487,6 +487,7 @@ ul#wzdnav a:active {
|
||||
border-bottom: 1px solid #999999;
|
||||
}
|
||||
.formfld {
|
||||
padding-left: 19px;
|
||||
font-size: small;
|
||||
}
|
||||
.formselect {
|
||||
|
||||
4
usr/local/www/widgets/include/openvpn.inc
Normal file
4
usr/local/www/widgets/include/openvpn.inc
Normal file
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
$openvpn_title = "OpenVPN";
|
||||
$openvpn_title_link = "status_openvpn.php";
|
||||
?>
|
||||
193
usr/local/www/widgets/widgets/openvpn.widget.php
Normal file
193
usr/local/www/widgets/widgets/openvpn.widget.php
Normal file
@ -0,0 +1,193 @@
|
||||
<?php
|
||||
require_once("openvpn.inc");
|
||||
|
||||
/* Handle AJAX */
|
||||
if($_GET['action']) {
|
||||
if($_GET['action'] == "kill") {
|
||||
$port = $_GET['port'];
|
||||
$remipp = $_GET['remipp'];
|
||||
if (!empty($port) and !empty($remipp)) {
|
||||
$retval = kill_client($port, $remipp);
|
||||
echo htmlentities("|{$port}|{$remipp}|{$retval}|");
|
||||
} else {
|
||||
echo "invalid input";
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function kill_client($port, $remipp) {
|
||||
$tcpsrv = "tcp://127.0.0.1:{$port}";
|
||||
$errval;
|
||||
$errstr;
|
||||
|
||||
/* open a tcp connection to the management port of each server */
|
||||
$fp = @stream_socket_client($tcpsrv, $errval, $errstr, 1);
|
||||
$killed = -1;
|
||||
if ($fp) {
|
||||
fputs($fp, "kill {$remipp}\n");
|
||||
while (!feof($fp)) {
|
||||
$line = fgets($fp, 1024);
|
||||
/* parse header list line */
|
||||
if (strpos($line, "INFO:"))
|
||||
continue;
|
||||
if (strpos($line, "UCCESS")) {
|
||||
$killed = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
return $killed;
|
||||
}
|
||||
|
||||
$servers = openvpn_get_active_servers();
|
||||
$clients = openvpn_get_active_clients();
|
||||
?>
|
||||
|
||||
<script src="/javascript/sorttable.js" type="text/javascript"></script>
|
||||
<br/>
|
||||
<form action="status_openvpn.php" method="get" name="iform">
|
||||
<script type="text/javascript">
|
||||
function killClient(mport, remipp) {
|
||||
var busy = function(icon) {
|
||||
icon.onclick = "";
|
||||
icon.src = icon.src.replace("\.gif", "_d.gif");
|
||||
icon.style.cursor = "wait";
|
||||
}
|
||||
|
||||
$A(document.getElementsByName("i:" + mport + ":" + remipp)).each(busy);
|
||||
|
||||
new Ajax.Request(
|
||||
"<?=$_SERVER['SCRIPT_NAME'];?>" +
|
||||
"?action=kill&port=" + mport + "&remipp=" + remipp,
|
||||
{ method: "get", onComplete: killComplete }
|
||||
);
|
||||
}
|
||||
|
||||
function killComplete(req) {
|
||||
var values = req.responseText.split("|");
|
||||
if(values[3] != "0") {
|
||||
alert('<?=gettext("An error occurred.");?>' + ' (' + values[3] + ')');
|
||||
return;
|
||||
}
|
||||
|
||||
$A(document.getElementsByName("r:" + values[1] + ":" + values[2])).each(
|
||||
function(row) { Effect.Fade(row, { duration: 1.0 }); }
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php foreach ($servers as $server): ?>
|
||||
|
||||
<table style="padding-top:0px; padding-bottom:0px; padding-left:0px; padding-right:0px" width="100%" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td colspan="6" class="listtopic">
|
||||
Client connections for <?=$server['name'];?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<table style="padding-top:0px; padding-bottom:0px; padding-left:0px; padding-right:0px" class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="listhdrr">Name/Time</td>
|
||||
<td class="listhdrr">Real/Virtual IP</td>
|
||||
</tr>
|
||||
<?php foreach ($server['conns'] as $conn): ?>
|
||||
<tr name='<?php echo "r:{$server['port']}:{$conn['remote_host']}"; ?>'>
|
||||
<td class="listlr">
|
||||
<?=$conn['common_name'];?>
|
||||
</td>
|
||||
<td class="listr">
|
||||
<?=$conn['remote_host'];?>
|
||||
</td>
|
||||
<td class='list' rowspan="2">
|
||||
<img src='/themes/<?php echo $g['theme']; ?>/images/icons/icon_x.gif' height='17' width='17' border='0'
|
||||
onclick="killClient('<?php echo $server['port']; ?>', '<?php echo $conn['remote_host']; ?>');" style='cursor:pointer;'
|
||||
name='<?php echo "i:{$server['port']}:{$conn['remote_host']}"; ?>'
|
||||
title='Kill client connection from <?php echo $conn['remote_host']; ?>' alt='' />
|
||||
</td>
|
||||
</tr>
|
||||
<tr name='<?php echo "r:{$server['port']}:{$conn['remote_host']}"; ?>'>
|
||||
<td class="listlr">
|
||||
<?=$conn['connect_time'];?>
|
||||
</td>
|
||||
<td class="listr">
|
||||
<?=$conn['virtual_addr'];?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php endforeach; ?>
|
||||
<tr>
|
||||
<td colspan="6" class="list" height="12"></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?php endforeach; ?>
|
||||
<br/>
|
||||
|
||||
|
||||
<?php if (!empty($clients)) { ?>
|
||||
<table style="padding-top:0px; padding-bottom:0px; padding-left:0px; padding-right:0px" width="100%" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td colspan="6" class="listtopic">
|
||||
OpenVPN client instances statistics
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<table style="padding-top:0px; padding-bottom:0px; padding-left:0px; padding-right:0px" class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="listhdrr">Name/Time</td>
|
||||
<td class="listhdrr">Remote/Virtual IP</td>
|
||||
</tr>
|
||||
|
||||
<?php foreach ($clients as $client): ?>
|
||||
<tr name='<?php echo "r:{$client['port']}:{$conn['remote_host']}"; ?>'>
|
||||
<td class="listlr">
|
||||
<?=$client['name'];?>
|
||||
</td>
|
||||
<td class="listr">
|
||||
<?=$client['remote_host'];?>
|
||||
</td>
|
||||
<td rowspan="2" align="center">
|
||||
<?php
|
||||
if ($client['status'] == "up") {
|
||||
/* tunnel is up */
|
||||
$iconfn = "interface_up";
|
||||
} else {
|
||||
/* tunnel is down */
|
||||
$iconfn = "interface_down";
|
||||
}
|
||||
echo "<img src ='/themes/{$g['theme']}/images/icons/icon_{$iconfn}.gif'>";
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr name='<?php echo "r:{$client['port']}:{$conn['remote_host']}"; ?>'>
|
||||
<td class="listlr">
|
||||
<?=$client['connect_time'];?>
|
||||
</td>
|
||||
<td class="listr">
|
||||
<?=$client['virtual_addr'];?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($DisplayNote) {
|
||||
echo "<br/><b>NOTE:</b> You need to bind each OpenVPN client to enable its management daemon: use 'Local port' setting in the OpenVPN client screen";
|
||||
}
|
||||
|
||||
if ((empty($clients)) && (empty($servers))) {
|
||||
echo "No OpenVPN instance defined";
|
||||
}
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user