From 10a9321a06c5e0dfa8f3e89deb7a5f92be688fd1 Mon Sep 17 00:00:00 2001 From: Ermal Date: Fri, 15 Jun 2012 20:23:28 +0000 Subject: Remove apc calls and useless sleeps. Also remove abuse of ob_flush --- config/snort/snort_download_rules.php | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'config/snort') diff --git a/config/snort/snort_download_rules.php b/config/snort/snort_download_rules.php index bb9b9950..6c3fb71c 100644 --- a/config/snort/snort_download_rules.php +++ b/config/snort/snort_download_rules.php @@ -137,9 +137,6 @@ ini_set("memory_limit","150M"); /* mark the time update started */ $config['installedpackages']['snortglobal']['last_md5_download'] = date("Y-M-jS-h:i-A"); -/* send current buffer */ -ob_flush(); - /* hide progress bar */ hide_progress_bar_status(); @@ -150,24 +147,17 @@ ob_flush(); if (is_dir("{$tmpfname}")) { update_status(gettext("Removing old tmp files...")); exec("/bin/rm -r {$tmpfname}"); - apc_clear_cache(); } /* Make shure snortdir exits */ -exec("/bin/mkdir -p {$snortdir}"); exec("/bin/mkdir -p {$snortdir}/rules"); exec("/bin/mkdir -p {$snortdir}/signatures"); exec("/bin/mkdir -p {$tmpfname}"); exec("/bin/mkdir -p /usr/local/lib/snort/dynamicrules/"); -/* send current buffer */ -ob_flush(); - /* unhide progress bar and lets end this party */ unhide_progress_bar_status(); -$pfsensedownload = 'on'; - /* download md5 sig from snort.org */ if ($snortdownload == 'on') { @@ -318,7 +308,8 @@ if ($snortdownload == 'on') update_output_window(gettext("Snort rules file downloaded failed...")); $snortdownload = 'off'; - } + } else + log_error("Snort rules file update downloaded succsesfully"); } } } @@ -336,6 +327,7 @@ if ($emergingthreats == "on") update_output_window(gettext("May take 4 to 10 min...")); download_file_with_progress_bar('http://rules.emergingthreats.net/open/snort-2.9.0/emerging.rules.tar.gz', "{$tmpfname}/{$emergingthreats_filename}"); update_status(gettext('Done downloading Emergingthreats rules file.')); + log_error("Emergingthreats rules file update downloaded succsesfully"); } } } @@ -351,6 +343,7 @@ if ($pfsensedownload == 'on' && $pfsense_md5_check_ok != 'on') { download_file_with_progress_bar("http://www.pfsense.com/packages/config/snort/pfsense_rules/pfsense_rules.tar.gz", $tmpfname . "/{$pfsense_rules_filename}"); update_all_status($static_output); update_status(gettext("Done downloading rules file.")); + log_error("pfSense rules file update downloaded succsesfully"); } } @@ -399,10 +392,8 @@ if ($snortdownload == 'on') update_output_window(gettext("May take a while...")); /* extract snort.org rules and add prefix to all snort.org files*/ exec("/bin/rm -r {$snortdir}/rules"); - sleep(2); exec("/usr/bin/tar xzf {$tmpfname}/{$snort_filename} -C {$snortdir} rules/"); chdir ("/usr/local/etc/snort/rules"); - sleep(2); exec('/usr/local/bin/perl /usr/local/bin/snort_rename.pl s/^/snort_/ *.rules'); /* extract so rules */ @@ -572,7 +563,6 @@ if ($snortdownload == 'on') /* double make shure cleanup emerg rules that dont belong */ if (file_exists("/usr/local/etc/snort/rules/emerging-botcc-BLOCK.rules")) { - apc_clear_cache(); @unlink("/usr/local/etc/snort/rules/emerging-botcc-BLOCK.rules"); @unlink("/usr/local/etc/snort/rules/emerging-botcc.rules"); @unlink("/usr/local/etc/snort/rules/emerging-compromised-BLOCK.rules"); @@ -718,7 +708,6 @@ $config['installedpackages']['snortglobal']['last_rules_install'] = date("Y-M-jS if (is_dir('/usr/local/etc/snort/tmp')) { update_status(gettext("Cleaning up...")); exec("/bin/rm -r /usr/local/etc/snort/tmp/snort_rules_up"); - sleep(2); exec("/bin/rm -r /usr/local/etc/snort/tmp/rules_bk"); } @@ -737,9 +726,10 @@ else if ($snort_md5_check_ok == 'on' && $emerg_md5_check_ok == 'on' && $pfsense_ else { /* You are Not Up to date, always stop snort when updating rules for low end machines */; update_status(gettext("You are NOT up to date...")); - exec("/bin/sh /usr/local/etc/rc.d/snort.sh start"); + exec("/bin/sh /usr/local/etc/rc.d/snort.sh restart"); update_status(gettext("The Rules update finished...")); update_output_window(gettext("Snort has restarted with your new set of rules...")); + log_error(gettext("Snort has restarted with your new set of rules...")); } update_status(gettext("The Rules update finished...")); -- cgit v1.2.3