Commit 6d2c81d7 authored by Franco Fichtner's avatar Franco Fichtner

plugins: everything should be plugins...

Since plugins are now tied to the heartbeat of the system itself,
it makes sense to split out hardcoded base functionality into
their pluggable counterparts.  Start with the candidates that
already have a plugin file.

Discussed with: @adschellevis
parent 67aeec79
......@@ -28,8 +28,30 @@
function miniupnpd_firewall($fw)
{
global $config;
if (isset($config['installedpackages']['miniupnpd']['config'][0]['enable'])) {
$fw->registerAnchor("miniupnpd/*", "rdr");
$fw->registerAnchor("miniupnpd/*", "fw");
}
}
function miniupnpd_services()
{
global $config;
$services = array();
if (isset($config['installedpackages']['miniupnpd']['config'][0]['enable'])) {
$pconfig = array();
$pconfig['name'] = "miniupnpd";
$pconfig['description'] = gettext("UPnP Service");
$pconfig['description'] = gettext("UPnP Service");
$pconfig['php']['restart'] = array('upnp_stop', 'upnp_start');
$pconfig['php']['start'] = array('upnp_start');
$pconfig['php']['stop'] = array('upnp_stop');
$pconfig['pidfile'] = '/var/run/miniupnpd.pid';
$services[] = $pconfig;
}
return $services;
}
......@@ -26,6 +26,26 @@
POSSIBILITY OF SUCH DAMAGE.
*/
function squid_services()
{
global $config;
$services = array();
if (isset($config['OPNsense']['proxy']['general']['enabled']) && $config['OPNsense']['proxy']['general']['enabled'] == 1) {
$services[] = array(
'description' => gettext('Proxy server'),
'configd' => array(
'restart' => array('proxy restart'),
'start' => array('proxy start'),
'stop' => array('proxy stop'),
),
'name' => 'squid',
);
}
return $services;
}
function squid_syslog()
{
......
......@@ -26,6 +26,26 @@
POSSIBILITY OF SUCH DAMAGE.
*/
function suricata_services()
{
global $config;
$services = array();
if (isset($config['OPNsense']['IDS']['general']['enabled']) && $config['OPNsense']['IDS']['general']['enabled'] == 1) {
$services[] = array(
'description' => gettext('Intrusion Detection'),
'configd' => array(
'restart' => array('ids restart'),
'start' => array('ids start'),
'stop' => array('ids stop'),
),
'name' => 'suricata',
);
}
return $services;
}
function suricata_syslog()
{
......
......@@ -2494,18 +2494,6 @@ function services_get()
$services[] = $pconfig;
}
if (isset($config['installedpackages']['miniupnpd']) && $config['installedpackages']['miniupnpd']['config'][0]['enable']) {
$pconfig = array();
$pconfig['name'] = "miniupnpd";
$pconfig['description'] = gettext("UPnP Service");
$pconfig['description'] = gettext("UPnP Service");
$pconfig['php']['restart'] = array('upnp_stop', 'upnp_start');
$pconfig['php']['start'] = array('upnp_start');
$pconfig['php']['stop'] = array('upnp_stop');
$pconfig['pidfile'] = '/var/run/miniupnpd.pid';
$services[] = $pconfig;
}
if (isset($config['system']['ssh']['enabled'])) {
$pconfig = array();
$pconfig['name'] = 'sshd';
......@@ -2524,30 +2512,6 @@ function services_get()
$services[] = $pconfig;
}
if (isset($config['OPNsense']['proxy']['general']['enabled']) && $config['OPNsense']['proxy']['general']['enabled'] == 1) {
$services[] = array(
'description' => gettext('Proxy server'),
'configd' => array(
'restart' => array('proxy restart'),
'start' => array('proxy start'),
'stop' => array('proxy stop'),
),
'name' => 'squid',
);
}
if (isset($config['OPNsense']['IDS']['general']['enabled']) && $config['OPNsense']['IDS']['general']['enabled'] == 1) {
$services[] = array(
'description' => gettext('Intrusion Detection'),
'configd' => array(
'restart' => array('ids restart'),
'start' => array('ids start'),
'stop' => array('ids stop'),
),
'name' => 'suricata',
);
}
if (isset($config['OPNsense']['captiveportal']['zones']['zone'])) {
$enabled = false;
if (!empty($config['OPNsense']['captiveportal']['zones']['zone']['enabled'])) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment