summaryrefslogtreecommitdiffstats
path: root/usr/local
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2011-07-27 11:36:08 -0400
committerjim-p <jimp@pfsense.org>2011-07-27 11:37:18 -0400
commit95305736abcdf964f9ea03ebd628b1abbfeab5fc (patch)
tree6299cb65a570e93bcea87a82e11759bd318c04e5 /usr/local
parent6b2dcac596477f7201a0c6b5734ab8f1b9a04c5e (diff)
downloadpfsense-95305736abcdf964f9ea03ebd628b1abbfeab5fc.zip
pfsense-95305736abcdf964f9ea03ebd628b1abbfeab5fc.tar.gz
Rework OpenVPN status, show status for shared key servers.
Diffstat (limited to 'usr/local')
-rw-r--r--usr/local/www/status_openvpn.php59
-rw-r--r--usr/local/www/widgets/widgets/openvpn.widget.php58
2 files changed, 106 insertions, 11 deletions
diff --git a/usr/local/www/status_openvpn.php b/usr/local/www/status_openvpn.php
index 30c3a84..4ad65d5 100644
--- a/usr/local/www/status_openvpn.php
+++ b/usr/local/www/status_openvpn.php
@@ -98,6 +98,7 @@ function kill_client($port, $remipp) {
}
$servers = openvpn_get_active_servers();
+$sk_servers = openvpn_get_active_servers("sharedkey");
$clients = openvpn_get_active_clients();
include("head.inc"); ?>
@@ -141,13 +142,10 @@ include("head.inc"); ?>
<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">
- <?=gettext("Client connections for"); ?> <?=$server['name'];?>
+ <?=$server['name'];?> <?=gettext("Client connections"); ?>
</td>
</tr>
<tr>
-<?php if ($server['mode'] == "p2p_shared_key"): ?>
- <td>Status data is not available for shared key servers.</td>
-<?php else: ?>
<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>
@@ -194,19 +192,68 @@ include("head.inc"); ?>
</table>
</td>
-<? endif; ?>
</tr>
</table>
<?php endforeach; ?>
<br>
+<?php if (!empty($sk_servers)) { ?>
+<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">
+ <?=gettext("Shared Key Server Instance 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"><?=gettext("Name"); ?></td>
+ <td class="listhdrr"><?=gettext("Status"); ?></td>
+ <td class="listhdrr"><?=gettext("Connected Since"); ?></td>
+ <td class="listhdrr"><?=gettext("Virtual Addr"); ?></td>
+ <td class="listhdrr"><?=gettext("Remote Host"); ?></td>
+ <td class="listhdrr"><?=gettext("Bytes Sent"); ?></td>
+ <td class="listhdrr"><?=gettext("Bytes Received"); ?></td>
+ </tr>
+<?php foreach ($sk_servers as $sk_server): ?>
+ <tr name='<?php echo "r:{$client['port']}:{$conn['remote_host']}"; ?>'>
+ <td class="listlr">
+ <?=$sk_server['name'];?>
+ </td>
+ <td class="listlr">
+ <?=$sk_server['status'];?>
+ </td>
+ <td class="listr">
+ <?=$sk_server['connect_time'];?>
+ </td>
+ <td class="listr">
+ <?=$sk_server['virtual_addr'];?>
+ </td>
+ <td class="listr">
+ <?=$sk_server['remote_host'];?>
+ </td>
+ <td class="listr">
+ <?=$sk_server['bytes_sent'];?>
+ </td>
+ <td class="listr">
+ <?=$sk_server['bytes_recv'];?>
+ </td>
+ </tr>
+<?php endforeach; ?>
+ </table>
+ </tr>
+</table>
+
+<?php
+} ?>
+<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">
- <?=gettext("OpenVPN client instances statistics"); ?>
+ <?=gettext("Client Instance Statistics"); ?>
</td>
</tr>
<tr>
diff --git a/usr/local/www/widgets/widgets/openvpn.widget.php b/usr/local/www/widgets/widgets/openvpn.widget.php
index c93c708..4d186f0 100644
--- a/usr/local/www/widgets/widgets/openvpn.widget.php
+++ b/usr/local/www/widgets/widgets/openvpn.widget.php
@@ -55,6 +55,7 @@ function kill_client($port, $remipp) {
}
$servers = openvpn_get_active_servers();
+$sk_servers = openvpn_get_active_servers("sharedkey");
$clients = openvpn_get_active_clients();
?>
@@ -95,7 +96,7 @@ $clients = openvpn_get_active_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">
- Client connections for <?=$server['name'];?>
+ <?=$server['name'];?> Client connections
</td>
</tr>
<tr>
@@ -140,14 +141,61 @@ $clients = openvpn_get_active_clients();
</table>
<?php endforeach; ?>
-<br/>
+<?php if (!empty($sk_servers)) { ?>
+<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">
+ Shared Key Server Instance 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 ($sk_servers as $sk_server): ?>
+ <tr name='<?php echo "r:{$sk_server['port']}:{$sk_server['remote_host']}"; ?>'>
+ <td class="listlr">
+ <?=$sk_server['name'];?>
+ </td>
+ <td class="listr">
+ <?=$sk_server['remote_host'];?>
+ </td>
+ <td rowspan="2" align="center">
+ <?php
+ if ($sk_server['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:{$sk_server['port']}:{$sk_server['remote_host']}"; ?>'>
+ <td class="listlr">
+ <?=$sk_server['connect_time'];?>
+ </td>
+ <td class="listr">
+ <?=$sk_server['virtual_addr'];?>
+ </td>
+ </tr>
+<?php endforeach; ?>
+ </table>
+ </tr>
+</table>
+<?php
+} ?>
<?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
+ Client Instance Statistics
</td>
</tr>
<tr>
@@ -158,7 +206,7 @@ $clients = openvpn_get_active_clients();
</tr>
<?php foreach ($clients as $client): ?>
- <tr name='<?php echo "r:{$client['port']}:{$conn['remote_host']}"; ?>'>
+ <tr name='<?php echo "r:{$client['port']}:{$client['remote_host']}"; ?>'>
<td class="listlr">
<?=$client['name'];?>
</td>
@@ -178,7 +226,7 @@ $clients = openvpn_get_active_clients();
?>
</td>
</tr>
- <tr name='<?php echo "r:{$client['port']}:{$conn['remote_host']}"; ?>'>
+ <tr name='<?php echo "r:{$client['port']}:{$client['remote_host']}"; ?>'>
<td class="listlr">
<?=$client['connect_time'];?>
</td>
OpenPOWER on IntegriCloud