Skip to content

Commit

Permalink
(captive portal) add service to status page, closes #771
Browse files Browse the repository at this point in the history
  • Loading branch information
AdSchellevis committed Feb 10, 2016
1 parent 492a751 commit 705d1e5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/etc/inc/services.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2678,7 +2678,24 @@ function get_services() {
$services[] = array('name'=>'squid', 'description' => gettext("Proxy server"));
}
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"));
Expand Down Expand Up @@ -2724,6 +2741,9 @@ function get_service_status($service)
case 'configd':
$running = isvalidpid('/var/run/configd.pid');
break;
case 'captiveportal':
$running = isvalidpid('/var/run/lighttpd-api-dispatcher.pid');
break;
default:
$running = is_process_running($service['name']);
break;
Expand Down
9 changes: 9 additions & 0 deletions src/www/status_services.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ function service_control_start($name, $extras) {
case 'configd':
mwexec('/usr/local/etc/rc.d/configd start');
break;
case 'captiveportal':
configd_run("captiveportal start");
break;
default:
log_error(sprintf(gettext("Could not start unknown service `%s'"), $name));
break;
Expand Down Expand Up @@ -201,6 +204,9 @@ function service_control_stop($name, $extras) {
case 'configd':
killbypid("/var/run/configd.pid");
break;
case 'captiveportal':
configd_run("captiveportal stop");
break;
default:
log_error(sprintf(gettext("Could not stop unknown service `%s'"), $name));
break;
Expand Down Expand Up @@ -273,6 +279,9 @@ function service_control_restart($name, $extras) {
case 'configd':
mwexec('/usr/local/etc/rc.d/configd restart');
break;
case 'captiveportal':
configd_run("captiveportal restart");
break;
default:
log_error(sprintf(gettext("Could not restart unknown service `%s'"), $name));
break;
Expand Down

0 comments on commit 705d1e5

Please sign in to comment.