'Configuration'에 해당되는 글 4건

  1. 2008.11.18 Snort Configuration : Linux by CEOinIRVINE
  2. 2008.10.14 [4] Snort Configuration: preprocessing punk packets : preprocessor by CEOinIRVINE
  3. 2008.10.14 [3] Snort Configuration : Refinement by CEOinIRVINE 1
  4. 2008.10.14 Snort Configuration [1] by CEOinIRVINE

Snort Configuration : Linux

Hacking 2008. 11. 18. 09:17

Configuring Snort on a Linux System

The process of installing Snort on a Linux system is very close to the process on a Windows system. The primary difference is that the default (relative) paths in the snort.conf file are much more likely to work without modification on the Linux system. You will need to download the latest version of Snort that is appropriate for your system. If you are using Fedora Core 5, this is as simple as typing yum install snort, or you could download and install the.rpm from snort.org.

Configuring Snort Options

The next step is to configure the various options that determine how Snort will behave using the Snort configuration file. The configuration file is excellently documented and very easy to use. To get Snort working the way you want it to, follow these simple steps.

  1. Start by opening the main Snort configuration file. By default it will be located at /etc/snort/snort.conf.

  2. Configure the HOME_NET variable, if desired, by removing the # from the line you need. # is a commend indicator in the Snort configuration file. The HOME_NET variable defines which networks are the "trusted" internal networks. This is used with the signatures to determine when the internal network is being attacked. By default, HOME_NET is set to any network with the var HOME_NET any line in the snort.conf. Setting this to accurately reflect your internal address space will reduce the number of false positive alerts you receive. A common example would be var HOME_NET 192.168.1.0/ 24 or perhaps var HOME_NET [192.168.1.0/24,192.168.2.0/24].

  3. Configure the EXTERNAL_NET variable if desired. This is the network you expect attacks to come from. The recommendation is to set this to everything except your HOME_NET using the following: var EXTERNAL_NET !$HOME_NET. (Default: var EXTERNAL_ NET any.)

  4. Next, define what servers are running specific services. For example, by setting HTTP_SERVERS to only specific servers, Snort will only watch for HTTP attacks targeted at those servers. If you wish to see attacks targeting servers that are not running the affected services, leave the defaults, which are to watch for attacks directed towards any internal servers. (Default: var DNS_SERVERS $HOME_NET) If you had a Web server running on 192.168.1.11 and 192.168.1.12, you could tell Snort to only look for HTTP attacks targeting that server by setting the following variable: var HTTP_SERVERS [192.168.1.11/32,192.168.1.12/32].

  5. If desired, configure the specific ports that services are available on. For example, the default for HTTP is defined on the following line: var HTTP_PORTS 80. Similar to defining the servers in the preceding section, this will tell Snort to only look for attacks targeting specific ports. With the default configuration, Snort would ignore an HTTP attack to port 8080. Again, this setting will help focus where Snort looks for different types of attacks to occur.

  6. If you are interested in detecting the usage of AOL Instant Messenger (AIM), the various IP addresses of the AIM servers are defined in the snort.conf file. This is done because the IP addresses change frequently, and by using a variable, the rules don't have to be updated each time the IP address changes. If you don't wish to trigger based off AIM usage, don't worry about changing these IP addresses.

  7. Download the Snort rules from http://www.snort.org/rules. Click Download Rules on the right-hand side of the page. On the Download Rules page, scroll down to the section labeled Sourcefire VRT Certified Rules (unregistered user release). Download the latest ruleset.

  8. Extract the rules (and /docs) to the location of your choice, typically /etc/snort/rules and /etc/snort/docs.

  9. Configure the RULE_PATH variable, which tells Snort where to find the rules used for triggering events. You can use a relative path such as var RULE_PATH ../rules or an absolute path such as /etc/ snort/rules.

  10. The next section has some commented out lines to disable certain detections of some infrequently seen types of traffic. Unless you are having some issues with those alerts or your IDS is very low on resources, it's probably fine to just leave those at the default (enabled) configuration.

  11. The last few lines of the "step 1" section enable you to configure the detection engine for systems with limited resources. Unless you are having issues, you can leave this option alone.

  12. After that the "step 2" and "step 3" sections of the configuration file allow you to enable or disable specific functionality and detect particular types of attack, such as fragmentation attacks, stateful inspection, and stream reassembly options. Delving into the specifics of each of those options is beyond the scope of this chapter and for many, the default setting will serve them well.

  13. The section labeled Step #4 contains output options for Snort. Uncomment output alert_syslog: LOG_AUTH LOG_ALERT (the default). Despite what facility and severity you configure here, the snort alerts will be generated as auth.info. You also need to include the –s switch on the command line to enable syslog logging. We will discuss syslog in more detail in the next chapter. If you don't have a syslog server to log to yet, just make note of the setting and come back to it when your syslog server is set up.

    Using the preceding example of LOG_AUTH and LOG_ALERT, you would need the following in your syslog.conf file to log to a syslog server at 192.168.1.99:

    auth.info @managmentserverIP

    If you are using syslog-ng, you would need a logging destination defined, a filter that specifies what events to capture, and a log statement in the syslog-ng.conf file. An example of this configuration would be the following:

    destination d_lab { udp ("192.168.1.99" port(514)); };
    filter f_most { level(info..emerg); };
    log { source(s_sys); filter(f_most); destination(d_lab); };

  14. Edit the paths for the dynamically loaded libraries in section #2 to point to the proper path. Depending on your Linux distribution and installation method, these paths may not be the default. For example, on Fedora Core 5, using yum to install Snort, the settings would use the following paths: dynamicpreprocessor directory /usr/lib/snort/dynamicpreprocessor and dynamicengine /usr/lib/snort/libsf_engine.so. If you receive an error when you try to run Snort, along the lines of Unknown rule type: dynamicpreprocessor directory or Unknown rule type: dynamicengine, then your installation of Snort is not configured to use dynamically loaded processors. In this case, simply place a # in front of both of those lines to comment them out.

  15. The last section (Step #6), contains various include statements that specify the rulesets to be checked. Some rules are disabled by default, such as chat.rules, which is triggered by the use of various instant messaging clients. To enable or disable a given ruleset, simply add or remove a # at the beginning of the include line. This entry can be left as a relative path (for example, include $RULE_PATH/ local.rules) because the RULE_PATH variable will be expanded to make it an absolute path.

  16. If you need any custom rules that are not included with the standard Snort release, you can download rules provided by the Snort community from the Rules page on the Snort Web site. If you are looking for something unusual, you might find it there without having to create the rule yourself.

You are now ready to start up Snort and see what it looks like in action. When you start Snort you can specify the interface to listen on using the –i switch such as –i eth0. If you don't specify, it will use the first interface. Use the –c option to tell Snort which configuration file to use. It can be useful to have multiple configuration files configured so you can quickly switch configurations for special circumstances. You could prepare different configuration files to home in on certain issues, segments, or more in-depth logging. Another important option is –A, which tells Snort what type of alerts to generate. The options are fast, full, console, or none.

The following command example would start Snort listening on the first interface (no –i used), with alerts going to the console only, using the configuration file at /etc/snort/snort.conf. The –l switch tells Snort where the logging directory is located. The –K switch tells Snort what types of logs to generate. ASCII logs are easier for a human to read, but they take a little more time to log. If speed isn't a concern, the ASCII logs will probably be the easiest to read and analyze.

snort --A console --c /etc/snort/snort.conf --l /etc/snort/log --K ascii

You should see any triggered rules produce a message on the console and logged to your syslog server. If you add the –s switch to the end of the line, it will tell snort to log to the syslog server you have configured in the snort.conf file; however, it will not also display on the snort console. If you want to create a rule for testing purposes to see what the results look like, create a test rule file, such as TESTING.rules, and place it in the rules folder (/etc/snort/rules, in this example). In this file you could place the following line, which would trigger on any attempts to ping another system.

Alert icmp any any -> any any (msg:"TEST rule";sid: 1000001;)

Edit the snort.conf to read your new rule by inserting the following statement towards the end of the file: include $RULE_PATH/TESTING.rules. . As a last step, edit the snort\stc\sidmsg.map file. This file provides a mapping between snort alert messages and alert IDs or numbers. Custom alerts should use an ID number of more than one million. Add the following line at the end of the file:

1000001

Placing the ID number is the minimum requirement for Snort not to output an error. You can certainly fill in all the other fields, following the existing message maps as a guideline. When this is done, you will need to stop and restart Snort. Here is a partial display of the console output of a single ping and the reply.

10/12-21:29:35.911089 [**] [1:0:0] TEST rule [**] [Priority: 0] {ICMP}
192.168.1.99 -> 192.168.1.103
08/10-18:22:20.284438 [**] [1:0:0] TEST rule [**] [Priority: 0] {ICMP}
192.168.1.103 -> 192.168.1.99

You can also add your own custom rules to the local.rules file. When you open the file, you will find it is essentially empty, existing solely for you to place your custom rules in it. The local.rule is "included" in the snort.conf by default, so you will not need to add it there. You will, however, still need to edit the sid-msg.map file for any rules placed in local.rules.

The –A option will alter the display of the alerts on the console, while the –K option controls how the alerts are logged to the log directory. You should experiment with the different display formats to find the one that provides adequate information with the minimal strain on the Snort host. For day-to-day operations you would probably want to use fast alerts in your log files, which look like the ones that are sent to the console with the console option. Available alert modes and logging formats are outlined here for handy reference.

  • -A console Logs to the console in the following format:

    10/12-21:29:35.911089 [**] [1:0:0] TEST rule [**] [Priority: 0] {ICMP}
    192.168.1.99 -> 192.168.1.103
  • -A fast Logs in the same format as console, but writes the alerts to a /snort/alert file with no output to the console.

  • -A full Logs to the /snort/alert file in the following format:

    [**] [1:0:0] TEST rule [**]
    [Priority: 0]
    10/12-21:38:53.741606 192.168.1.103 -> 192.168.1.99
    ICMP TTL:64 TOS:0x0 ID:6350 IpLen:20 DgmLen:60
    Type:0 Code:0 ID:512 Seq:7936 ECHO REPLY
  • –K pcap This is the default mode if you don't specify an alternate format on the command line. This file will contain the alert packets in their entirety. You can open this file using a network sniffer such as Wireshark.

  • –K ascii Will create a folder under /log for each IP address. Within that folder each rule will create a log file. The log entries will be the same format as the "full" alert format.

  • –K none No log file will be created.

Congratulations! You now have a working IDS. Figure 4.14 shows the syslog alerts from the TESTING.rule in the Kiwi Syslog Daemon console.

Image from book
Figure 4.14: Snort Alerts in Kiwi Syslog Daemon Console

Using a GUI Front End for Snort

Like the Windows version of Snort, some have felt the administration of Snort could be improved upon by implementing a more robust GUI interface. There are several Snort GUIs to choose from aimed at both the configuration of Snort, as well as the interpretation of the Snort alerts. Some really only offer buttons to configure options on the Snort command line, and offer very little additional functionality, while others bring some very powerful additional features to the table. We will discuss the operation of some of the better offerings in the next section.

Basic Analysis and Security Engine

Basic Analysis and Security Engine (BASE) is available for download from http://www.base.secureideas.net/about.php. The purpose of BASE is to provide a Web-based front end for analyzing the alerts generated by Snort. Base was derived from the ACID project (Analysis Console for Intrusion Databases). Whereas ACID is more of a general-purpose front end for viewing and searching for events, BASE is a Snort-specific utility. The instructions to configure BASE assume you have already installed and configured Snort. Snort must be installed with the —with-mysql switch because Snort does not support MySQL output by default. The Snort Web site has RPM packages with MySQL support already included for some operating systems. This is the list of dependencies for running BASE: httpd, Snort (with MySQL support), MySQL, php-gd, pcre, php-mysql, php-pdo, php-pear-Image-GraphViz, graphviz, and php-adodb. Follow these steps to get BASE up and running.

  1. Download and install MySQL and BASE

  2. Edit the /snort/snort.conf file. Uncomment and edit the following line:

    output database: log, mysql, user=snort password=snortpass dbname=snort
    host=localhost
  3. The next few steps are related to setting up the MySQL database and settings. After you install MySQL, enter the MySQL commands by typing mysql on the command line. This will place you in an interactive command mode. All commands must have a semicolon at the end of the line. By default, the MySQL installation will not have a password set at all. You should add a default password with the following commands.

    mysql
    mysql> SET PASSWORD FOR root@localhost=PASSWORD('somepassword');

    After you have assigned a password to the root account, simply entering mysql will not enable you to access the interactive command mode. After a password has been assigned, use mysql –u <username> –p. You will then be prompted to enter the password for the user you specified (typically root).

  4. The next step is to create the Snort database.

    mysql> create database snort;
  5. You now need to give the Snort user permissions to add the needed tables to the Snort database. Use these commands:

    mysql> grant INSERT, SELECT on root.* to snort@localhost;
  6. You should now set the password for the Snort user to the same password you used in the Snort configuration file.

    mysql> SET PASSWORD FOR snort@localhost=PASSWORD('snortpass');
  7. The next step is to add some additional permissions for the Snort database using the following commands:


    mysql> grant ALL on snort.* to snort@localhost;
    mysql> grant ALL to snort;
    mysql> exit
  8. Now that the database has been created, you need to populate it with the tables Snort uses. Use the following command to create the tables:

    mysql --u root --p < /etc/snort/schemas/create_mysql snort

    When the command completes, it will not give any indication of its success; therefore, it will be necessary to manually verify that the tables were created.


    Tip 

    If the package you installed did not include the /snort/schemas/ directory, you can download the source package and extract the directory from there. With Fedora Core 5, for some reason installing the Snort with MySQL support did not include the schemas directory.

  9. Verify the MySQL tables were created in the Snort database by entering the following commands. You should see output similar to that shown in the following example:

    mysql --u root --p
    show databases;
    +----------+
    | Database |
    +----------+
    | mysql |
    | snort |
    | test |
    +----------+
    use snort;
    show tables;
    +------------------+
    | Tables_in_snort |
    +------------------+
    | data |
    | detail |
    | encoding |
    | event |
    | icmphdr |
    | iphdr |
    | opt |
    | reference |
    | reference_system |
    | schema |
    | sensor |
    | sig_class |
    | sig_reference |
    | signature |
    | tcphdr |
    | udphdr |
    +------------------+
    exit

    The list of databases is not significant, as long as the Snort database exists, of course. The table listing must be accurate. If any are missing, Snort will generate an error when you run it.

  10. Install php-gd, which is used to generate the graphs in BASE. On Fedora Core 5 you can just type yum install php-gd.

  11. Install ADODB, which is a database abstraction library for PHP. On Fedora you can simply enter yum install php-adodb.

  12. It's now time to configure BASE itself. Edit the /usr/share/basephp4/base_conf.php file to ensure that the following lines are configured with paths and settings appropriate for your configuration.

    $BASE_urlpath = '/base';
    $DBlib_path = '/usr/share/ododb';
    $DBtype = 'mysql';
    $alert_dbname = 'snort';
    $alert_host = 'localhost';
    $alert_port = '';
    $alert_user = 'snort';
    $alert_password = 'snortpass';

    You should not be able to access the BASE Web page at the following URL: http://localhost/base/.


    The very first time you start up BASE, none of the database tables have been created. You will see something like the page shown in Figure 4.15.

    Image from book
    Figure 4.15: BASE Setup

  13. Click on the Setup page link.

  14. Click the Create BASE AG button on the right-hand side. You see several success messages as shown in Figure 4.16.

    Image from book
    Figure 4.16: BASE Success

  15. Click the Main Page link. This should take you to the primary BASE interface as shown in Figure 4.17.

Image from book
Figure 4.17: BASE Main Page

Although this window may not be too flashy, there is a wealth of information you can discover. Most of the fields are actually links. By clicking to the right of Today's alerts, for example, you can get a sorted list of unique alerts, a listing of all alerts, or a list sorted by source IP address or destination IP address. The other headings along the left side offer similar functionality. Of particular note are the links for the Most Frequent 15 addresses by source address. This would enable you to quickly see which systems are generating the majority of your alerts. If you open that window (shown in Figure 4.18) there are several additional fields that are also hyperlinked.

Image from book
Figure 4.18: BASE Most Frequent by Source IP

Note the field at the bottom labeled ACTION. This enables you to configure the alert groups. Alert groups are basically shortcuts to enable you to view a subset of alerts quickly, without having to navigate through the various menus to get there. For example, suppose you want to know anytime that 192.168.1.1 generates an alert. You can check the check box to the left of 192.168.1.1, and then use the {action} drop-down box to select Create AG (by Name). In the action column, enter .1_ALERTS to use as the alert group name. Finally, click Selected.

The next screen enables you to enter a description for the newly created alert group. Enter a meaningful text description for the group and click Save Changes. The next screen will be a listing of all alerts from 192.168.1.1. This screen is the alert group. In the future, if you want to quickly see this group of alerts, you can click Alert Group Maintenance at the bottom of each page, and then click the alert group you want to view. In this way, any subset of alerts is only two clicks away, sort of like a shortcut straight to a particular set of filtering criteria.

Another feature of note is the Administration link at the bottom of each page. This will take you to a screen where you can configure users for BASE. There are four options on the administration screen: list users, create a user, list roles, and create a role. These screens enable you to create users and assign them to various roles. If you click List Roles, you can see the four predefined roles. If you want to assign a user in the administrator role, simple click Create a user. Enter the login name, a full name or description, and a password. Use the drop-down box to select a role and then click Submit Query. None of the settings here will take effect until you edit the base_conf.php file and change the value of $Use_Auth_System = 1;. A value of 0 (the default) means the authentication is disabled and everyone has full access to BASE. Only the admin role has access to the administration screen.


Tip 

Remember the different logging options for Snort on the command line. Previously, we used –A console, which would log Snort events to the Snort terminal. If you are going to be using a different front end for viewing Snort alerts, there isn't much value in also logging to the console. You can use –A none when starting Snort, which will c

'Hacking' 카테고리의 다른 글

Investigation of Vulnerabilities  (0) 2008.11.21
1.4. Assessment Service Definitions  (0) 2008.11.21
TOP SQL injection tool lists [15]  (0) 2008.11.12
SQL injection  (0) 2008.11.12
TCP flags  (0) 2008.11.07
Posted by CEOinIRVINE
l

Preprocessing Punk Packets

Snort relies on a packet-sniffing subprocess using the pcap library of functions, which it gets from either the Linux libpcap library (see Chapter 4) or the Windows WinPcap driver (see Chapter 5). Snort is a network packet sniffer, so it works by detecting well-defined patterns (signatures) as network traffic flows by. As Figure 9-1 shows, preprocessing is the first stop on the long train ride for a packet through Snort’s systems.

The signature analysis that most people associate with a network IDS comes into play with Snort’s detection systems, which are built by using the rules files explored in Chapter 8. Snort has a robust and flexible system of rules; that flexibility puts a lot of bullets in the belts of security administrators.

This low overhead and plug-in architecture gives Snort such a remarkable efficiency. You can turn on or off different elements as needed for every installation, which is one reason why Snort fits “just right” in most environments. If you don’t need certain functions, turn them off. Preprocessing is one of the shining examples of that philosophy in action.

Image from book
Figure 9-1: Follow Snort’s nose as data packets travel through its many systems.

Defining preprocessing

 Remember  Preprocessing fits into this whole quilt at the lowest level: the network layer. The purpose of preprocessing is to remove as much work as possible from the detection engine and associated plug-ins (which are far more processor intensive) by removing packets that just waste Snort’s time.

 Tip  Imagine having a million tiny balls of three different colors — red, blue, and yellow — and each ball has a number printed on it. Preprocessing is like sorting the jumbled balls into three trash cans by color and then looking through the pre-sorted balls for a specific number. If you know that only red balls can represent an attack in progress, then it makes no sense to spend time carefully checking the numbers on any of the blue and yellow balls.

Understanding the benefits of preprocessing

Preprocessing performs lots of useful tasks for a well-oiled Snort IDS. It provides a clearer picture of a stream of communications between the computers, instead of just relying on a single packet without any context. When two computers are exchanging information, the “conversation” that they’re engaged in is usually called a session. Sessions have a well-defined beginning and end, as well as rules for who can speak and at what time.

Session analysis reduces both false positives and false negatives and gives the detection engine more visibility of the kind of behavior that is actually occurring. Packet inspection with preprocessing can reveal a lot about what tricks those wily hackers are employing to subvert the integrity of network communications, and possibly evade network security sensors.

Looking under the packet magnifying glass

When normal network communication transpires (for example, when someone is browsing for a movie showtime on Yahoo!), little bits of data go back and forth in a well-defined, choreographed dance. Some advanced packet preprocessors detect ill-formed and inconsistent packets, which are usually indicative of illicit behavior. Such network scanning tools as Nmap and Strobe allow for the manufacture of fake packets that can cause information leaks and system crashes.

Detecting anomalies

Snort implements its preprocessing functions at the decoder level after the packet has been broken out into its major fields and before the rule-processing engine does any pattern matching or rule analysis. This processing order gives you the most flexibility and keeps Snort operating at near-wire speed.

When you implement more and more front-end analysis, speed is sacrificed. In essence, the more examination you do, the slower the entire system, but, the better the results. One of the most important themes with tuning Snort — or any other IDS — is trying to find that fine line between too much noise and missed attacks: Eradicating false positives should be your first and foremost goal.

This goal makes Snort’s method of preprocessor plug-in design a well thought- out and attractive option. If you want to expend the extra resources to scour packet streams for more data, simply turn preprocessing on. If you don’t want the hassle, turn preprocessing off.

Keeping packets in a row

In this section we explore how we can setup and use the best of the preprocessors that come standard with your Snort distribution: stream4 and frag2. Without stream4 and frag2, your Snort system would be oblivious to scans against your network and attempts to bypass your IDS or firewall.

The stream4 preprocessor

The stream4 preprocessor was built to help Snort get a better view of TCP sessions by providing stateful inspection and session reassembly. According to its original design, Snort is basically stateless. The stream4 preprocessor, when enabled, allows Snort to monitor thousands of concurrent sessions and has the added flexibility of activating state management for user-defined ports. By restricting the preprocessor to only a few ports, you can save a lot of processing power, which would normally be wasted on trying to keep track of potentially millions of sessions in a large-scale network.

Also, you can set stream4 to alert you when sniffed packets aren’t part of any session at all. This event really only occurs when a hacker is trying to masquerade as one of the computers involved in a session or is trying to insert himself into the communications stream, often called a man-in-the-middle attack.

Stream4 also allows the construction of rules using the flow keyword that can identify the direction and state of the traffic. These rules are especially helpful in determining how sessions begin and end and whether an attack is inbound or outbound from your network, as well as giving some indication as to the nature of the session. (Chapter 8 shows rules building and testing, including many rules that rely on the stream4 preprocessor for a complete analysis.)

Configuring the stream4 preprocessor

 Tip  To enable stream4, open your snort.conf file with a text editor and make sure that the following line is uncommented:

preprocessor stream4: detect_scans, keepstats machine

The stream4 preprocessor has several different options, which you include as a comma-separated list, as shown in the preceding example. The following options govern what you can configure the preprocessor to look for (including portscans and state problems):

  • detect_scans: The detect_scans option (which is normally set to Off if it’s not included on the configuration file) instructs the stream4 preprocessor to alert when a portscan is attempting to avoid detection by using stealth techniques. Because the regular way TCP/IP traffic works involves a three-step handshake, which many types of stealth portscanners intentionally fail, they’re snooped out by using this stream4 parameter.

  • detect_state_problems: The detect_state_problems option (which defaults to Off if not explicitly set) instructs the stream4 preprocessor to analyze how the state of a flow of TCP packets is kept. This feature is intended to catch faults or failures if the state mechanism of a TCP session is somehow altered by a peer. Given how noisy this parameter can be, we don’t recommend it unless you intend on doing some heavy in-depth analysis. Although good at detecting packets that are malformed, many implementations of TCP/IP have small variations that trip this sensor.

  • disable_evasion_alerts: The disable_evasion_alerts option is an advanced setting that detects special cases where an attacker tries to fool an IDS detection engine into ignoring a packet, but the packet gets to the target.

     Tip  We recommend leaving this option off (which is the default). It can generate many false positives and eat lots of processing power.

  • ttl_limit: TTL means Time To Live and is a common term used when talking about packet transmissions over a network. A TTL setting can help keep tabs on how much time a packet flow takes to reach its destination. Sometimes an attacker tries to evade detection or masquerade as being somewhere else by twiddling the TTL settings with a session. You can use the ttl_limit option to alert you to a big variation in the TTL setting across a stream of traffic. This parameter is hard to tune properly, but it’s a safe bet to use 10 as a starting point as the maxi- mum TTL.

  • keepstats: The keepstats parameter accumulates a set of statistical data on the connection tracking and session state analysis, which can be logged with either the machine keyword (which actually is a text file) or the "binary" keyword, which tools such as Barnyard can read.

  • noinspect: To curb excessive processing on a busy Snort installation, the noinspect switch can restrict the stateful inspection to only those ports listed with the stream4_reassemble preprocessor.

  • timeout: The timeout parameter sets an idle time after which stream4 stops monitoring a particular session. Basically, if Snort doesn’t see a packet as part of an active session in its table within the time specified by the timeout switch, then that session is flushed from memory. Because this option defaults to 30 seconds without even specifying it, Snort’s normal behavior is to only perform stateful analysis of traffic that has been active within a 30-second window.

  • log_flushed_streams: The stream4 preprocessor works by building a session block from the little packets that comprise the entire stream. Using this method, the preprocessor can look for anomalous behavior and perform rule testing. This session block, which is kind of like a gigantic packet, can be flushed to disk for troubleshooting and further analysis. The log_flushed_streams parameter to stream4, if used, instructs the preprocessor to drop the session block in the logs when it triggers an alert.

Our advice is to experiment with the preceding options, see what works well for you, stick with it for a time, and then go back and tune as attack trends change.

Stream4 and session reassembly

Somewhat similar to session tracking (see the preceding section), Snort’s stream4 preprocessor also supports full session reassembly. By keeping a window of packets that comprise a session in memory, Snort can alert you to attacks that span multiple packets.

TCP connections can have data fragmented across a group of packets, while UDP transmissions are required to contain all the data in a single packet. Many applications that use TCP for their transfer medium are interactive in nature and often have lots of fragmentation. SSH and telnet session are notorious for splitting data in this way.

By reassembling packets, Snort’s analysis and detection engines can catch the sneakiest of attacks. For example, say that you wanted notification when someone transmits a sequence of characters containing /etc/passwd (the location of the users and groups on a Unix operating system) over a telnet session. Telnet sends a separate packet for each keystroke. So, in essence, what you’d have is thousands of little packets, with one character in each, which is horrible for a rule-matching system like Snort. Reassembly globs all of those individual packets into a giant packet to which the rules engine can analyze.

Session reassembly is set up in much the same way as the stream4 preprocessor (which we discussed in the preceding section). By adding the following line to your snort.conf configuration file, you can enable the reassembly features.

preprocessor stream4_reassemble: both ports 21 23 80 110

The following options are available in the stream4_reassemble preprocessor:

  • clientonly, serveronly, both: The first parameters given to stream4_reassemble identify which sides of the connection to conduct reassembly on.

    • Clientonly refers to traffic inbound to what you’ve defined as $HOME_NET in your snort.conf file.

    • serveronly refers to traffic outbound.

    • Both means reassembly of everything.

  • ports: The ports parameter directs Snort’s stream4 preprocessor to restrict its reassembly activity to just the ports identified with this switch.

    • By using the default keyword, Snort performs reassembly on ports 21 23 25 53 80 110 111 143 and 513.

    • The keyword all performs reassembly on all ports, which we don’t recommend (except for short periods of testing).

  • noalerts: The noalerts parameter tells stream4 not to report on strange or problematic issues encountered during reassembly. For example, traffic manually inserted into a stream or modified packets is detected and logged, and stream4_reassemble generates an alert, unless this option has been indicated.

The preceding example of stream4_reassemble usage should be enough for most people. If you either use other protocols where you want reassembly to occur or run telnet, FTP, HTTP, or POP on nonstandard ports, change the ports listing to the appropriate application ports for your configuration.

The frag2 preprocessor

Because many varieties of devices are out there (and many can transfer data over TCP/IP), subtle implementation differences result in packets that must sometimes be reorganized and chopped into smaller packets, a process that’s called fragmentation.

 Technical Stuff  To a network-based IDS, fragmentation can result in false negatives (real attacks that are missed) because the attack actually spans several packets. The original offending data may have been in a single packet at the beginning of its journey, but through the normal process of routing, it may have been redistributed over several packets, which hides it well. Such fragmentation poses a special problem for Snort, but, thinking ahead, the Snort team has an answer: the frag2 preprocessor.

By enabling frag2 in your snort.conf file, Snort’s packet decoder uses a similar reassembly process for reconstructing fragmented packets, before submitting them to the detection engine. It takes the pieces and puts Humpty Dumpty back together again.

To enable the frag2 preprocessor, use a configuration like this:

preprocessor frag2: timeout 60

Normalizing network traffic

The decoding and normalization of certain types of network traffic is an important preprocessing chore. Pattern matching systems like Snort can fail when an attacker introduces subtle variations. These variations are perfectly acceptable and even warranted in most cases, but they can be misused by attackers.

There are many ways to encode a Web page address into a URL It’s possible for two encoded URLs to look completely different to the human eye, but are the same as far as a Web server is concerned. For example, the following two URLs are exactly the same, yet they look entirely different.

http://www.somewhere.tld/cgi-bin/form-mail.pl?execstuff
http://0/%63g%69%2d%62in/%66%6fr%6d%2d%6d%61%69l%2e%70l?%65%78%65%63%73%74uf%66

Of course, these different notations can easily trip up a Snort rule, which matches against an exact pattern. In the preceding example, consider that a rule matches the form-mail.pl string of bytes, which generates a Snort alert. The second URL would sneak by the detection engine, though it’s just as lethal as the first.

Snort’s normalization preprocessors are an excellent way to combat these open doors. The following sections cover three of these preprocessors in more depth: HTTP, telnet, and RPC (Remote Procedure Call).

http_inspect: a preprocessor for HTTP

With Snort 2.1, the http_decode preprocessor gave way to the http_inspect preprocessor. If you use Snort 2.0, use http_decode. If you use Snort 2.1 (or later), use http_inspect.

 Tip  We recommend installing and using the http_inspect preprocessor. Using http_inspect normalizes all packets containing different forms of HTTP communication into a state that Snort can easily compare and scan through its rules. A huge amount of Web traffic crosses the Net, and many attacks rely on the HTTP protocol as their transmission medium.

To configure your Snort system so that it normalizes Web traffic, you need to put a few lines in your snort.conf configuration file that look something like the following:

preprocessor http_inspect: global iis_unicode_map unicode.map 1252
preprocessor http_inspect_server: server default profile all ports { 80 }
preprocessor http_inspect_server: server 172.16.1.1 profile all ports { 80 }

The first configuration line, which contains the keyword http_inspect, is for setting up the global behavior of the preprocessor, whereas the other lines with http_inspect_server in them are for specializing the configuration for individual machines. You need to include the iis_unicode_map keyword and its argument. Without it, Snort complains and refuses to start.

The options that follow the http_inspect_server keywords include the

  • Ports on which the preprocessor should operate (between the {}s).

  • A series of operations that should be used when normalizing the traffic.

The options described in the next sections are some of the most useful http_inspect options. They show how HTTP preprocessing really works.

iis_unicode <yes|no>

Characters in English and Western-European languages are normally represented using the ASCII encoding system. ASCII doesn’t cut the mustard for languages that require extended character sets, so a larger encoding system called Unicode, or UTF-8, is used. By using the iis_unicode keyword to the http_inspect_server preprocessor, all non-ASCII characters are converted back into ASCII for comparison.

 Tip  The iis_unicode option is important because it alerts on attempts to hide a URL by using different encoding techniques.

double_encode <yes|no>

Double encoding is often used to preserve % in URI encoding. The percent sign is most frequently used as an escape character within a URL, giving uses the full spectrum of additional characters as part of their input. Because hackers may try to disguise their attempts using a way to obfuscate their traffic with extra %’s, this option helps trap and contain them.

iis_backslash <yes|no>

Windows and DOS systems use the back-slash character \, much like Unix systems use the / character. Web browsers, Web servers, and URLs follow the lead of the Unix world and use the forward slash as part of an encoded URL. Microsoft’s IIS Web server can treat both identically, yet Snort only matches on exact sequences of bytes. The iis_backslash parameter can catch odd sequences of slashes as part of an attacker’s behavior.

apache_whitespace

The apache_whitespace parameter helps when a muck of whitespace characters try to sneak around the detection engine. The apache_whitespace option automatically converts all tabs in a URL into spaces, before the detection engine compares the data in the URL against the Snort rules.

telnet_decode: a preprocessor for telnet sessions

In much the same way that http traffic can be preprocessed before being turned over to the detection engine for adjudication, telnet remote interactive command-line sessions can be sent through a preprocessor.

 Technical Stuff  The two peers using the telnet protocol do their housekeeping via an inline protocol that can often trip-up the Snort detection engine. The inline negotiation channel involves such flow control parameters as discussing features the client and server support and what kind of terminal should be emulated. This noise is useless for the detection engine. By using the telnet_decode preprocessor, telnet protocol chatter can be filtered out before being analyzed for security rule matches.

The following is an example of how to configure telnet_decode in your snort.conf configuration file:

preprocessor telnet_decode: 23

The trailing 23 is the port number that the preprocessor should restrict its activity to. Telnet normally runs on port 23, but if you run your telnet daemon on a different port, then change this number to that port.

 Tip  You can specify multiple ports by adding to the end of the config line, separated by spaces.

rpc_decode: a preprocessor for RPC connections

Applications that use Remote Procedure Calls (RPC connections) use a different connection method than most common network services. Servers using RPC don’t listen on published well-known ports, such as TCP port 22 for telnet or TCP port 80 for HTTP. Servers using RPC bind to a random, unreserved port and publish that they’re available to another application (the local portmapper). You may already be familiar with portmapper if you’ve seen what application is listening on a TCP and UDP ports 111 on a standard Unix computer.

 Tip  How can you snort when you don’t know where to put your nose? The answer is to decode the traffic on port 111, which is the traffic cop port. It isn’t a perfect answer, but it helps get the job done.

To configure the rpc_decode preprocessor, insert the following line into your snort.conf configuration file:

preprocessor rpc_decode: 111 32711

The numbers that follow the colon are ports to regard for decoding. Port 32711 is a port that Sun’s Solaris operating system uses for portmapper in addition to port 111.

Deciding what’s normal and what’s not

A big advantage of using a preprocessor plug-in is the detection of anomalous protocol behavior. With anomaly detection preprocessors, Snort can be extended to detect attacks using more advanced techniques than simple pattern or port matching.

Some of the best examples of this advanced analysis are well demonstrated with the portscan and bo preprocessors.

portscan, portscan2, conversation

Portscanning is a technique that hackers use to “get the lay of the land” of a network that they intend to target. If we compare digital attacks to real-world warfare ones, portscanning is analogous to sending a surveillance and reconnaissance team to catalog the buildings, access portals, and armed guards that protect an installation.

Typical Snort rules can’t see whether an individual packet is part of a probing attack. The portscan, portscan2, and conversation preprocessors operate on both

  • Individual packets

  • Groups of packets

What makes a portscan a portscan? Together, several factors paint a pretty good picture of the prober’s intent:

  • The time over which the packets were sent.

  • The number of destination ports the packets were directed toward.

  • The number of destination hosts addressed by the packets.

Snort’s portscan preprocessor operates by watching for a specified number of packets, sent within a certain timeframe, directed at any of the hosts on our network. For example, portscan produces an alert if it’s programmed with a threshold that 100 different ports were addressed within 5 minutes all from the same IP address source.

The portscan preprocessor is configured in the Snort configuration file with a line like this:

preprocessor portscan: 172.16.100.0/24 10 30 /var/log/snort/portscan.log

For the specifics on those options, check the configuration flags, which conform to this setting:

preprocessor portscan: <network> <# of ports> <time period> <logfile>

The example shows that this instance of the portscan preprocessor is set up to produce alerts whenever someone is probing the 172.16.100.0 Class C network with at least 10 different ports within 30 seconds.

 Tip  A configuration line in your snort.conf file can tell the system to ignore certain networks. This line is handy when you do port scans of your own network for topology mapping purposes. To configure portscan-ignorehosts, edit your snort.conf file and input a line using the following syntax:

preprocessor portscan-ignorehosts: network/netmask

To ignore networks 192.168.4.0/24 and the host 10.10.10.66, add the following line to snort.conf:

preprocessor portscan-ignorehosts: 192.168.4.0/24 10.10.10.66/32
Sneaky stealthy snoops: advanced portscan techniques

The portscan preprocessor has an interesting advanced behavior that helps you detect obvious rogues who are trying to paint a picture of what you have online. Often hackers use specialized tools to try mapping a network by slipping “broken” or “invalid” packets past Snort. Many of those packets should never be seen within the context of normal network communications, and others shouldn’t exist at all. Snort can catch these stealth-scanning methods by using the portscan preprocessor’s ability to detect these manufactured fake packets. Table 9-1 summarizes the most common stealth portscanning techniques.

Table 9-1: Stealth Techniques Detected by Snort

Packet Type

Description

FIN

Only the FIN flag in the packet header is on.

NULL

No flags are on (which should never happen).

SYN/FIN

Only the SYN and FIN flags are present.

XMAS

Only the FIN, URG, and PSH flags have been set.

Back Orifice (bo)

 Technical Stuff  In the late 1990s, an underground hacking group named The Cult of the Dead Cow (CDC) created a remote administration application called Back Orifice (a play on Microsoft’s Back Office program suite) to control Windows operating system computers from afar. While Back Orifice can be used for legitimate system administration, it’s also a favorite backdoor program for intruders. All you must do is trick someone into installing the program, which isn’t hard because it’s small and easy to package with other programs.

 Tip  The bo preprocessor focuses on traffic associated with the Back Orifice tool, which is an incredibly strong indication of a hacker in your midst.

The bo preprocessor can detect the first few moments of a BO connection attempt across the network and alert on it appropriately. Configuring the bo preprocessor is straightforward. Simply edit your snort.conf file and add the following:

preprocessor bo

Experimental preprocessors

A handful of other preprocessors — some developed by groups outside of the Snort development organization — are out there. These experimental and third-party can

  • Handle ARP spoofing. (ARP stands for Address Resolution Protocol and deals with how computers’ IP addresses are found on a local Ethernet network.)

  • Look aggressively for unknown exploit code that hasn’t been identified by a signature yet.

  • Analyze the other protocols found in a standard internal network.

'IT' 카테고리의 다른 글

Tech, Telecom, and Web Earnings Look Bleak  (0) 2008.10.14
[5] Snort Tuning: Reduce False Positives  (0) 2008.10.14
[3] Snort Configuration : Refinement  (1) 2008.10.14
[2] Snort Configuration : Rule Installation  (0) 2008.10.14
Snort Configuration [1]  (0) 2008.10.14
Posted by CEOinIRVINE
l

Rule Refinements

This section is the fun part of tweaking specific rules to match your environment. We recommend a regular strategy of nosing through your Snort output. As time passes, the composition of your network changes, and the minefield of vulnerabilities expands.

Trimming the fat

Likely the first refinement that any IDS guru recommends, almost to the point of being a broken record, is to reduce your false positives by stripping the dead wood from your rules files.

We recommend that you sit down with a map of your network and a list of your network connected assets (operating systems and exposed services are the most critical) and build a table of your computer resources that can be attacked. From there you comment out those rules that just don’t matter. If you have ten Windows NT servers running MS Project Server and nothing else, there’s little need for a thousand Linux/Unix rules.

Commenting out unneeded rules is a simple matter: Just edit the file containing the rule and place a “#” before the first character of the rule type (generally “alert”).

Chapter 9 includes more tuning methods that reduce false positives and the reasons why removing the extra noise keeps your Snort a-snorting.

Making adjustments

Small changes to the rules files of your setup can keep your Snort installation running at peak efficiency. By refining the rules that you are already running with Snort, you generate better reports, waste less time reviewing them, and react faster.

 Warning   Before editing any Snort rule file, it’s highly recommended that you do the following:

  • Always make a backup of that rule file.

  • Make sure that you use a plain text editor that doesn’t add any funky formatting or characters when you save the file. The vi program in Linux and Notepad in Windows are good examples.

Start by finding a rule that can use some tweaking. Maybe this DNS rule was misclassed:

alert udp $EXTERNAL_NET 53 -> $HOME_NET any (msg:"DNS SPOOF query response 
PTR with TTL\: 1 min. and no authority"; content:"|85800001000100000000|"; content:
"|c00c000c00010000003c000f|"; classtype:bad-unknown; sid:253; rev:2;)

Out of the box, it’s classified as a “bad-unknown” alert. Maybe it should be reclassified as a reconnaissance or information probe, consistent with an “attempted-recon” tag. To change the rule, just edit the dns.rules (the file that contains the rule we’re modifying) and change it to something like

alert udp $EXTERNAL_NET 53 -> $HOME_NET any (msg:"DNS SPOOF query response 
PTR with TTL\: 1 min. and no authority"; content:"|85800001000100000000|"; content:
"|c00c000c00010000003c000f|"; classtype:attempted-recon; sid:253; rev:3;)

 Technical Stuff  We bumped up the revision number to 3 so that another person can see that something’s changed.

 Tip  If you plan on making lots of changes to the base rules that come with Snort, keep a local backup copy of the original version outside of the directory that Snort uses to manage its configuration. If you upgrade Snort without keeping copies of all your custom tweaking, you may accidentally overwrite the whole lot with one punch of the enter key!

Building a rule from whole cloth

In some cases, a new rule is needed. Situations that might require a new rule include:

  • Some sort of odd behavior on the network has been noticed: Maybe an abnormal amount of data is transferred on the network after hours, or a particular server is rebooting for no apparent reason. An investigation begins to determine what these oddities mean, and based on captured network data, you can create a rule that matches the odd event.

  • A new attack hits the Internet. There are no existing Snort rules that match the attack, so you decide to create a rule on your own.

 Tip  For almost all configurations, the standard set of rules (if regularly updated) can be just what the doctor ordered. The need to build a whole rule from scratch isn’t an everyday occurrence.

Here’s a real-world situation that we can use as an example. While on-site at a customer’s facility, we heard that its network was acting irrationally and that the customer needed our help in isolating the cause of it. After an hour of tracking back a huge amount of network bandwidth coming from two workstation computers, we found that they were infected with some sort of virus. We diagnosed a virus by running a packet sniffer and capturing all of those workstations’ network communications.

All of that techno-sleuthing work we did can be best summarized into a packet capture, or at least a fair approximation of one. What follows is a snippet of what we were looking at:

15:30:05.000913 10.3.232.38.1522 > 192.168.4.81.1434: udp 376

0x0000   4500 0194 bec2 0000 6d11 d406 d963 055d        E.......m....c.]
0x0010   d8ab 0224 1069 059a 0180 6b52 0401 0101        ...$.i....kR....
0x0020   0101 0101 0101 0101 0101 0101 0101 0101        ................
0x0030   0101 0101 0101 0101 0101 0101 0101 0101        ................
0x0040   0101 0101 0101 0101 0101 0101 0101 0101        ................
0x0050   0101 0101 0101 0101 0101 0101 0101 0101        ................
0x0060   0101 0101 0101 0101 0101 0101 0101 0101        ................
0x0070   0101 0101 0101 0101 0101 0101 01dc c9b0        ................
0x0080   42eb 0e01 0101 0101 0101 70ae 4201 70ae        B.........p.B.p.
0x0090   4290 9090 9090 9090 9068 dcc9 b042 b801        B........h...B..
0x00a0   0101 0131 c9b1 1850 e2fd 3501 0101 0550        ...1...P..5....P
0x00b0   89e5 5168 2e64 6c6c 6865 6c33 3268 6b65        ..Qh.dllhel32hke
0x00c0   726e 5168 6f75 6e74 6869 636b 4368 4765        rnQhounthickChGe
0x00d0   7454 66b9 6c6c 5168 3332 2e64 6877 7332        tTf.llQh32.dhws2
0x00e0   5f66 b965 7451 6873 6f63 6b66 b974 6f51        _f.etQhsockf.toQ
0x00f0   6873 656e 64be 1810 ae42 8d45 d450 ff16        hsend....B.E.P..
0x0100   508d 45e0 508d 45f0 50ff 1650 be10 10ae        P.E.P.E.P..P....
0x0110   428b 1e8b 033d 558b ec51 7405 be1c 10ae        B....=U..Qt.....
0x0120   42ff 16ff d031 c951 5150 81f1 0301 049b        B....1.QQP......
0x0130   81f1 0101 0101 518d 45cc 508b 45c0 50ff        ......Q.E.P.E.P.
0x0140   166a 116a 026a 02ff d050 8d45 c450 8b45        .j.j.j...P.E.P.E
0x0150   c050 ff16 89c6 09db 81f3 3c61 d9ff 8b45        .P........<a...E
0x0160   b48d 0c40 8d14 88c1 e204 01c2 c1e2 0829        ...@...........)
0x0170   c28d 0490 01d8 8945 b46a 108d 45b0 5031        .......E.j..E.P1
0x0180   c951 6681 f178 0151 8d45 0350 8b45 ac50        .Qf..x.Q.E.P.E.P
0x0190   ffd6 ebca                                      ....

