Ver 1.7.8 - Last Updated 10/06/2007
This is a quick guide to help you setup a functional SnortSMS IDS network.
It will be assumed you have at least two unix-based systems available to fuction as the SnortSMS Collector and the SnortSMS IDS Sensor
(although these could be technically the same single system).
Here's what should be on each system:
SnortSMS Collector
SnortSMS IDS Sensor
Notes:
As you can see the SnortSMS network is collection of various technologies working together. Although you could replace some of these technologies with other variants, the overall concept remains. The custom piece that "glues" it all together is the SnortSMS Collector Website and the SnortSMS Web Portal Agent PHP scripts.
The SnortSMS IDS Sensor has an Agent which uses a web portal listener to receive and send information to and from the SnortSMS Collector. The Agent scripts are written in PHP and thus require some type of web server on the sensor itself to listen for incoming requests from the Collector. You could choose to use Apache web server, but we have opted to use 'lighttpd' as it has a very small footprint (just under 1MB) and can support HTTP authentication, php-cgi, and SSL.
Barnyard is an optional tool which allows Snort alerts to be propagated to a central database in the background. Although Snort has the functionality to write to the event database directly, we recommend Barnyard as it is more reliable and frees Snort of latency and fail-over issues which could result in dropped events.
A quick note about reducing overall file space on the sensor system. The sensor system shouldn't need Perl. Depending on which Unix OS you are running, you might want to consider removing or not installing Perl as it can easily consume 50+MB of harddrive space. This is completely optional, but worth mentioning if you are interested in reducing your sensor's overall OS footprint. Also, if you plan to use custom Perl scripts on the sensor, consider rewriting them in PHP as PHP only takes up about 7MB and shares much of the same fundamental capabilities.
Prerequisites
It will be assumed you have an available server established with all the software installed and configured as stated in the above SnortSMS IDS Sensor "System Requirements" - (also Barnyard and MySQL Client libraries if you desire to propagate Snort Events to a remote central database).
The sensor system requires a Web portal listener for the Agent scripts.
This will partly cover setting up the web server listener and the agent scripts. Snort, PHP and other requirements should have been already configured by this time.
Configuring lighttpd
LigHTTPd requires a single config file we will call 'lighttpd.conf'. A sample file is provided with SnortSMS Collector distribution under the 'Agent' sub-directory. The important settings you will need to note are the web-root path, the listening port, and if your are choosing SSL (HTTPS) mode or not. Refer to the lighttpd documentation for how to configure and start the server.
It's also important to run lighttpd web daemon as 'root' user since root priviledge are required to start/stop daemons on the sensor. This is done by not specifying and user/group in the config file.
The agent should be protected by http basic authentication. Our sample lighttpd.conf file already has this enable, however you will need to create the user/password file. It is simply a plain text file with userid and password seperated by a colon.
sensor:mypassword
Installing the SnortSMS Agent
The SnortSMS Agent is designed to reside on the remote Snort sensor. This Agent allows the SnortSMS Collector server to communicate and remotely control the sensor. The Agent is simply a PHP script called 'agent.php' (a copy can now be found included in the SnortSMS Collector distribution under the 'Agent' sub-directory). Simply copy this PHP script to your sensor's web-root directory as defined in your lighttpd config file.
Testing the SnortSMS Agent
It is possible to test the Agent directly via a web browser. Point your web browser to:
http://<userid>:<password>@<sensorip>:<port>/agent.php?ac=test
Be sure to use the correct protocol (http/https), the correct login/password, sensor IP, and port.
For example:
UserID = snortsms
Passwd = crazy
IP = 192.168.1.50
Port = 10000
https://snortsms:crazy@192.168.1.50:10000/agent.php?ac=test
Prerequisites
We assume you have an available server established with all the software installed and configured as stated in the above SnortSMS Collector "System Requirements".
Insure Apache is properly configured and you have configure a web-root location.
Installing the SnortSMS Collector Website
# chown :www conf/ conf/conf.php # chmod 775 conf/ # chmod 664 conf/conf.php
short_open_tag = On magic_quotes_gpc = Off magic_quotes_runtime = Off max_execution_time = 120 max_input_time = 120 memory_limit = 100M post_max_size = 20M upload_max_filesize = 20M include_path = ".:/usr/local/share/pear"
# mkdir /var/tmp/snortsms # chmod 1777 /var/tmp/snortsms
Creating the SnortSMS Database
# mysql -u root -p < {snortsms_source}/schema/SNORTSMS.mysql
Creating the Snort Alert Database (optional)
If you would like a central database where all Snort sensors can send the Alert events to, you can create a Snort database on the SnortSMS collector or an alternate server.
# mysql -u root -p < {snort-x.x.x}/schemas/create_mysql
Modify the Snort Event Database
Note: If you plan to use the SnortSMS Alert Browser to view incoming alerts, you will need to modify Snort's default database.
mysql> use {your snort db name}; mysql> alter table event add column viewed tinyint (1);Or execute the script we've supplied with SnortSMS:
# mysql -d {SnortDB} -u root -p < {snortsms_source}/schema/SNORT_DB_mod.mysql
Prerequisites
At this juncture, you should have a SnortSMS Collector and at least one SnortSMS sensor established and functional. We will now walk you through a few steps required to get SnortSMS configured and start managing your Snort sensor(s).
Configure SnortSMS global settings
Create a Snort Daemon Profile
You MUST create at least one Snort Daemon Profile.
This is used to tell SnortSMS how to launch the snort process on the remote sensor.
Populating the libraries
Before you can assign configurations to your sensors, you must first populate the SnortSMS configuration libraries.
The easiest way to fill up the libraries is to import the various Snort snapshot tarball files.
The Snort source code tarball contains much of the default varaibles and config directives.
There are also many VRT and Community rules now available in seperate files.
So start by importing the Snort source tarball (i.e. Snort-x.x.x.tar.gz). Don't worry, SnortSMS will only find what it needs.
Next, import any of the Rule distribution tarballs (i.e. Community-Rules-x.x.tar.gz).
You can either download it to your local desktop or import it from the web.
This will parse the tarball file, detecting any and all rules and directives, thus populating the SnortSMS libraries accordingly. Once this is done, you should be able to browse the libraries and verify the imported resources.
Create a Rule Profile
Now that your resource libraries are full, we suggest you 1st create at least one rule profile.
You cannot assign rules directly to sensors, only rule profiles can be assigned to each sensor.
Adding Sensors
Now you are ready to start adding sensor profiles into the SnortSMS console.
Testing
At this point, SnortSMS should be properly configured. We also assume you have at least one functional Snort-base sensor defined.
From the Administration Console, click anywhere on your sensor line.
You should be able to get statistical data from the 'Status' tab.
There is also a "Test Configuration" under the Settings menu. This is very helpful in determining common issues.
Issue: | I get the error: "Warning: require_once(DB.php) [function.require-once]: failed to open stream: No such file or directory in /www/snortsms/FMK_Hooks.php" |
Resolution: |
|
Issue: | I get an error while trying to save the Global Settings. |
Resolution: |
|
Issue: | SnortSMS Collector cannot connect to the remote sensor agent. |
Resolution: |
|
Issue: | I get a database connection error. |
Resolution: |
|
Issue: | I get an error "Missing DB.php". |
Resolution: |
|
Issue: | Importing Snort snapshot file failed. |
Resolution: |
|
Issue: | Snort Fails to start via SnortSMS. |
Resolution: |
|
Issue: | Barnyard Fails to start via SnortSMS. |
Resolution: |
|