Before we can download the latest Snort source code and compile it, we have a new prerequisite to fulfill before we can compile Snort. You'll need to install Luajit, which is used to define application detectors with the new OpenAppID.
On my Ubuntu system this was as easy as the following command.
sudo apt-get install libluajit-5.1-2 libluajit-5.1-common libluajit-5.1-dev luajit
Now we’re all set to download and install the alpha version of Snort. At the time this was written that was 18.104.22.168 alpha (snort-22.214.171.124_alpha.tar.gz). Grab the latest source from snort.org’s Download Snort page. Then we can extract and build.
tar zxvf snort-126.96.36.199_alpha.tar.gz
./configure --prefix=/usr/local/snort --enable-sourcefire --enable-open-appid
sudo make install
Note the new flag on the configure command. We are adding that switch to enable OpenAppID.
Application Detector Package
The next step is to download the Application Detector Package. This entirely new content contains what is at the heart of the OpenAppID feature. You can download it from the Download Snort page on snort.org (currently: snort-openappid-detectors.2014-02-22.187-0.tgz).
This package contains the Lua libraries for detecting applications, as well as the application detectors themselves.
sudo tar -xzf snort-openappid-detectors.2014-02-22.187-0.tgz -C /usr/local/snort
Once that is unpacked you will see your Snort directory now has an odp directory. Here you will see the appMapping.data file, which includes metadata about the application detectors. A simple way to explore what application detectors are included in this first release is to examine the second column of this file. If you’d like to see the list, try the following command.
cat appMapping.data | cut -f2
For example, if you would like to see what micro-applications that can be identified within Facebook, search for that data.
cat appMapping.data | cut -f2 | grep Facebook
Facebook Read Email
Facebook Send Email
Facebook Status Update
Facebook video chat
You will also see the libs subdirectory, which contains the Lua libraries needed to run application detection. The port and lua subdirectories contain the applications detectors themselves. The port detectors are simple YAML files to patch port and application. The lua directory contains the bulk of the detectors. These lua scripts perform far more powerful detection.
There are several changes to make in our snort.conf file. We must add the preprocessor command for OpenAppID and configure the output command.
Configure OpenAppID Preprocessor
Our next step is to add the configuration for the OpenAppID preprocessor to the snort.conf file. Find the lines for the reputation preprocessor. This should be followed by commented text for “Step 6.” Just after the reputation preprocessor and before Step 6 we will add another preprocessor setting.
preprocessor appid: app_stats_filename appstats-u2.log, \
app_stats_period 60, \
This will turn on the OpenAppID preprocessor. The first step simply names the configuration file to which application statistics will be logged. The second gives the time period used to sample this data. Finally, you must point out the directory which contains the odp directory we extracted from the Open App ID Detector package.
The final step in configuring our snort.conf file will be to change the output command. Everyone should be using the Unified2 output module already, but there is a new command to add new the new event field for the application in use.
Look into Step 6 find the lines explaining the unified2 output type. In that section add the following line.
output unified2: filename snort.log, limit 128, appid_event_types
Now let’s fire up Snort.
/usr/local/snort/bin/snort -c /usr/local/snort/etc/snort.conf -i eth#
Where eth# is which ever interface you will be monitoring with (e.g. eth0).
If there aren't any errors you will see the final line output by Snort indicating a successful startup, as “
Commencing packet processing.” If you examine the output above that you will see a new section for AppID Configuration. This will include the configuration given to the preprocessor for reference.
To test the new deployment, fire up a web browser to test out application detection. For my test I used Chrome to visit cnn.com.
If you are still examining the console output of the Snort process you will see something to the effect of “
Opening /var/log/snort/appstats-u2.log.1393807981 for output.” Ending the Snort process will also write what data has not yet been output.
Examining Application Statistics
When you downloaded the Snort package, it included a tools subdirectory. In here you will find a couple of programs for changing the unified2 binary format to readable text. In this case we will use the u2openappid program to print the application statistics that Snort is collecting for us.
From this you can see a number of entries. In this case the above were generated from my visit to cnn.com. You can see that they share the same statTime. OpenAppID identifies the client application (Chrome), DNS request, protocol (http), and web app (cnn.com). The rest of the entries are other web apps embedded within CNN’s web page.
To further illustrate the data we can get form OpenAppID, here is the output from when I instead use Firefox to visit Netflix.
Happy Snorting! Check out the new stuff. There are a few new features to explore here.