Setting up Snort and Snortreport
Created: 10/11/2004
General Information
Any private network should be running some sort of Intrusion Detection System for system adminstrators to watch for any malicious traffic. In this guide you will learn how to set up snort and one of its reporting utilities, snortreport.Requirements
Installation
Snort
Installation of snort is pretty straight forward.|
# # |
cd /usr/ports/security/snort make install -DWITH_MYSQL |
Snortreport
Snortreport uses php4-gd and jpgraph to display a pretty chart, so if you didn't compile php4 with GD support and don't have jpgraph installed, let's do it now.|
# # # # |
cd /usr/ports/graphics/php4-gd make install distclean cd /usr/ports/graphics/jpgraph make install distclean |
|
# # |
cd /usr/ports/security/snortreport make install distclean |
Configuration
Snort
Snort gets launched from /etc/rc.conf on bootup so we need to add it.| # | echo 'snort_enable="YES"' >> /etc/rc.conf |
|
# # # # |
mysqladmin -u root -p create snort cd /usr/ports/security/snort/work/snort-*/contrib mysql -u root -p -D snort < create_mysql mysql -u root -p -D snort < /usr/local/share/doc/snortreport/create_indexes.sql |
|
# # # # # # # # # # # |
cat << EOF > /usr/ports/security/snort/work/snort-*/contrib/snort_user.sql GRANT USAGE ON * . * TO snort@localhost IDENTIFIED BY "snortpw" WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 ; FLUSH PRIVILEGES; GRANT SELECT, INSERT, UPDATE, DELETE ON snort . * TO snort@localhost; FLUSH PRIVILEGES; EOF mysql -u root -p < /usr/ports/security/snort/work/snort-*/contrib/snort_user.sql cd /usr/ports/security/snort make distclean |
|
# nano -w /usr/local/etc/snort.conf ..output omitted.. # List of DNS servers on your network #var DNS_SERVERS $HOME_NET # List of SMTP servers on your network var SMTP_SERVERS $HOME_NET # List of web servers on your network var HTTP_SERVERS $HOME_NET # List of sql servers on your network var SQL_SERVERS $HOME_NET # List of telnet servers on your network var TELNET_SERVERS $HOME_NET # List of snmp servers on your network var SNMP_SERVERS $HOME_NET ..output omitted.. |
|
output database: log, mysql, user=snort password=snortpw dbname=snort host=localhost |
|
# # |
mkdir /var/log/snort chmod 0744 /var/log/snort |
| # | /usr/local/etc/rc.d/snort.sh start |
Snortreport
First we need to edit the config file for Snortreport for MySQL database access.|
nano -w /usr/local/www/snortreport/srconf.php ..output omitted.. // Put your snort database login credentials in this section $server = "localhost"; $user = "snort"; $pass = "snortpw"; $dbname = "snort"; ..output omitted.. |
|
define("JPGRAPH_PATH", "../../share/jpgraph/"); |
/usr/local/www/snortreport./var/log/snort/alert or have Snortreport parse them for you at http://localhost/snortreport, or wherever you have Snortreport configured on your webserver. To test snort, simply run a port-scan.Author: Jon LaBass
jon at bsdguides dot org