From b5f159e7b89a43ec54b3166e9dff6a794712e253 Mon Sep 17 00:00:00 2001 From: robiscool Date: Tue, 2 Jun 2009 06:31:20 -0700 Subject: cron change in snort.inc. fixed snort_download_rules.php added time stamps, last update time. keeping an eye on Snort.org for changes. --- config/snort/snort.inc | 16 +++++----- config/snort/snort_download_rules.php | 60 +++++++++++++++++++++++++++-------- 2 files changed, 54 insertions(+), 22 deletions(-) (limited to 'config') diff --git a/config/snort/snort.inc b/config/snort/snort.inc index 1b8d5571..7789d863 100755 --- a/config/snort/snort.inc +++ b/config/snort/snort.inc @@ -186,10 +186,10 @@ function create_snort_conf() { } function snort_deinstall() { - $text_ww = "*/60\t* \t 1\t *\t *\t root\t /usr/bin/nice -n20 /usr/local/pkg/snort_check_for_rule_updates.php"; - $filenamea = "/etc/crontab"; +// $text_ww = "*/60\t* \t 1\t *\t *\t root\t /usr/bin/nice -n20 /usr/local/pkg/snort_check_for_rule_updates.php"; +// $filenamea = "/etc/crontab"; /* remove auto rules update helper */ - remove_text_from_file($filenamea, $text_ww); +// remove_text_from_file($filenamea, $text_ww); /* remove custom sysctl */ remove_text_from_file("/etc/sysctl.conf", "sysctl net.bpf.bufsize=20480"); /* decrease bpf buffers back to 4096, from 20480 */ @@ -216,11 +216,11 @@ function generate_snort_conf() { $snort_config_pass_thru = $config['installedpackages']['snortadvanced']['config'][0]['configpassthru']; /* add auto update scripts to /etc/crontab */ - $text_ww = "*/60\t* \t 1\t *\t *\t root\t /usr/bin/nice -n20 /usr/local/pkg/snort_check_for_rule_updates.php"; - $filenamea = "/etc/crontab"; - remove_text_from_file($filenamea, $text_ww); - add_text_to_file($filenamea, $text_ww); - exec("killall -HUP cron"); +// $text_ww = "*/60\t* \t 1\t *\t *\t root\t /usr/bin/nice -n20 /usr/local/pkg/snort_check_for_rule_updates.php"; +// $filenamea = "/etc/crontab"; +// remove_text_from_file($filenamea, $text_ww); +// add_text_to_file($filenamea, $text_ww); +// exec("killall -HUP cron"); */ /* should we install a automatic update crontab entry? */ $automaticrulesupdate = $config['installedpackages']['snort']['config'][0]['automaticrulesupdate']; diff --git a/config/snort/snort_download_rules.php b/config/snort/snort_download_rules.php index 8d795934..668aee45 100644 --- a/config/snort/snort_download_rules.php +++ b/config/snort/snort_download_rules.php @@ -47,6 +47,7 @@ include("/usr/local/www/head.inc"); + -
@@ -91,11 +91,11 @@ if(!$pgtitle_output)
- - @@ -106,10 +106,11 @@ if(!$pgtitle_output) - + You last checked for updates: {$last_md5_download}

\n"; + echo "\n\n\n\n"; + exit(0); } /* Check if were up to date */ @@ -176,8 +198,15 @@ $md5_check_new_parse = file_get_contents("{$tmpfname}/{$snort_filename_md5}"); $md5_check_new = `/bin/echo "{$md5_check_new_parse}" | /usr/bin/awk '{ print $4 }'`; $md5_check_old_parse = file_get_contents("{$snortdir}/{$snort_filename_md5}"); $md5_check_old = `/bin/echo "{$md5_check_old_parse}" | /usr/bin/awk '{ print $4 }'`; +/* Write out time of last sucsessful md5 to cache */ +$config['installedpackages']['snort']['last_md5_download'] = date("Y-M-jS-h:i-A"); +write_config(); if ($md5_check_new == $md5_check_old) - echo "You are Up to date!\n\n\n\n", update_status(gettext("Your rules are up to date...")), update_output_window(gettext("You may start Snort now.")), hide_progress_bar_status(), exit(0); + update_status(gettext("Your rules are up to date...")); + update_output_window(gettext("You may start Snort now.")); + hide_progress_bar_status(); + echo "\n\n\n\n"; + exit(0); } /* echo "You are Not Up to date!\n"; */ @@ -189,7 +218,7 @@ if (file_exists("{$tmpfname}/{$snort_filename}")) { update_status(gettext("Snortrule tar file exists...")); } else { /* echo "downloading rules\n"; */ - update_status(gettext("Downloading rules...")); + update_status(gettext("There is a new set of Snort rules posted. Downloading...")); update_output_window(gettext("May take 4 to 10 min...")); update_output_window("{$snort_filename}"); @@ -301,3 +330,6 @@ function read_body_firmware($ch, $string) { } ?> + + + -- cgit v1.2.3