Snort: Planning IDS for Your Enterprise
Snort is often referred to as a lightweight intrusion detection system. Snort is labeled lightweight because it is designed primarily for small network segments. Snort is very flexible due to its rule-based architecture. The designers of Snort have made it very easy to insert and expand upon rules as new security threats are detected. This article will detail the Snort installation, architecture, rules and how to run it.
Snort was written by Martin Roesch and can be downloaded from www.Snort.org by selecting the Downloads link on the left panel. As of this writing, the latest version of Snort is 1.7. The Snort web site will provide you with the ability to download binaries for some of the common platforms as well as source code. But before you download and try to install/compile Snort, you will need libpcap version 0.5 or higher. The latest version of libpcap is 0.6.2. It allows for system-independent packet capture and analysis. Libpcap is available on some BSD platforms. You may download the latest version of libpcap from www.tcpdump.org.
Installation of Snort is fairly straightforward. As with installing any typical UNIX tools, it involves running ./configure followed by make. I always like to view the configure options. Typing ./configure -help will display the available options. Typing make install will install all of the Snort files. However, you are still not ready to run Snort. Prior to running Snort you will have to build its rules file. But before we go on to write the rules file, let's review the Snort architecture.
The Snort architecture consists of three principal components. A simplified representation of these components is shown in Figure 1. They are described below:
Packet Decoder: the Snort packet decoder supports the Ethernet, SLIP and PPP mediums. The packet decoder performs all the work to prepare the data in an expedient manner for the detection engine.
Detection Engine: the detection engine is at the heart of Snort. It essentially is responsible for analyzing every packet based on the Snort rules that are loaded at runtime. The detection engine separates the Snort rules into what is referred to as a chain header and chain options. The common attributes such as source/destination IP address and ports identify the chain header. The chain options are defined by details such as the TCP flags, ICMP code types, specific type of content, payload size, etc. The detection engine recursively analyzes each and every packet based on the rules defined in the Snort rules file. The first rule that matches the decoded packet triggers the action specified in the rule definition. A packet that does not match any Snort rule set is simply discarded. Key components of the detection engine are the plugin modules such as the portscan module. Plugin modules enhance the functionality of Snort by adding to the analysis capability.
Logger/Alerter: logging and alerting are two separate subcomponents. Logging allows you to log the information collected by the packet decoder in human readable or tcpdump format. You can configure alerts to be sent to syslog, flat file, UNIX sockets or a database. Optionally, you may turn off alerting completely during testing or penetration studies. By default, all logs are written in the /var/log/Snort folder, and all of the alerts are written to the /var/log/Snort/alerts file.
The Snort rules file is an ASCII file that can be created using your favorite editor. The contents of the rules file consist of the following sections:
Variable Definitions: these define variables that may be reused in creating Snort rules.
Snort Rules: these are the actual rules that enables intrusion detection. These should be consistent with the overall Intrusion Detection policy. Snort rules are defined later in this section.
Preprocessor: these are synonymous with plugins and are instrumental in extending the capability of Snort. For example, the portscan module allows Snort to detect port scans.
Include Files: these allow you to include other Snort rules files.
Output Modules: these allow the Snort administer to specify the output for logging and alerting. The output modules are run when the alert or logging subsystems of Snort are called.
Snort rules consist of two logical parts: the rule header and options. Snort rules must be specified on a single line. Additionally, Snort rules must contain IP addresses, as a hostname lookup is not performed. Figure 2 shows the Snort rule header and options details.
Readers interested in the details of Snort rules are referred to the “Writing Snort Rules” link on the Snort page. In addition, the Snort distribution provides a RULES.SAMPLE file that is very well documented. This file displays the Snort rules that you can play with to build the Snort rules file for your environment. Before writing Snort rules it is recommended that you document your NIDS policy. This involves identifying the activity that you wish to log, ignore or be alerted of upon detection. A very simple policy is documented below and its corresponding rules file is displayed in Listing 1.
Log on the following activity from any host not belonging to our network: Telnet attempts, FTP traffic, and finger attempts. Alert on the following: portscan attempts activity from any host not belonging to our network to th e /var/log/snort/pscan_alerts file, all PHF requests only and all DNS version queries. Pass (Ignore) on the following: all UDP port access above port 1024, all web browsing traffic originating from our network and all ssh traffic to the NIDS.
Practical Task Scheduling Deployment
One of the best things about the UNIX environment (aside from being stable and efficient) is the vast array of software tools available to help you do your job. Traditionally, a UNIX tool does only one thing, but does that one thing very well. For example, grep is very easy to use and can search vast amounts of data quickly. The find tool can find a particular file or files based on all kinds of criteria. It's pretty easy to string these tools together to build even more powerful tools, such as a tool that finds all of the .log files in the /home directory and searches each one for a particular entry. This erector-set mentality allows UNIX system administrators to seem to always have the right tool for the job.
Cron traditionally has been considered another such a tool for job scheduling, but is it enough? This webinar considers that very question. The first part builds on a previous Geek Guide, Beyond Cron, and briefly describes how to know when it might be time to consider upgrading your job scheduling infrastructure. The second part presents an actual planning and implementation framework.
Join Linux Journal's Mike Diehl and Pat Cameron of Help Systems.
Free to Linux Journal readers.View Now!
|The Firebird Project's Firebird Relational Database||Jul 29, 2016|
|Stunnel Security for Oracle||Jul 28, 2016|
|SUSE LLC's SUSE Manager||Jul 21, 2016|
|My +1 Sword of Productivity||Jul 20, 2016|
|Non-Linux FOSS: Caffeine!||Jul 19, 2016|
|Murat Yener and Onur Dundar's Expert Android Studio (Wrox)||Jul 18, 2016|
- The Firebird Project's Firebird Relational Database
- Stunnel Security for Oracle
- My +1 Sword of Productivity
- SUSE LLC's SUSE Manager
- Non-Linux FOSS: Caffeine!
- Managing Linux Using Puppet
- Murat Yener and Onur Dundar's Expert Android Studio (Wrox)
- Parsing an RSS News Feed with a Bash Script
- Google's SwiftShader Released
- Doing for User Space What We Did for Kernel Space