# Download (Notes:
Users behind a Proxy
Server should read this and
users without Internet but have a CDRom read this.)
# Install
libdnet
cd /usr/ports/net/libdnet
make install clean
# Install
libnet
cd /usr/ports/net/libnet10
make install clean
# Install Snort
cd /usr/ports/security/snort
make install PREFIX=/opt/snort
# Manual clean-up
mv /opt/snort/etc/rc.d/snort
/opt/snort/share/examples/snort.sh.example
mv /opt/snort/lib /usr/local/lib
mv /opt/snort/etc/snort/* /opt/snort/etc/
mv /opt/snort/share/doc/snort/* /opt/snort/share/doc
mv /opt/snort/share/examples/snort/* /opt/snort/share/examples
rm -R /opt/snort/share/doc/snort/
rm -R /opt/snort/share/examples/snort/
rm -R /opt/snort/etc/snort
rm -R /opt/snort/etc/rc.d
rm -R /opt/snort/include
rm -R /opt/snort/info
rm -R /opt/snort/libdata
rm -R /opt/snort/libexec
rm -R /opt/snort/man
rm -R /opt/snort/sbin
rm -R /opt/snort/share/aclocal
rm -R /opt/snort/share/dict
rm -R /opt/snort/share/doc/ja
rm -R /opt/snort/share/emacs
rm -R /opt/snort/share/java
rm -R /opt/snort/share/locale
rm -R /opt/snort/share/misc
rm -R /opt/snort/share/nls
rm -R /opt/snort/share/sgml
rm -R /opt/snort/share/skel
rm -R /opt/snort/share/xml
rm -R /opt/snort/www
rm -R /opt/snort/etc/pam.d
rm -R /opt/snort/src
mkdir /opt/snort/etc/rules-backup
# Clean the src directory
make clean
# Create a startup script for
boot-time
vi
/usr/local/etc/rc.d/snort.sh
# Make the startup script executable
chmod +x
/usr/local/etc/rc.d/snort.sh
# Create the snort database
# Create the snort table
/opt/mysql/bin/mysqladmin --user=mysql -p create snort
# Import the snort table structure
/opt/mysql/bin/mysql --user=mysql -p snort <
/opt/snort/share/examples/create_mysql
# Give permission for the snort database user to access the snort
database tables
/opt/mysql/bin/mysql --user=mysql -p mysql
GRANT ALL ON snort.* TO snort@localhost IDENTIFIED BY
'snortpassword';
GRANT ALL ON snort.* TO snort@"%" IDENTIFIED BY 'snortpassword';
flush privileges;
exit
# Edit the snort configuration
file
vi /opt/snort/etc/snort.conf
# Install Oinkmaster
# Change to your source downloads directory
cd /usr/src
# Download Oinkmaster
fetch
http://easynews.dl.sourceforge.net/sourceforge/oinkmaster/oinkmaster-2.0.tar.gz
# Decompress and extract the archive
tar xvf oinkmaster-2.0.tar.gz
# Manually copy files to correct destinations
cp /usr/src/oinkmaster-2.0/oinkmaster.conf /etc/oinkmaster.conf
cp /usr/src/oinkmaster-2.0/contrib/*.pl /opt/snort/bin/
cp /usr/src/oinkmaster-2.0/oinkmaster.1 /usr/local/man/man1/
cp /usr/src/oinkmaster-2.0/oinkmaster.pl /opt/snort/bin/
touch /etc/autodisable.conf
# Configure Oinkmaster
# Edit the oinkmaster.conf file and uncomment and edit the "url"
sources you wish to use
vi /etc/oinkmaster.conf
# You need to setup a
free Snort account to get your Oink Code
url =
http://www.snort.org/pub-bin/oinkmaster.cgi/<YourOinkCodeHere>/snortrules-snapshot-2.4.tar.gz
# and uncomment the Bleeding Snort line as well
url =
http://www.bleedingsnort.com/bleeding.rules.tar.gz
# Test out Oinkmaster to see if it downloads rules
/opt/snort/bin/oinkmaster.pl -o /opt/snort/etc/rules -b
/opt/snort/etc/rules-backup
# Create a script to run Oinkmaster each day and update the snort
rules
vi /etc/periodic/daily/990.oinkmaster
# Set the script executable
chmod +x /etc/periodic/daily/990.oinkmaster
# Note: You may need to setup a proxy server in
your wget configuration if your company uses proxy
vi /usr/local/etc/wgetrc
# Create a snort user and
group and set permissions
# Add a snort group
pw groupadd snort
# Add a snort user
pw useradd snort -n snort -G snort -s /usr/sbin/nologin
# Fix file permissions
chown -R snort:snort /opt/snort/
chown -R snort:snort /var/log/snort/
# After editing
your rules and commenting out specific rules, create an
autodisable.conf:
/usr/opt/snort/bin/makesidex.pl /opt/snort/etc/rules >
/etc/autodisable.conf
# Fix a path
bug from a lame installer
mv /usr/local/lib/lib/snort/
/usr/local/lib/snort
# Test Snort
# Test as user root, should start up and stop without error
/opt/snort/bin/snort -T -c /opt/snort/etc/snort.conf
# Test as user mysql, should start up and stop without error
/opt/snort/bin/snort -T -u snort -g snort -c /opt/snort/etc/snort.conf
# Launch snort and run it for a minute or so
/opt/snort/bin/snort -u snort -g snort -c /opt/snort/etc/snort.conf
#CTRL+C after a minute and you should see statistics on exit
# Run snort manually in the background
/opt/snort/bin/snort -u snort -g snort -c /opt/snort/etc/snort.conf
&
ps wwaux | grep snort
# Reboot and snort should run automatically if
your rc script is functioning
ps wwaux | grep snort