mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 16:44:39 +00:00
plugins: tweak wording on functions / files; ipsec and openvpn service plugin
This commit is contained in:
parent
40cfb0da7f
commit
4bad5b3437
@ -58,7 +58,7 @@ function plugins_interfaces()
|
||||
// register / update interfaces
|
||||
foreach (plugin_scan() as $name => $path) {
|
||||
require_once $path;
|
||||
$func = sprintf('%s_interface', $name);
|
||||
$func = sprintf('%s_interfaces', $name);
|
||||
if (function_exists($func)) {
|
||||
foreach ($func() as $intf_ref => $intf_data) {
|
||||
if (is_array($intf_data)) {
|
||||
|
||||
@ -26,9 +26,10 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
function plugin_ifgroups_interface()
|
||||
function if_group_interfaces()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$interfaces = array();
|
||||
|
||||
/* add interface groups */
|
||||
@ -26,9 +26,30 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
function plugin_ipsec_interface()
|
||||
function if_ipsec_services()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$services = array();
|
||||
|
||||
if (isset($config['ipsec']['enable'])) {
|
||||
$pconfig = array();
|
||||
$pconfig['name'] = 'ipsec';
|
||||
$pconfig['description'] = gettext('IPsec VPN');
|
||||
$pconfig['pidfile'] = '/var/run/charon.pid';
|
||||
$pconfig['php']['restart'] = array('ipsec_force_reload');
|
||||
$pconfig['php']['start'] = array('ipsec_force_reload');
|
||||
$pconfig['mwexec']['stop'] = array('/usr/local/sbin/ipsec stop');
|
||||
$services[] = $pconfig;
|
||||
}
|
||||
|
||||
return $services;
|
||||
}
|
||||
|
||||
function if_ipsec_interfaces()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$interfaces = array();
|
||||
|
||||
/* add ipsec interfaces */
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2016 Deciso B.V.
|
||||
All rights reserved.
|
||||
@ -25,10 +26,39 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
function plugin_openvpn_interface()
|
||||
function if_openvpn_services()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$services = array();
|
||||
|
||||
foreach (array('server', 'client') as $mode) {
|
||||
if (isset($config['openvpn']["openvpn-{$mode}"])) {
|
||||
foreach ($config['openvpn']["openvpn-{$mode}"] as $setting) {
|
||||
if (!isset($setting['disable'])) {
|
||||
$pconfig = array();
|
||||
/* XXX clean up name print */
|
||||
$pconfig['description'] = gettext("OpenVPN") . " ".$mode.": ".htmlspecialchars($setting['description']);
|
||||
$pconfig['php']['restart'] = array('openvpn_restart_by_id');
|
||||
$pconfig['php']['start'] = array('openvpn_restart_by_id');
|
||||
$pconfig['php']['args'] = array('mode', 'id');
|
||||
$pconfig['pidfile'] = "/var/run/openvpn_{$mode}{$setting['vpnid']}.pid";
|
||||
$pconfig['id'] = $setting['vpnid'];
|
||||
$pconfig['name'] = 'openvpn';
|
||||
$pconfig['mode'] = $mode;
|
||||
$services[] = $pconfig;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $services;
|
||||
}
|
||||
|
||||
function if_openvpn_interfaces()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$interfaces = array();
|
||||
|
||||
/* add openvpn interfaces */
|
||||
@ -2596,17 +2596,6 @@ function services_get()
|
||||
$services[] = $pconfig;
|
||||
}
|
||||
|
||||
if (isset($config['ipsec']['enable'])) {
|
||||
$pconfig = array();
|
||||
$pconfig['name'] = "ipsec";
|
||||
$pconfig['description'] = gettext("IPsec VPN");
|
||||
$pconfig['pidfile'] = '/var/run/charon.pid';
|
||||
$pconfig['php']['restart'] = array('ipsec_force_reload');
|
||||
$pconfig['php']['start'] = array('ipsec_force_reload');
|
||||
$pconfig['mwexec']['stop'] = array('/usr/local/sbin/ipsec stop');
|
||||
$services[] = $pconfig;
|
||||
}
|
||||
|
||||
if (isset($config['system']['ssh']['enabled'])) {
|
||||
$pconfig = array();
|
||||
$pconfig['name'] = 'sshd';
|
||||
@ -2616,25 +2605,6 @@ function services_get()
|
||||
$services[] = $pconfig;
|
||||
}
|
||||
|
||||
foreach (array('server', 'client') as $mode) {
|
||||
if (isset($config['openvpn']["openvpn-{$mode}"])) {
|
||||
foreach ($config['openvpn']["openvpn-{$mode}"] as $setting) {
|
||||
if (!isset($setting['disable'])) {
|
||||
$pconfig = array();
|
||||
$pconfig['description'] = gettext("OpenVPN") . " ".$mode.": ".htmlspecialchars($setting['description']);
|
||||
$pconfig['php']['restart'] = array('openvpn_restart_by_id');
|
||||
$pconfig['php']['start'] = array('openvpn_restart_by_id');
|
||||
$pconfig['php']['args'] = array('mode', 'id');
|
||||
$pconfig['pidfile'] = "/var/run/openvpn_{$mode}{$setting['vpnid']}.pid";
|
||||
$pconfig['id'] = $setting['vpnid'];
|
||||
$pconfig['name'] = 'openvpn';
|
||||
$pconfig['mode'] = $mode;
|
||||
$services[] = $pconfig;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($config['load_balancer']['virtual_server']) && isset($config['load_balancer']['lbpool']) && count($config['load_balancer']['virtual_server']) && count($config['load_balancer']['lbpool'])) {
|
||||
$pconfig = array();
|
||||
$pconfig['name'] = "relayd";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user