Sunday, November 2, 2008

snort / barnyard restart script


snortpid=`cat /var/run/snort_sis0.pid`
barnyardpid=`cat /var/run/by.pid`

if [ -e /var/run/snort_sis0.pid ]; then
color red
echo 'killing snort'
kill `cat /var/run/snort_sis0.pid`
color off
fi

if [ -e /var/run/by.pid ]; then
color red
echo 'killing barnyard'
kill `cat /var/run/by.pid`
color off
fi

if [ -x /usr/local/bin/snort ]; then
color cyan
echo 'starting snort'
/usr/local/bin/snort \
-i sis0 \
-c /etc/snort/snort.conf \
-u snort \
-g snort \
-d \
-D
color off
fi

if [ -x /usr/local/bin/barnyard ]; then
color cyan
echo 'starting barnyard'
/usr/local/bin/barnyard \
-c /etc/snort/barnyard.conf \
-p /etc/snort/classification.config \
-s /etc/snort/sid-msg.map \
-g /etc/snort/gen-msg.map \
-w /etc/snort/barnyard.waldo \
-d /var/log/snort -f snort.log \
> /dev/null 2>&1
color off
sleep 3
fi

if [ -e /var/run/snort_sis0.pid ]; then
color yellow
echo "snort running and pid is $snortpid"
color off
fi

if [ -e /var/run/by.pid ]; then
color yellow
echo "barnyard running and pid is $barnyardpid"
color off
fi

 

No comments: