From 5f8323d0ce3a87606952ed1a480baa533728aca6 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Tue, 26 Sep 2006 00:17:23 +0000 Subject: Allow user to specify the performance model for search-method --- packages/snort/snort.inc | 30 ++++++++++++++++++------------ packages/snort/snort.xml | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 12 deletions(-) (limited to 'packages') diff --git a/packages/snort/snort.inc b/packages/snort/snort.inc index ff2451fb..0ec73237 100644 --- a/packages/snort/snort.inc +++ b/packages/snort/snort.inc @@ -27,10 +27,10 @@ POSSIBILITY OF SUCH DAMAGE. */ -$snort_conf = "/usr/local/etc/snort/snort.conf"; +$snort_conf_file = "/usr/local/etc/snort/snort.conf"; function sync_package_snort() { - global $config, $g, $snort_conf; + global $config, $g, $snort_conf_file; exec("/bin/mkdir -p /usr/local/etc/snort"); exec("/bin/mkdir -p /var/log/snort"); exec("/bin/cp /usr/local/etc/snort/unicode.map-sample /usr/local/etc/snort/unicode.map"); @@ -57,7 +57,7 @@ function sync_package_snort() { } } $start = "/bin/mkdir -p /var/log/snort"; - $start .= ";snort -c {$snort_conf} -l /var/log/snort " . $ifaces_final . " -D"; + $start .= ";snort -c {$snort_conf_file} -l /var/log/snort " . $ifaces_final . " -D"; $start .= ";snort2c -s -w /var/db/whitelist -a /var/log/snort/alert"; write_rcfile(array( "file" => "snort.sh", @@ -74,24 +74,30 @@ function sync_package_snort() { } function create_snort_conf() { - global $config, $g, $snort_conf; + global $config, $g, $snort_conf_file; /* write out snort.conf */ - $snort_conf = generate_snort_conf(); - $conf = fopen($snort_conf, "w"); + $snort_conf_text = generate_snort_conf(); + $conf = fopen($snort_conf_file, "w"); if(!$conf) { - log_error("Could not open {$snort_conf} for writing."); + log_error("Could not open {$snort_conf_file} for writing."); exit; } - fwrite($conf, $snort_conf); + fwrite($conf, $snort_conf_text); fclose($conf); } function generate_snort_conf() { - global $config, $g, $snort_conf; + global $config, $g, $snort_conf_file; /* obtain external interface */ /* XXX: make multi wan friendly */ $snort_ext_int = $config['installedpackages']['snort']['config'][0]['interface_array'][0]; + /* set the snort performance model */ + if($config['installedpackages']['snort']['config'][0]['performance']) + $snort_performance = $config['installedpackages']['snort']['config'][0]['performance']; + else + $snort_performance = "lowmem"; + /* open snort2c's whitelist for writing */ $whitelist = fopen("/var/db/whitelist", "w"); if(!$whitelist) { @@ -140,7 +146,7 @@ function generate_snort_conf() { } /* build snort configuration file */ - $snort_conf = << \ No newline at end of file diff --git a/packages/snort/snort.xml b/packages/snort/snort.xml index 667a1abe..2ba391c8 100644 --- a/packages/snort/snort.xml +++ b/packages/snort/snort.xml @@ -59,6 +59,42 @@ 3 interfaces_selection + + Performance + performance + select + + + + + + + + + + + Oinkmaster code oinkmastercode -- cgit v1.2.3