Intrusion Detection: Snort, Base, MySQL, and Apache2 On Ubuntu 7.10 (Gutsy Gibbon) (Updated)
|
Submitted by volksman (Contact Author) (Forums) on Mon, 2008-01-14 16:12. :: Debian | Linux | Ubuntu | Monitoring | Security
Intrusion Detection: Snort, Base, MySQL, and Apache2 On Ubuntu 7.10 (Gutsy Gibbon) (Updated)This tutorial is based on another howto written by DevilMan, however I didn't like the idea of manually compiling every package or the use of a GUI to get the software installed. This howto will work on a Gutsy Server or Gutsy desktop. With that said some of this howto is a direct copy from the original. In this tutorial I will describe how to install and configure Snort (an intrusion detection system (IDS)) from source, BASE (Basic Analysis and Security Engine), MySQL, and Apache2 on Ubuntu 7.10 (Gutsy Gibbon). Snort will assist you in monitoring your network and alert you about possible threats. Snort will output its log files to a MySQL database which BASE will use to display a graphical interface in a web browser.
1. Gain root privilegesIt is easiest to do this install as root user. sudo su -
2. Install some packagesThe following will install all the required packages to make this setup work: apt-get install libpcap0.8-dev libmysqlclient15-dev mysql-client-5.0 mysql-server-5.0 bison flex apache2 libapache2-mod-php5 php5-gd php5-mysql libphp-adodb php-pear libc6-dev g++ gcc pcregrep libpcre3-dev
3. Get and compile snortThe Snort package in the Gutsy repo's are out of date. So I prefered to download the most current and install that. This is the only thing we will compile from scratch. The latest version of snort at the time of writing is 2.8.0.1 First let's go to a working directory: cd /usr/src/ Open a web browser and navigate to http://www.snort.org/dl right click on the most recent release and copy link location.
a. Download snort and snort ruleswget http://www.snort.org/dl/current/snort-2.8.0.1.tar.gz There are a couple options for rules. The following will download the public rules, however with a quick registration at the snort site you can get more current rules. Your choice but the next command is run the same way with the appropriate URL: wget http://snort.org/pub-bin/downloads.cgi/Download/vrt_pr/snortrules-pr-2.4.tar.gz
b. Unpack and get them ready for compiletar zxvf snort-2.8.0.1.tar.gz
c. Now compile them./configure -enable-dynamicplugin --with-mysql Keep this directory handy as you can simply run make uninstall To uninstall snort later if you choose
d. Move things into positionWe now need to move the rules and config for snort into position mkdir /etc/snort /etc/snort/rules /var/log/snort
4. Configure SnortWe need to modify the snort.conf file to suite our needs. Open /etc/snort/snort.conf with your favorite text editor (nano, vi, vim, etc.). # vi /etc/snort/snort.conf Change "var HOME_NET any" to "var HOME_NET 192.168.1.0/24" (your home network may differ from 192.168.1.0) Scroll down the list to the section with "# output database: log, mysql, user=", remove the "#" from in front of this line. Change permissions on the conf file to keep things secure (thanks rojo): # chmod 600 /etc/snort/snort.conf 5. Setup the Mysql database.Log into the mysql server. # mysql -u root -p Create the snort database. Make sure you change the 'snort_password' to something else! mysql> create database snort; We will use the snort schema for the layout of the database. # mysql -D snort -u snort -p < /usr/src/snort-2.8.0.1/schemas/create_mysql NOTE: Use your snort DB user password when prompted.
6. Time to test SnortIn the terminal type: # snort -c /etc/snort/snort.conf If everything went well you should see an ascii pig. To end the test hit ctrl + c. NOTE: If you get errors you may want to try commenting out lines 97,98 and 452 of /etc/snort/rules/web-misc.rules. This was an issue in the past but doesn't seem to be anymore.
7. Get and install BASEOpen a web browser and go to http://sourceforge.net/project/showfiles.php?group_id=103348. Click on download then right click on the newest tar.gz package and select copy link (at the time of writing this is base-1.3.9). In the terminal type: cd Now go to your web document root (by default this is /var/www), unpack the tarball and set the permissions needed to configure BASE: cd /var/www/ We want to make sure that a couple of Pear modules are activated: pear install Image_Color
8. Set up BASEOpen a web browser and navigate to http://YOUR.IP.ADDRESS/base-1.3.9/setup. Click continue on the first page.
Bookmark this page. Change the permissions back on the /var/www/base-1.3.9 folder. # chmod 755 /var/www/base-1.3.9
We are done. Congrats!!!To start Snort in the terminal type (make sure you change eth0 to the right interface for your machine: # snort -c /etc/snort/snort.conf -i eth0 -D This starts snort using eth0 interface in a daemon mode. You can add this to your /etc/rc.local file so that it starts after a reboot. To make sure it is running you can check with the following command: # ps aux | grep snort If it's running you will see an entry similar to snort -c /etc/snort/snort.conf -i eth0 -D. If you would like to learn how to write your own Snort rules there is a guide at http://www.snort.org/docs/snort_manual/node16.html.
|



Recent comments
1 day 14 min ago
1 day 5 hours ago
1 day 6 hours ago
1 day 7 hours ago
1 day 9 hours ago
1 day 13 hours ago
1 day 14 hours ago
1 day 16 hours ago
2 days 5 hours ago
2 days 7 hours ago