Project

General

Profile

Bug #6235 ยป snort_check_for_rule_updates.patch

Sander Peterse, 04/16/2021 03:04 AM

View differences:

/usr/local/pkg/snort/snort_check_for_rule_updates.php 2021-04-16 09:57:55.130229000 +0200
434 434
$last_curl_error = "";
435 435
$update_errors = false;
436 436

  
437
/* Store the Snort running state before we starting doing things. So we can use it the determine if we should restart the services even when it has crashed due to the update process. */
438
$snort_running = is_service_running("snort");
439

  
437 440
/*  Check for and download any new Snort Subscriber Rules sigs */
438 441
if ($snortdownload == 'on') {
439 442
	if (snort_check_rule_md5("{$snort_rule_url}{$snort_filename_md5}?oinkcode={$oinkid}", "{$tmpfname}/{$snort_filename_md5}", "Snort Subscriber rules")) {
......
833 836
	$rebuild_rules = false;
834 837

  
835 838
	/* Restart snort if running, and not in post-install, so as to pick up the new rules. */
836
       	if (!$g['snort_postinstall'] && is_service_running("snort") && count($config['installedpackages']['snortglobal']['rule']) > 0) {
839
       	if (!$g['snort_postinstall'] && $snort_running && count($config['installedpackages']['snortglobal']['rule']) > 0) {
837 840
		snort_update_status(gettext('Restarting Snort to activate the new set of rules...'));
838 841
		error_log(gettext("\tRestarting Snort to activate the new set of rules...\n"), 3, SNORT_RULES_UPD_LOGFILE);
839 842
		touch("{$g['varrun_path']}/snort_pkg_starting.lck");
......
850 853
	/* Only updated OpenAppID detectors, so do not need to rebuild all interface rules.   */
851 854
	/* Restart snort if running, and not in post-install, so as to pick up the detectors. */
852 855
	/**************************************************************************************/
853
       	if (!$g['snort_postinstall'] && is_service_running("snort") && count($config['installedpackages']['snortglobal']['rule']) > 0) {
856
       	if (!$g['snort_postinstall'] && $snort_running && count($config['installedpackages']['snortglobal']['rule']) > 0) {
854 857
		snort_update_status(gettext('Restarting Snort to activate the new OpenAppID detectors...'));
855 858
		error_log(gettext("\tRestarting Snort to activate the new OpenAppID detectors...\n"), 3, SNORT_RULES_UPD_LOGFILE);
856 859
		touch("{$g['varrun_path']}/snort_pkg_starting.lck");
    (1-1/1)