That same sequence of bytes was being repeated ad nauseum by the two busted computers. What we didn’t know at the time was that a new worm outbreak had just started to infest the Internet. What we were seeing with that hex dump was the MS-SQL worm (also known as Slammer) in its replication stage. To bandage the situation, we unplugged the two offending computers and ran to our Snort installation, where we chopped a few bytes out of this trace to build a signature and ultimately a Snort rule to catch any more of these instances.

To illustrate, here’s a string of 16 bytes that can represent this novel worm:

c050 ff16 89c6 09db 81f3 3c61 d9ff 8b45

Line number “0x0150” is an example of a segment made into a signature. Now, on to the fun part of making a Snort rule out of that gunk! The first goal is to build an appropriate header. A review of the first line of the trace dump gives all the necessary network information you need to construct a header.

15:30:05.000913 10.3.232.38.1522 > 192.168.4.81.1434: udp 376

Table 8-6 identifies the meaning of each of the preceding line’s component elements.

Table 8-6: Components of Packet Trace

Description

Value

Time packet was sent

15.30:05.000913

Source address

10.3.232.38

Source port

1522

Destination address

192.168.4.81

Destination port

1434

Protocol

UDP

Packet size (bytes)

376

All that’s needed from Table 8-6 are the protocol and the destination port. The source IP address, source port, and destination IP address show up differently when coming from and going to different systems. Remember, we’re looking for new instances of this worm, not the infected systems we already know about. Coupled with the signature that was scissored from that big block of packet data, that’s the complete makings of a fledgling Snort rule. All the pieces fit together like this:

