Updating Snort 2.8.6 and Ubuntu 10.04 Using Automated Scripts
Updating Snort 2.8.6 and Ubuntu 10.04 Using Automated Scripts
Author: David Gullett Published: June 28, 2010 Version: 1.01 Copyright 2010, Symmetrix Technologies http://www.symmetrixtech.com
Table of Contents
A. Introduction 1. Equipment Assumptions 2. Knowledge Assumptions 3. Use of the Backslash 4. End Result B. Procedure 1. Set up Oinkmaster 2. Create the Update Script 3. Create the Cron Job 4. Testing C. A Final Note
A. Introduction
This document is designed to provide you with an easy way to keep your Snort 2.8.6 signatures and Ubuntu Linux 10.04 LTS OS updated. It builds on our previous Snort and Snort Report installation guides available at http://www.symmetrixtech.com.
1. Equipment Assumptions
A computer with Ubuntu 10.04 LTS and Snort 2.8.6 installed as described in our earlier guide is located here: http://www.symmetrixtech.com/articles/004-snortinstallguide286.html
2. Knowledge Assumptions
A working knowledge of Linux including SSH and editing configuration files with vi A basic knowledge of TCP/IP and network topologies
4. End Result
We're going to set up an automated cron job to assign an IP address to the external interface, update Snort and Ubuntu and then remove the IP address to restore the machine to the original configuration. This will help prevent a successful external attack on your IDS/IPS machine. The following diagram illustrates the topology.
Figure 1 Snort Network Topology In the figure above, the network card on the Snort machine facing the traffic you are monitoring has no IP address. This is the card to which we're going to temporarily assign an IP address in order to be able to download the various updates. Again, the address will be removed at the end of the script. The window on this procedure should be reasonably brief depending on the speed of your Internet connection.
B. Procedure
1. Set up Oinkmaster Description
Oinkmaster is the tool provided by Sourcefire to automatically update the Snort signatures.
Getting an Oinkcode
In order to use this service you will need to generate an Oinkcode on http://www.snort.org. Log in to their site from any PC (you should already be registered if you have already set up Snort) and click on the Get Rules button. Scroll down to the bottom of the page and select Use an Oinkcode. The site will generate a lengthy alphanumeric code for you and give you a variety of URLs with which to configure Oinkmaster. Make a note of the URL for the Snort 2.8.6 ruleset for the Registered User Release. This URL incorporates your Oinkcode and will look something similar to this (which we'll be using in a scripting example below):
Installation
Download Oinkmaster 2.0 from this location: http://oinkmaster.sourceforge.net/download.shtml Copy the tarball to your IDS/IPS box. Open a command prompt on your Snort machine via the console or SSH and navigate to the directory where you copied Oinkmaster. Issue the following commands to unpack and install Oinkmaster: tarzxvfoinkmaster2.0.tar.gz cdoinkmaster2.0 sudocpoinkmaster.pl/usr/local/bin/. sudocpoinkmaster.conf/usr/local/etc/. mkdir/usr/local/snort/rules.backup Now let's modify the Oinkmaster configuration file to contain your Oinkcode information. sudovi/usr/local/etc/oinkmaster.conf Add a line towards the beginning of the file beginning with url = and ending with the information you obtained from snort.org in the previous step. It should look something similar to this (except all on one line and no spaces): url=http://www.snort.org/pubbin/oinkmaster.cgi/YOUROINKCODE/ snortrulessnapshot2860.tar.gz Please note that this is a very basic Oinkmaster configuration. You should familiarize yourself with the other options in the oinkmaster.conf file.
4. Testing
To make sure this process is working there are several things you can do after a day or two: 1. Check the dates on the rule files by issuing 'lsl/usr/local/snort/rules' from a shell on the Snort machine. Sourcefire does not necessarily update the registered signatures daily so it may be a while before you see newer file dates. 2. Examine the running processes my issuing the 'psax' command from the shell. You should see a line containing the Snort and barnyard processes. 3. Look at /var/log/syslog. You should see Snort restarting and dumping all of its quite extensive startup messages into that file. 4. Check Snort Report to see if you're getting updated data. The installation procedure for this software was documented in our previous guide located here: http://www.symmetrixtech.com/articles/004snortinstallguide286.html
C. A Final Note
As with any IDS/IPS system, this is not a 'set and forget' machine. An automated script, while very useful, does not ensure that nothing will go wrong occasionally. You need to routinely check on the triggered alerts and also make sure updates are being applied. We also highly recommend signing up for the snort-users mailing list available at http://www.snort.org and following us on Twitter for new guides and updates to Snort Report here: http://twitter.com/symmetrixtech (don't worry, our feed is a low level of traffic). ------Visit us on the web at http://www.symmetrixtech.com for the latest news on Snort Report and to download the latest version. Revision History: 2010-06-28 1.0 - Initial release 2010-06-30 1.01 Revised to reflect the new Snort.org download location