OS: CentOS 6.2 i386, CentOS x86_64, CentOS 5.7, Ubuntu 10.04 TLS
Snort Version: Version 2.9.2.1 IPv6 GRE (Build 107)
Hardware: Virtual Machine (VirtualBox 4.1.8)
Snort is Network Intrusion Detection System (NIDS). Snort can sniff your network and alert you based on his rule DB if there is an attack on your computers network. It is an opensource system that is build from tcpdump (linux sniffer tool).
This guide can be used for installing snort only or as part of a series for installing Snort Barnyard and BASE or Snort Barnyard and Snorby.
yum update -y reboot
rpm -Uhv http://apt.sw.be/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
rpm -Uhv http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
yum install libdnet libdnet-devel pcre pcre-devel gcc make flex byacc bison kernel-devel libxml2-devel wget -y
mkdir /usr/local/src/snort cd /usr/local/src/snort
wget http://www.tcpdump.org/release/libpcap-1.2.1.tar.gz -O libpcap.tar.gz tar zxvf libpcap.tar.gz cd libpcap-* ./configure && make && make install echo "/usr/local/lib" >> /etc/ld.so.conf ldconfig -v
cd /usr/local/src/snort wget http://www.snort.org/downloads/1525 -O daq.tar.gz tar zxvf daq.tar.gz cd daq-* ./configure && make && make install ldconfig -v
groupadd snort useradd -g snort snort
cd /usr/local/src/snort wget http://www.snort.org/downloads/1538 -O snort.tar.gz tar zxvf snort.tar.gz cd snort-2* ./configure --prefix /usr/local/snort && make && make install
ln -s /usr/local/snort/bin/snort /usr/sbin/snort ln -s /usr/local/snort/etc /etc/snort
cp rpm/snortd /etc/init.d/ chmod +x /etc/init.d/snortd cp rpm/snort.sysconfig /etc/sysconfig/snort chkconfig --add snortd
vi /etc/init.d/snortd
... # check if more than one interface is given if [ `echo $INTERFACE|wc -w` -gt 2 ]; then ... else # Run with a single interface (default) daemon /usr/sbin/snort $ALERTMODE $BINARY_LOG $NO_PACKET_LOG $DUMP_APP -D $PRINT_INTERFACE $INTERFACE -u $USER -g $GROUP $CONF -l $LOGDIR $PASS_FIRST $BPFFILE $BPF fi
vi /etc/sysconfig/snort
... LOGDIR=/var/log/snort/ ... #ALERTMODE=fast ... #BINARY_LOG=1 ...
You have to register to the site in order to get the free register user rules or you can pay and get the most update rules as a "Subscriber user"
cd /usr/local/snort tar zxvf /usr/local/src/snort/snortrules-snapshot-2*
mkdir -p /usr/local/snort/var/log chown snort:snort /usr/local/snort/var/log ln -s /usr/local/snort/var/log /var/log/snort
ln -s /usr/local/snort/lib/snort_dynamicpreprocessor /usr/local/lib/snort_dynamicpreprocessor ln -s /usr/local/snort/lib/snort_dynamicengine /usr/local/lib/snort_dynamicengine ln -s /usr/local/snort/lib/snort_dynamicrules /usr/local/lib/snort_dynamicrules
chown -R snort:snort /usr/local/snort
vi /usr/local/snort/etc/snort.conf
... #preprocessor reputation: \ # memcap 500, \ # priority whitelist, \ # nested_ip inner, \ # whitelist $WHITE_LIST_PATH/white_list.rules, \ # blacklist $BLACK_LIST_PATH/black_list.rules ... output unified2: filename snort.log, limit 128 ...
mkdir /usr/local/snort/lib/snort_dynamicrules
cp /usr/local/snort/so_rules/precompiled/RHEL-6-0/i386/2.9**so /usr/local/snort/lib/snort_dynamicrules/
snort -c /usr/local/snort/etc/snort.conf --dump-dynamic-rules=/usr/local/snort/so_rules
vi /usr/local/snort/etc/snort.conf
... # dynamic library rules include $SO_RULE_PATH/bad-traffic.rules include $SO_RULE_PATH/chat.rules include $SO_RULE_PATH/dos.rules include $SO_RULE_PATH/exploit.rules include $SO_RULE_PATH/icmp.rules include $SO_RULE_PATH/imap.rules include $SO_RULE_PATH/misc.rules include $SO_RULE_PATH/multimedia.rules include $SO_RULE_PATH/netbios.rules include $SO_RULE_PATH/nntp.rules include $SO_RULE_PATH/p2p.rules include $SO_RULE_PATH/smtp.rules include $SO_RULE_PATH/snmp.rules include $SO_RULE_PATH/specific-threats.rules include $SO_RULE_PATH/web-activex.rules include $SO_RULE_PATH/web-client.rules include $SO_RULE_PATH/web-iis.rules include $SO_RULE_PATH/web-misc.rules ...
snort -c /usr/local/snort/etc/snort.conf -T
PulledPork is an opensource perl script that can update your rules files automatically. To install PulledPork please go to this guide Configure Snort automatic rules updating with PulledPork.
Snort installation completed. Now that we have a Snort server writing it’s data in binary format we need to install Barnyard. Barnyard is application that run on Snort binary files and can output the data to MySQL server and then use it with other PHP web application.
Here is a link for Barnyard Installation.
Please visit http://www.snort.org/ for more information about Snort configuration and usage.