[Day 2] 2. SNORT Setup
Basic Command Syntax
shellsnort -i 4 -c C:\Snort\etc\snort.conf -l C:\Snort\log -A console
Explanation of Parameters
- : Launches SNORT.
snort - : Specifies the interface to use (e.g.,
-iis the interface number).4 - : Specifies the path to the configuration file (e.g.,
-c).C:\Snort\etc\snort.conf - : Specifies the path to the log folder (e.g.,
-l).C:\Snort\log - : Specifies the alert mode (
-Aoutputs alerts directly to the console).console
Location of snort.conf
snort.confThe configuration file is located at:
plaintextC:\Snort\etc\snort.conf
Common Errors and Their Solutions
1. First Error: ipvar
ipvarCause:
The
ipvarvarSolution:
- Open and use the find-and-replace function.
snort.conf - Replace all occurrences of with
ipvar.var - Ensure exactly 11 occurrences are replaced.
- Save the configuration file and rerun the command.
2. Second Error: snort_dynamicpreprocessor
snort_dynamicpreprocessorCause:
The error shows a Linux-style file path for dynamic preprocessors, but we are working on Windows.
Solution:
- Navigate to .
C:\Snort\lib\dynamic_preprocessor - You’ll find 14 files in this folder.
- Open and update the paths to Windows-style paths.
snort.conf - Replace the existing Linux-style paths with the following (around line 248):
plaintextdynamic_preprocessor C:\Snort\lib\dynamic_preprocessor\sf_dce2.dll dynamic_preprocessor C:\Snort\lib\dynamic_preprocessor\sf_dnp3.dll dynamic_preprocessor C:\Snort\lib\dynamic_preprocessor\sf_dns.dll dynamic_preprocessor C:\Snort\lib\dynamic_preprocessor\sf_ftptelnet.dll dynamic_preprocessor C:\Snort\lib\dynamic_preprocessor\sf_gtp.dll dynamic_preprocessor C:\Snort\lib\dynamic_preprocessor\sf_imap.dll dynamic_preprocessor C:\Snort\lib\dynamic_preprocessor\sf_modbus.dll dynamic_preprocessor C:\Snort\lib\dynamic_preprocessor\sf_pop.dll dynamic_preprocessor C:\Snort\lib\dynamic_preprocessor\sf_reputation.dll dynamic_preprocessor C:\Snort\lib\dynamic_preprocessor\sf_sdf.dll dynamic_preprocessor C:\Snort\lib\dynamic_preprocessor\sf_sip.dll dynamic_preprocessor C:\Snort\lib\dynamic_preprocessor\sf_smtp.dll dynamic_preprocessor C:\Snort\lib\dynamic_preprocessor\sf_ssh.dll dynamic_preprocessor C:\Snort\lib\dynamic_preprocessor\sf_ssl.dll
- Save the changes and rerun the command.
Tip:
To quickly list all filenames, use the following in
cmdshelldir /b
3. Third Error: snort_dynamicengine
snort_dynamicengineCause:
The
snort_dynamicengineSolution:
- Navigate to the folder .
C:\Snort\lib\snort_dynamicengine - Update the file with the correct path (around line 265):
snort.conf
plaintextdynamicengine C:\Snort\lib\snort_dynamicengine\sf_engine.dll
- Save the changes and rerun the command.
4. Fourth Error: snort_dynamicrules
snort_dynamicrulesCause:
The folder for
snort_dynamicrulesSolution:
- Create a folder named in
snort_dynamicrules.C:\Snort\lib - Update the file with the following (around line 268):
snort.conf
plaintextdynamicdetection C:\Snort\lib\snort_dynamicrules
- Save the changes and rerun the command.
5. Fifth Error: normalize_ip4
normalize_ip4Cause:
SNORT is set up for IDS mode by default, but the
normalize_ip4Solution:
- Open and search for
snort.conf.normalize_ip4 - Comment out all lines containing (around line 280).
normalize - Save the file and rerun the command.
6. Sixth Error: Missing white_list.rules
white_list.rulesCause:
The
white_list.rulesSolution:
- Create an empty text file named in the
white_list.rulesfolder.C:\Snort\rules - Ensure file extensions are visible to confirm the extension.
.rules - No changes are required in .
snort.conf - Save and rerun the command.
7. Seventh Error: Missing black_list.rules
black_list.rulesCause:
The
black_list.rulesSolution:
- Create an empty text file named in the
black_list.rulesfolder.C:\Snort\rules - Ensure file extensions are visible to confirm the extension.
.rules - No changes are required in .
snort.conf - Save and rerun the command.
After addressing all the errors, SNORT should work without issues.
To prevent future errors, we will be making some more changes in order to avoid further errors.
Change 1: Update Rule Paths
Update the rule paths in the configuration file from (around line 104):
plaintextvar RULE_PATH ../rules var SO_RULE_PATH ../so_rules var PREPROC_RULE_PATH ../preproc_rules
To:
plaintextvar RULE_PATH C:\Snort\rules var SO_RULE_PATH C:\Snort\so_rules var PREPROC_RULE_PATH C:\Snort\preproc_rules
Change 2: Update Whitelist and Blacklist Paths
Modify the paths for the whitelist and blacklist from (around line 113):
plaintextvar WHITE_LIST_PATH ../rules var BLACK_LIST_PATH ../rules
To:
plaintextvar WHITE_LIST_PATH ..\rules var BLACK_LIST_PATH ..\rules
Change 3: Update Whitelist and Blacklist File References
Update the references to whitelist and blacklist files from (around line 525):
plaintextwhitelist $WHITE_LIST_PATH/white_list.rules, \ blacklist $BLACK_LIST_PATH/black_list.rules
To:
plaintextwhitelist $WHITE_LIST_PATH\white_list.rules, \ blacklist $BLACK_LIST_PATH\black_list.rules
Change 4: Include Blacklist Rules
Correct the inclusion of the blacklist rules in the configuration file (around line 575):
plaintextinclude $RULE_PATH/blacklist.rules
To:
plaintextinclude $RULE_PATH/black_list.rules
Testing the Configuration File
Once all the changes are made, test the configuration file for errors using the following command:
shellsnort -i 4 -c c:\Snort\etc\snort.conf -l c:\Snort\log -T
Explanation of the Command:
- : Specifies the interface to use (e.g.,
-i 4is the interface number).4 - : Specifies the path to the configuration file.
-c c:\Snort\etc\snort.conf - : Specifies the path to the log folder.
-l c:\Snort\log - : Enables testing mode to verify the configuration file.
-T
Read Next
[Day 2] 3. SNORT Rules
### **Writing a SNORT Rule** - To create a rule, start with an empty text file and write the rule in it. - Each rule is separated by a space. - T...
[Day 2] 4. Network Adapters in VMWare
VMware provides several types of virtual network adapters, each with distinct behaviors for connecting virtual machines (VMs) to each other, the host...