alert udp $EXTERNAL_NET any -> $HOME_NET 1434 (msg:"New MSSQL Worm A-Multiplyin’";
 content:"|c050 ff16 89c6 09db 81f3 3c61 d9ff 8b45|"; sid:1000001; rev:1;)

 Technical Stuff  The preceding example highlights the following best-practices in creating a Snort rule:

  • We followed the path of the good Snort administrator and made the Snort ID equal to 1,000,000.

  • The revision is marked as 1, meaning that this attempt was our first at drafting a rule to achieve the wanted results.

After testing, if our signature isn’t right or other elements need tweaking, we can make the changes and increase the rev number to reflect the changes.

'IT' 카테고리의 다른 글

[5] Snort Tuning: Reduce False Positives  (0) 2008.10.14
[4] Snort Configuration: preprocessing punk packets : preprocessor  (0) 2008.10.14
[2] Snort Configuration : Rule Installation  (0) 2008.10.14
Snort Configuration [1]  (0) 2008.10.14
Snort Location  (0) 2008.10.14
Posted by CEOinIRVINE
l

Snort Configuration [1]

IT 2008. 10. 14. 04:04

The Center of Snort’s Universe

You’ve already had some modest exposure to the snort.conf configuration file if you installed and configured Snort to run in your shop. It looks long, complicated, and riddled with hieroglyphics, but it isn’t nearly as bad as it seems.

