$rcdir = RCFILEPREFIX;
$suricata_rules_upd_log = RULES_UPD_LOGFILE;
$suri_pf_table = SURICATA_PF_TABLE;
log_error(gettext("[Suricata] Suricata package uninstall in progress..."));
/* Make sure all active Suricata processes are terminated */
/* Log a message only if a running process is detected */
if (is_service_running("suricata")) {
    log_error(gettext("[Suricata] Suricata STOP for all interfaces..."));
}
killbyname("suricata");
sleep(1);
// Delete any leftover suricata PID files in /var/run
unlink_if_exists("{$g['varrun_path']}/suricata_*.pid");
/* Make sure all active Barnyard2 processes are terminated */
/* Log a message only if a running process is detected     */
if (is_service_running("barnyard2")) {
    log_error(gettext("[Suricata] Barnyard2 STOP for all interfaces..."));
}
killbyname("barnyard2");
sleep(1);
// Delete any leftover barnyard2 PID files in /var/run
unlink_if_exists("{$g['varrun_path']}/barnyard2_*.pid");
/* Remove the Suricata cron jobs. */
install_cron_job("suricata_check_for_rule_updates.php", false);
install_cron_job("suricata_check_cron_misc.inc", false);
install_cron_job("{$suri_pf_table}", false);
/* See if we are to keep Suricata log files on uninstall */
if ($config['installedpackages']['suricata']['config'][0]['clearlogs'] == 'on') {
    log_error(gettext("[Suricata] Clearing all Suricata-related log files..."));
    @unlink("{$suricata_rules_upd_log}");
    mwexec("/bin/rm -rf {$suricatalogdir}");
        if ($pkg_interface != "console") {
            update_output_window(gettext("Snort has restarted with your new set of rules..."));
        }
        log_error(gettext("[Snort] Snort has restarted with your new set of rules..."));
        error_log(gettext("\tSnort has restarted with your new set of rules.\n"), 3, SNORT_RULES_UPD_LOGFILE);
    } else {
        if ($pkg_interface != "console") {
            update_output_window(gettext("The rules update task is complete..."));
        }
    }
} elseif ($openappid_detectors == 'on') {
    /**************************************************************************************/
    /* Only updated OpenAppID detectors, so do not need to rebuild all interface rules.   */
    /* Restart snort if running, and not in post-install, so as to pick up the detectors. */
    /**************************************************************************************/
    if (!$g['snort_postinstall'] && is_service_running("snort") && count($config['installedpackages']['snortglobal']['rule']) > 0) {
        if ($pkg_interface != "console") {
            update_status(gettext('Restarting Snort to activate the new OpenAppID detectors...'));
            update_output_window(gettext("Please wait ... restarting Snort will take some time..."));
        }
        error_log(gettext("\tRestarting Snort to activate the new OpenAppID detectors...\n"), 3, SNORT_RULES_UPD_LOGFILE);
        touch("{$g['varrun_path']}/snort_pkg_starting.lck");
        snort_restart_all_interfaces(TRUE);
        sleep(2);
        unlink_if_exists("{$g['varrun_path']}/snort_pkg_starting.lck");
        if ($pkg_interface != "console") {
            update_output_window(gettext("Snort has restarted with your new set of OpenAppID detectors..."));
        }
        log_error(gettext("[Snort] Snort has restarted with your new set of OpenAppID detectors..."));
        error_log(gettext("\tSnort has restarted with your new set of OpenAppID detectors.\n"), 3, SNORT_RULES_UPD_LOGFILE);
    } else {
    $pconfig['name'] = "racoon";
    $pconfig['description'] = gettext("IPsec VPN");
    $services[] = $pconfig;
    unset($pconfig);
}
if ($services) {
    foreach ($services as $service) {
        if (!$service['name']) {
            continue;
        }
        if (!$service['description']) {
            $service['description'] = get_pkg_descr($service['name']);
        }
        echo '<tr><td class="listlr">' . $service['name'] . '</td>';
        echo '<td class="listr">' . $service['description'] . '</td>';
        if (is_service_running($service['name'], $ps) or is_process_running($service['name'])) {
            echo '<td class="listr"><center>';
            echo "<img src=\"/themes/" . $g["theme"] . "/images/icons/icon_pass.gif\"> Running</td>";
            $running = true;
        } else {
            echo '<td class="listbg"><center>';
            echo "<img src=\"/themes/" . $g["theme"] . "/images/icons/icon_block.gif\"> <font color=\"white\">Stopped</td>";
            $running = false;
        }
        echo '<td valign="middle" class="list" nowrap>';
        if ($running) {
            echo "<a href='status_services.php?mode=restartservice&service={$service['name']}'>";
            echo "<img title='Restart Service' border='0' src='./themes/" . $g['theme'] . "/images/icons/icon_service_restart.gif'></a> ";
            echo "<a href='status_services.php?mode=stopservice&service={$service['name']}'>";
            echo "<img title='Stop Service' border='0' src='./themes/" . $g['theme'] . "/images/icons/icon_service_stop.gif'> ";
            echo "</a>";
					<?php 
echo "<input height='14' title='Show Proxy settings page' name='scan' type='image' value='scan' src='./themes/" . $g['theme'] . "/images/icons/icon_service_start.gif' />";
?>
					&nbsp;Proxy Settings
				</a>
			</td>
			-->
		</tr>
		<tr>
			<td class="listlr">Antivirus Server ( <?php 
echo clamd_status();
?>
 )</td>
			<td class="listr"><center>
			<?php 
$running = (is_service_running("clamd", $ps) or is_process_running("clamd"));
if ($running) {
    echo "<img src=\"/themes/" . $g["theme"] . "/images/icons/icon_pass.gif\" alt=\"\" /> Running";
} else {
    echo "<img src=\"/themes/" . $g["theme"] . "/images/icons/icon_block.gif\" alt=\"\" /> Stopped";
}
?>
			</td>
			<td class="listr">&nbsp;</td>
			<td class="listr">
			<?php 
echo exec("clamd -V");
?>
			</td>
			<!--
			<td class="listr">
Beispiel #5
0
 foreach ($services as $service) {
     if (empty($service['name'])) {
         continue;
     }
     if (empty($service['description'])) {
         $service['description'] = get_pkg_descr($service['name']);
     }
     echo '<tr><td class="listlr">' . $service['name'] . '</td>' . "\n";
     echo '<td class="listr">' . $service['description'] . '</td>' . "\n";
     if ($service['name'] == "openvpn") {
         $running = is_pid_running("{$g['varrun_path']}/openvpn_{$service['mode']}{$service['vpnid']}.pid");
     } else {
         if ($service['name'] == "captiveportal") {
             $running = is_pid_running("{$g['varrun_path']}/lighty-CaptivePortal.pid");
         } else {
             $running = is_service_running($service['name']);
         }
     }
     if ($running) {
         echo "<td class=\"listr\" align=\"center\">\n";
         echo "<img src=\"/themes/" . $g["theme"] . "/images/icons/icon_pass.gif\"> " . gettext("Running") . "</td>\n";
     } else {
         echo "<td class=\"listbg\" align=\"center\">\n";
         echo "<img src=\"/themes/" . $g["theme"] . "/images/icons/icon_block.gif\"> <font color=\"white\">" . gettext("Stopped") . "</td>\n";
     }
     echo '<td valign="middle" class="list" nowrap>';
     if ($running) {
         if ($service['name'] == "openvpn") {
             echo "<a href='status_services.php?mode=restartservice&service={$service['name']}&vpnmode={$service['mode']}&id={$service['vpnid']}'>";
         } else {
             echo "<a href='status_services.php?mode=restartservice&service={$service['name']}'>";
function squid_clamav_version()
{
    global $clamd_path, $cicap_cfg_path, $img;
    if (is_executable($clamd_path)) {
        $s = is_service_running("clamd") ? $img['up'] : $img['down'];
        $version = preg_split("@/@", shell_exec("{$clamd_path} -V"));
        $s .= "&nbsp;&nbsp;{$version[0]}";
    } else {
        $s .= "&nbsp;&nbsp;ClamAV: N/A";
    }
    if (is_executable($cicap_cfg_path)) {
        $s .= "&nbsp;&nbsp;";
        $s .= is_service_running("c-icap") ? $img['up'] : $img['down'];
        $s .= "&nbsp;&nbsp;C-ICAP " . shell_exec("{$cicap_cfg_path} --version");
    } else {
        $s .= "&nbsp;&nbsp;C-ICAP: N/A";
    }
    if (file_exists("/usr/local/www/squid_clwarn.php")) {
        preg_match("@(VERSION.*).(\\d{1}).(\\d{2})@", file_get_contents("/usr/local/www/squid_clwarn.php"), $squidclamav_version);
        $s .= "+&nbsp;&nbsp;SquidClamav " . str_replace("'", "", strstr($squidclamav_version[0], "'"));
    } else {
        $s .= "+&nbsp;&nbsp;SquidClamav: N/A";
    }
    return $s;
}