LOG_PATH=/var/log/snort
# Date format: Year-month-day.Hour-Minute-Second
DATE=`/bin/date "+%Y%m%d"`
# Where to store the backup Tarball
BACKUP_PATH=/var/log/snort
#Unique Name for backup file
BACKUP_FILE=snort-alerts.$DATE
#Location of comon progs
RM=/bin/rm
#TAR=/bin/tar
MV=/bin/mv
LS=/bin/ls
GREP=/bin/grep
AWK=/bin/awk
GZIP=/bin/gzip
# main
#**********
# kill snort process
killall snort
#**********
#**********
# archives alert file
# gzip alert file
$GZIP $LOG_PATH/alert
$MV $LOG_PATH/alert.gz $BACKUP_PATH/$BACKUP_FILE.gz
# recreate alert file
touch $LOG_PATH/alert
#**********
#**********
# updates bleeding malware rules
cd /root
# remove existing files
rm bleeding*
# get new files
wget
www.bleedingsnort.com/bleeding-malware.rules
wget
www.bleedingsnort.com/bleeding-virus.rules
wget
www.bleedingsnort.com/bleeding-p2p.rules
wget
www.bleedingsnort.com/bleeding-exploit.rules
# copy rules --update if newere
cp -u -c *.rules /rules/snort/
# fix permissions
chmod +rwx /rules/snort/bleeding*
#**********
#**********
# update all other rules
# remove existing rules temp dir
rm -f rules/* | rmdir rules
# get new rules
wget
http://www.snort.org/dl/rules/snortr...CURRENT.tar.gz
# unzip rules
gzip -d snortrules-snapshot-CURRENT.tar.gz
tar -xf snortrules-snapshot-CURRENT.tar
# copy new rules into production
cp rules/* /rules/snort
#**********
#**********
# restart snort
# restart snort process
/usr/local/bin/snort -N -D -A fast -y -c /etc/snort/snort.conf -i eth1
#**********