Picking apart the snort.conf file

First off, the snort.conf file is divided into handy sections and organized very logically, even for nontechnoids. (The makers of Snort won’t have poorly built configuration files with their software.) The Snort makers break down your most likely edits into four basic steps, which they conveniently refer to at the top of the file. You’re interested in the Rules section, which is the last step in the snort.conf file.

 Tip  A simple four-step process can manage the configuration parameters in the snort.conf file:

  1. Be like a Boy Scout: Be prepared by having a plan-of-action for what changes you want to make to snort.conf before touching the snort.conf file itself.

 Tip  Keep a notes file of any changes (both made and proposed) and settings you’re working with.

  1. Back up the snort.conf file before you edit it.

    We call ours snort.conf.bak and typically keep it in the same directory as the original snort.conf configuration file.

  2. Use your favorite text editor to make your changes.

  3. Run Snort with the “-T” flag to check snort.conf.

    At the command prompt, run snort by typing the following:

    snort -T

    Running Snort with “-T” tests your snort.conf configuration file and rules for errors and tells you where the problems are. Testing your configuration and rules files before restarting Snort lets you correct errors before restarting Snort, thus keeping you from missing any alerts!

 Technical Stuff  Once you’ve made changes to snort.conf (or any configuration files), restart the Snort application (which geek-types affectionately refer to as "bouncing," "sig-hupping," or even "tickling" the running snort process). If you make changes without completing this step, nothing may happen until the next time you start your computer because Snort hasn’t re-read the configuration files and found the changes.

