From 5a1c422d6b7d59242a1c4db7bba1827d7f8601e9 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Mon, 25 Sep 2006 04:39:23 +0000 Subject: Generate snort.conf and write it out --- packages/snort/snort.inc | 219 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 218 insertions(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/snort/snort.inc b/packages/snort/snort.inc index 1debde6a..22227345 100644 --- a/packages/snort/snort.inc +++ b/packages/snort/snort.inc @@ -1,7 +1,9 @@ "LAN"); @@ -31,8 +33,223 @@ function sync_package_snort() { "stop" => "/usr/bin/killall snort; killall snort2c" ) ); - exec("cp /usr/local/etc/snort/snort.conf-sample /usr/local/etc/snort.conf"); + /* write out snort.conf */ + $snort_conf = generate_snort_conf(); + $conf = fopen("/usr/local/etc/snort/snort.conf","w"); + if(!$conf) { + log_error("Could not open /usr/local/etc/snort/snort.conf for writing."); + exit; + } + fwrite($conf, $snort_conf); + fclose($conf); start_service("snort"); } +function generate_snort_conf() { + global $config, $g; + + $ssh_port = ""; + $home_net = ""; + + /* XXX: generate rule section */ + $selected_rules_sections = ""; + + $snort_conf = << \ No newline at end of file -- cgit v1.2.3