From 557b481600002561242fd8bca999905b391001e5 Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Wed, 17 Sep 2014 21:09:47 -0400 Subject: Remove no longer needed code for generating shell script. --- config/snort/snort.inc | 201 ------------------------------------ config/snort/snort_post_install.php | 14 ++- 2 files changed, 6 insertions(+), 209 deletions(-) (limited to 'config') diff --git a/config/snort/snort.inc b/config/snort/snort.inc index e9feec1a..53ae4a9d 100755 --- a/config/snort/snort.inc +++ b/config/snort/snort.inc @@ -1109,9 +1109,6 @@ function sync_snort_package_config() { if ($is_dirty) write_config("Snort pkg: updated snort service entry configuration."); - /* create snort bootup file snort.sh only create once */ -// snort_create_rc(); - $snortglob = $config['installedpackages']['snortglobal']; snort_snortloglimit_install_cron(true); @@ -2833,204 +2830,6 @@ function snort_modify_sids(&$rule_map, $snortcfg) { unset($enablesid, $disablesid); } -function snort_create_rc() { - -/*********************************************************/ -/* This function builds the /usr/local/etc/rc.d/snort.sh */ -/* shell script for starting and stopping Snort. The */ -/* script is rebuilt on each package sync operation and */ -/* after any changes to snort.conf saved in the GUI. */ -/*********************************************************/ - - global $config, $g, $pfs_version; - - $snortdir = SNORTDIR; - $snortlogdir = SNORTLOGDIR; - $rcdir = RCFILEPREFIX; - - // If no interfaces are configured for Snort, exit - if (!is_array($config['installedpackages']['snortglobal']['rule'])) - return; - $snortconf = $config['installedpackages']['snortglobal']['rule']; - if (empty($snortconf)) - return; - - // At least one interface is configured, so OK - $start_snort_iface_start = array(); - $start_snort_iface_stop = array(); - - // If not using PBI package, then make sure Barnyard2 can - // find the latest MySQL shared libs in /usr/local/lib/mysql - if ($pfs_version < 2.1) { - $sql_lib_path = "\n# Ensure MySQL shared libs are in ldconfig search path\n"; - $sql_lib_path .= "/sbin/ldconfig -m /usr/local/lib/mysql"; - $start_snort_iface_start[] = $sql_lib_path; - } - - // Loop thru each configured interface and build - // the shell script. - foreach ($snortconf as $value) { - // Skip disabled Snort interfaces - if ($value['enable'] <> 'on') - continue; - $snort_uuid = $value['uuid']; - $if_real = get_real_interface($value['interface']); - - $start_barnyard = <</dev/null; do - sleep 1 - time=\$((time+1)) - if [ \$time -gt \$timeout ]; then - break - fi - done - if [ -f /var/run/barnyard2_{$if_real}{$snort_uuid}.pid ]; then - /bin/rm /var/run/barnyard2_{$if_real}{$snort_uuid}.pid - fi - else - pid=`/bin/pgrep -fn "barnyard2 -r {$snort_uuid} "` - if [ ! -z \$pid ]; then - /bin/pkill -f "barnyard2 -r {$snort_uuid} " - time=0 timeout=30 - while kill -0 \$pid 2>/dev/null; do - sleep 1 - time=\$((time+1)) - if [ \$time -gt \$timeout ]; then - break - fi - done - fi - fi - -EOE; - if ($value['barnyard_enable'] == 'on') - $start_barnyard2 = $start_barnyard; - else - $start_barnyard2 = $stop_barnyard2; - - $start_snort_iface_start[] = <</dev/null; do - sleep 1 - time=\$((time+1)) - if [ \$time -gt \$timeout ]; then - break - fi - done - if [ -f /var/run/snort_{$if_real}{$snort_uuid}.pid ]; then - /bin/rm /var/run/snort_{$if_real}{$snort_uuid}.pid - fi - else - pid=`/bin/pgrep -fn "snort -R {$snort_uuid} "` - if [ ! -z \$pid ]; then - /usr/bin/logger -p daemon.info -i -t SnortStartup "Snort STOP for {$value['descr']}({$snort_uuid}_{$if_real})..." - /bin/pkill -fn "snort -R {$snort_uuid} " - time=0 timeout=30 - while kill -0 \$pid 2>/dev/null; do - sleep 1 - time=\$((time+1)) - if [ \$time -gt \$timeout ]; then - break - fi - done - fi - fi - - sleep 2 - {$stop_barnyard2} - -EOE; - } - - $rc_start = implode("\n", $start_snort_iface_start); - $rc_stop = implode("\n", $start_snort_iface_stop); - - $snort_sh_text = <<