|
|
To print: Select File and then Print from your browser's menu
-------------------------------------------------------------- This story was printed from ZDNet Australia. --------------------------------------------------------------
|
Win2K: Installing an open-source IDS By Ron Nutter, TechRepublic Ins June 28, 2002 URL: http://www.zdnet.com.au/news/software/soa/Win2K-Installing-an-open-source-IDS/0,130061733,120266222,00.htm
Don't let hackers overrun your network undetected. Here's how to install the open source intrusion detection system called Snort so you can catch the attackers before they get away.
Intrusion detection systems are one of the most critical tools to network security engineers. In the Linux/UNIX world, a number of free tools are available that are powerful, flexible, and simple to use. Thanks to Silicon Defense, one such tool, Snort, has made the migration from Linux/UNIX to Windows.In this Daily Drill Down, I will show you how to get Snort installed and running in Windows 2000. Getting started For this article, I used Windows 2000 Professional as the platform on which to build the IDS server. When you set up the system you're going to use, install Windows 2000 Professional, and then apply Service Pack 2 and all updates for your system listed on Microsoft's Windows Update. You'll also want to install IIS so you can use it later to receive real time alerts.
Installing IIS To install IIS on your Windows 2000 server, go to Control Panel, open Add/Remove Programs, click on Add Windows Components and select the check box for Internet Information Server. Click Next and have your Windows 2000 Professional CD at hand for when the installation needs the files for IIS (unless you already had the I386 directory copied to the drive). Once you've restarted the workstation, you can start collecting the files you will need for Snort and the required applications to set up real time alerting. Getting the files
Snort 1.8.6 for Windows requires a number of files to be installed. These necessary files are:
Why WinRAR? The WinRAR tool allows you to decompress any compressed files from the above list. Create a temporary directory to hold your downloaded files. I named mine snort_temp. Then, download these files and save them to your temporary directory.
Play it safe Keep everything in one directory and back up this directory once you've collected all the files so that if you need to re-create the IDS system you're building, you'll have everything at hand that you'll need. Installing Snort
The installation of the Snort application is pretty cut-and-dried. You'll need to create six new directories for this installation:
Unzip the Snort binary that you downloaded and extract it to your temporary directory. Then copy the files listed below in the directories specified:
Editing snort.conf
Next, you'll need to edit the snort.conf file to tell it where to find the files it's looking for. First, edit the output database line that tells Snort you're running MySQL and the user name to log in to the database with. The first line you need to edit is the var HOME_NET any line. Replace the any with a fully qualified IP address and the subnet you wish to monitor. If you want to monitor a single host when your IP is 10.20.30.1 and your subnet is 255.255.255.255, change the any entry to 10.20.30.1/32.
Script tips Make sure to use the forward slash instead of the backslash. The programs you're installing were initially written for Linux/UNIX environments, so using anything other than the forward slash will cause them not to work. I ran into this problem, and it took over two hours on the phone with Silicon Defense trying to figure out why I couldn't get Snort to run. This rule applies with the exception of the installation of PHP. See the section below on installing PHP for more information. Also, when you edit the classifications.config line, put a $ in front of the RULE_PATH variable. Although it's not required for Snort to run under Windows, it helps avoid some script processing problems that have shown up in some installations under Windows.
Installing WinPcapWinPcap is a device driver that adds packet-filtering capability to versions of Windows from 95 to XP. WinPcap allows you to send and receive data through the network card without requiring a special driver from the vendor. To install WinPcap, just run the executable and reboot the workstation before installing the remaining components. Installing MySQL MySQL is also easy to install. Create another temporary directory—I called mine mysql_temp. Unpack the .zip file containing MySQL into your temporary directory. Then, run the setup program. By default, it will install onto the C: drive. If you keep it on the C: drive, you won't have to make configuration changes to use it from another drive.
After you've installed MySQL, you need to create a Win32 MySQL database and Create MySQL tables for the Analysis Console for Intrusion Databases (ACID). Even if you haven’t worked with SQL before, it's not difficult to do this. To create a database named snort, follow these steps:
In the left window labeled Databases, you'll find your new database. To create a MySQL table that will be used for ACID (PHP-based analysis engine used by SNORT to search and process a database of security events), navigate to C:\MySQL\Bin folder from the command window. Then, at the C:\MySQL\Bin> prompt enter the command MySQL -u snort snort < c:\Snort\create_mysql. You'll want to set up Snort to start as a service when using it on a WinNT/2k/XP machine. To do this, first decompress the file called ServiceTools.exe into your root folder. There are two files included in the archive—one is called Srvany.exe and another is called Instsrv.exe. These are required to run Snort as a service. Now open a command prompt window and navigate to your Root folder. At a command prompt type: INSTRV SRVANY <PATH TO ROOT folder>\SRVANY.EXE . At the same prompt type: INSTSRV.EXE snort <PATH TO ROOT FOLDER>\SRVANY.EXE. Start the Registry Editor From the Run box. Make sure you back up your registry. Locate the sub key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Snort and select it. From the Edit drop-down menu, select New | Key and then type Parameters. Right-click the new Parameter key, select NEW | String Value, and type Application. Right-click the new Application string, select Modify, and type C:\Snort\Snort.exe. Right-click the Parameter Key again, select New | String Value, and type AppParameters. Right-click the new AppParameters string and select Modify. Type -c C:\Snort\Snort.conf -l C:\Snort\Logs -ix. Right-click the Parameter Key again, select New | String Value, and type AppDirectory. Right-click the new AppDirectory String and select Modify. Type: C:\Snort. From the Start Menu, go to Programs | Administrative Tools and open the Services applet. Select Snort from the services window, right-click on Snort, and choose Properties. Under Startup Type select Automatic. This will allow Snort to be active when no one is logged on. Testing Snort
You'll want to test Snort to be sure it's configured correctly and to verify that it can talk to the newly created database. To test it, first navigate to the C:\Snort folder at the command line. At the C:\Snort> prompt, enter the command Snort -W to see a list of possible adaptors that the sensor is installed on. Installing PHP, ADOdb, PHPLOT and ACID
The last part of the process goes pretty fast. To install PHP, do the following:
When installing PHP, use the forward slash to specify the path for the session.save_path parameter and use the backslash for the drive and path for the extension_dir parameter. Also, when installing PHP, the term ROOT refers to the path where Windows 2000 is installed; it's typically C:\WINNT. To install ADOdb, simply:
Installing PHPLOT only requires you to decompress PHPLot into the C:\Snort folder. Getting more helpTo install the ACID alert viewer, you need to decompress and move the ACID folder into the root folder of your default Web site (typically C:\Inetpub\wwwroot\). Then, configure the ACID acid_conf.php file in the Acid folder as shown in Listing C. Next, reboot your machine, start your browser, and type: http://localhost/Acid/Index.html. You'll see an error indicating that the underlying database is incomplete the first time you run ACID. Select Setup Page when this error appears. Select Create ACID AG to complete the Acid Alert Group configuration, and then go back to your browser and retype http://localhost/Acid/Index.html. Congratulations, you've installed Snort Once everything is installed and working properly, it may take a few minutes before alerts show up. To make sure things are okay, verify that the Services applet shows Snort as started and that it also shows up as a running process under the Task Manager. If Snort doesn’t show under Task Manager, there is a problem with the service automatically starting using the srvany file. Try deleting the services you created with instsrv, rebooting the workstation, and recreating the services. You'll have a problem if you delete the services and then try to re-create them without rebooting the workstation. From the application side, watch the information that Snort reports closely before hitting the panic button. Some of the items Snort will report are actually normal NT-to-NT communications, but some could be hacking attempts if either the source or destination address in the alert is not coming from your network. As with reporting software, Snort will be only as good as the version of rules you're using to find hacking attempts. Visit the Snort Web site periodically to make sure you have the latest rules install. Getting more help
Keep in mind that you have a basic install of Snort; additional features can be enabled. For more information on the details of configuring the various packages used with Snort, take a look at these sites: In addition to the above sites, you can subscribe to the Snort Users mailing list on the Snort Web site. This mailing list offers more specific help for your Snort installation. Another option for commercial-level support for Snort would be the Silicon Defense Web. Editorial disclaimer: The authors and editors have taken care in preparation of the content contained herein but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for any damages. Always have a verified backup before making any changes.
TechRepublic is the online community and
information resource for all IT professionals, from support staff to executives. We offer in-depth technical articles written
for IT professionals by IT professionals. In addition to articles on everything from Windows to e-mail to fire walls, we
offer IT industry analysis, downloads, management tips, discussion forums, and e-newsletters.
Copyright © 2009 CBS Interactive, a CBS Company. All Rights Reserved. |