Commit 0ceaef12 authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

(captive portal) add service to status page, closes https://github.com/opnsense/core/issues/771

(cherry picked from commit 705d1e50)
parent 78002c42
...@@ -2678,7 +2678,24 @@ function get_services() { ...@@ -2678,7 +2678,24 @@ function get_services() {
$services[] = array('name'=>'squid', 'description' => gettext("Proxy server")); $services[] = array('name'=>'squid', 'description' => gettext("Proxy server"));
} }
if (isset($config['OPNsense']['IDS']['general']['enabled']) && $config['OPNsense']['IDS']['general']['enabled'] == 1) { if (isset($config['OPNsense']['IDS']['general']['enabled']) && $config['OPNsense']['IDS']['general']['enabled'] == 1) {
$services[] = array('name'=>'suricata', 'description' => gettext("Intrusion Detection")); $services[] = array('name'=>'suricata', 'description' => gettext("Intrusion Detection"));
}
if (isset($config['OPNsense']['captiveportal']['zones']['zone'])) {
$enabled = false;
if (!empty($config['OPNsense']['captiveportal']['zones']['zone']['enabled'])) {
// single zone and enabled
$enabled = true;
} else {
// possible more zones, traverse items
foreach ($config['OPNsense']['captiveportal']['zones']['zone'] as $zone) {
if (!empty($zone['enabled'])) {
$enabled = true;
}
}
}
if ($enabled) {
$services[] = array('name'=>'captiveportal', 'description' => gettext("Captive Portal"));
}
} }
$services[] = array('name'=>'configd', 'description' => gettext("System Configuration Daemon")); $services[] = array('name'=>'configd', 'description' => gettext("System Configuration Daemon"));
...@@ -2724,6 +2741,9 @@ function get_service_status($service) ...@@ -2724,6 +2741,9 @@ function get_service_status($service)
case 'configd': case 'configd':
$running = isvalidpid('/var/run/configd.pid'); $running = isvalidpid('/var/run/configd.pid');
break; break;
case 'captiveportal':
$running = isvalidpid('/var/run/lighttpd-api-dispatcher.pid');
break;
default: default:
$running = is_process_running($service['name']); $running = is_process_running($service['name']);
break; break;
......
...@@ -129,6 +129,9 @@ function service_control_start($name, $extras) { ...@@ -129,6 +129,9 @@ function service_control_start($name, $extras) {
case 'configd': case 'configd':
mwexec('/usr/local/etc/rc.d/configd start'); mwexec('/usr/local/etc/rc.d/configd start');
break; break;
case 'captiveportal':
configd_run("captiveportal start");
break;
default: default:
log_error(sprintf(gettext("Could not start unknown service `%s'"), $name)); log_error(sprintf(gettext("Could not start unknown service `%s'"), $name));
break; break;
...@@ -201,6 +204,9 @@ function service_control_stop($name, $extras) { ...@@ -201,6 +204,9 @@ function service_control_stop($name, $extras) {
case 'configd': case 'configd':
killbypid("/var/run/configd.pid"); killbypid("/var/run/configd.pid");
break; break;
case 'captiveportal':
configd_run("captiveportal stop");
break;
default: default:
log_error(sprintf(gettext("Could not stop unknown service `%s'"), $name)); log_error(sprintf(gettext("Could not stop unknown service `%s'"), $name));
break; break;
...@@ -273,6 +279,9 @@ function service_control_restart($name, $extras) { ...@@ -273,6 +279,9 @@ function service_control_restart($name, $extras) {
case 'configd': case 'configd':
mwexec('/usr/local/etc/rc.d/configd restart'); mwexec('/usr/local/etc/rc.d/configd restart');
break; break;
case 'captiveportal':
configd_run("captiveportal restart");
break;
default: default:
log_error(sprintf(gettext("Could not restart unknown service `%s'"), $name)); log_error(sprintf(gettext("Could not restart unknown service `%s'"), $name));
break; break;
......
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