Playing by the rules

The rules section is the real meat of the snort.conf file. (Or should we say, "The real bacon"?) The snort.conf file has two important configuration entries for proper rule setup:

  • The location of the rules directory, configured under the snort.conf file’s main variable initialization section (Step 1).

    In Step 1, the variable $RULE_PATH must be set to the location of Snort’s rules — for example /usr/local/snort/rules on Linux or D:\snortapps\rules on Windows.

  • Near the end of the snort.conf file, in Step 4, where line after line of rule reference is placed. Here’s a snippet of a few items in our list:

    include $RULE_PATH/local.rules
    include $RULE_PATH/bad-traffic.rules
    include $RULE_PATH/exploit.rules

 Warning   Many of the configuration file’s parameters and settings have analogous command-line switches. When Snort is faced with two opposing instructions (for example, when you pass the "–fast" logging argument to Snort, but have the alert_full output module configured in the snort.conf file), Snort ignores the configuration file and executes according to what was present on the command line. For testing and isolated sensor installation, command-line options work well, but for larger deployments, use the configuration files to make the management, editing, and distribution far easier to handle.

'IT' 카테고리의 다른 글

[3] Snort Configuration : Refinement  (1) 2008.10.14
[2] Snort Configuration : Rule Installation  (0) 2008.10.14
Snort Location  (0) 2008.10.14
Snort Installation on CentOS 4.6  (0) 2008.10.10
Apple's Brick: A Radical New Laptop?  (0) 2008.10.07
Posted by CEOinIRVINE
l