diff options
-rw-r--r-- | etc/inc/openvpn.inc | 23 | ||||
-rw-r--r-- | usr/local/www/status_openvpn.php | 38 |
2 files changed, 46 insertions, 15 deletions
diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc index 18267d5..43d55c7 100644 --- a/etc/inc/openvpn.inc +++ b/etc/inc/openvpn.inc @@ -958,11 +958,9 @@ function openvpn_get_active_servers($type="multipoint") { else $server['name'] = "Server {$prot}:{$port}"; $server['conns'] = array(); - - $vpnid = $settings['vpnid']; - $mode_id = "server{$vpnid}"; - $server['mgmt'] = $mode_id; - $socket = "unix://{$g['varetc_path']}/openvpn/{$mode_id}.sock"; + $server['vpnid'] = $settings['vpnid']; + $server['mgmt'] = "server{$server['vpnid']}"; + $socket = "unix://{$g['varetc_path']}/openvpn/{$server['mgmt']}.sock"; list($tn, $sm) = explode('/', $settings['tunnel_network']); if ((($server['mode'] == "p2p_shared_key") || ($sm >= 30) ) && ($type == "p2p")) @@ -1032,8 +1030,8 @@ function openvpn_get_server_status($server, $socket) { } else { $conn = array(); $conn['common_name'] = "[error]"; - $conn['remote_host'] = "Management Daemon Unreachable"; - $conn['virtual_addr'] = ""; + $conn['remote_host'] = "Unable to contact daemon"; + $conn['virtual_addr'] = "Service not running?"; $conn['bytes_recv'] = 0; $conn['bytes_sent'] = 0; $conn['connect_time'] = 0; @@ -1062,10 +1060,9 @@ function openvpn_get_active_clients() { else $client['name'] = "Client {$prot}{$port}"; - $vpnid = $settings['vpnid']; - $mode_id = "client{$vpnid}"; - $client['mgmt'] = $mode_id; - $socket = "unix://{$g['varetc_path']}/openvpn/{$mode_id}.sock"; + $client['vpnid'] = $settings['vpnid']; + $client['mgmt'] = "client{$client['vpnid']}"; + $socket = "unix://{$g['varetc_path']}/openvpn/{$client['mgmt']}.sock"; $client['status']="down"; $clients[] = openvpn_get_client_status($client, $socket); @@ -1155,8 +1152,8 @@ function openvpn_get_client_status($client, $socket) { } else { $DisplayNote=true; - $client['remote_host'] = "No Management Daemon"; - $client['virtual_addr'] = "See Note Below"; + $client['remote_host'] = "Unable to contact daemon"; + $client['virtual_addr'] = "Service not running?"; $client['bytes_recv'] = 0; $client['bytes_sent'] = 0; $client['connect_time'] = 0; diff --git a/usr/local/www/status_openvpn.php b/usr/local/www/status_openvpn.php index 4568fb9..28a9765 100644 --- a/usr/local/www/status_openvpn.php +++ b/usr/local/www/status_openvpn.php @@ -48,6 +48,7 @@ $shortcut_section = "openvpn"; require("guiconfig.inc"); require_once("openvpn.inc"); +require_once("shortcuts.inc"); /* Handle AJAX */ if($_GET['action']) { @@ -189,7 +190,16 @@ include("head.inc"); ?> <?php endforeach; ?> <tfoot> <tr> - <td colspan="6" class="list" height="12"></td> + <td colspan="2" class="list" height="12"> + <table> + <tr> + <?php $ssvc = find_service_by_openvpn_vpnid($server['vpnid']); ?> + <?= get_service_status_icon($ssvc, true, true); ?> + <td><?= get_service_control_links($ssvc, true); ?></td> + </tr> + </table> + </td> + <td colspan="4" class="list" height="12"> </td> </tr> </tfoot> </table> @@ -293,6 +303,18 @@ include("head.inc"); ?> </td> </tr> <?php endforeach; ?> + <tr> + <td colspan="2" class="list" height="12"> + <table> + <tr> + <?php $ssvc = find_service_by_openvpn_vpnid($sk_server['vpnid']); ?> + <?= get_service_status_icon($ssvc, true, true); ?> + <td><?= get_service_control_links($ssvc, true); ?></td> + </tr> + </table> + </td> + <td colspan="5" class="list" height="12"> </td> + </tr> </table> </tr> </table> @@ -344,6 +366,18 @@ include("head.inc"); ?> </td> </tr> <?php endforeach; ?> + <tr> + <td colspan="2" class="list" height="12"> + <table> + <tr> + <?php $ssvc = find_service_by_openvpn_vpnid($client['vpnid']); ?> + <?= get_service_status_icon($ssvc, true, true); ?> + <td><?= get_service_control_links($ssvc, true); ?></td> + </tr> + </table> + </td> + <td colspan="5" class="list" height="12"> </td> + </tr> </table> </tr> </table> @@ -352,7 +386,7 @@ include("head.inc"); ?> } if ($DisplayNote) { - echo "<br/><b>" . gettext("NOTE") . ":</b> " . gettext("You need to bind each OpenVPN client to enable its management daemon: use 'Local port' setting in the OpenVPN client screen"); + echo "<br/><b>" . gettext("NOTE") . ":</b> " . gettext("If you have custom options that override the management features of OpenVPN on a client or server, they will cause that OpenVPN instance to not work correctly with this status page."); } if ((empty($clients)) && (empty($servers)) && (empty($sk_servers))) { |