In this lab the soc will teach you how to install and setup snort on your device, how to foward those logs to your Splunk server, and the basic ruleset of snort
You have 2 options for this lab. To follow along this lab you can either use the SDC cloud or use your local machine to build the lab. I recommend the SDC cloud as it is simpler than trying to install your own virtual machine on your own computer.
This lab assumes that you completed the Splunk lab and have atleast the basic understanding of how to set up the forwarders.
This lab takes place in Ubuntu if you use another Linux distro, it might be different
Snort works best on Ubuntu.
Let's start by installing it on bash.
sudo apt-get install snort -y
Run the command above to install Snort. This uses apt-get
, the Ubuntu package manager, to automatically download and install Snort with a yes
flag (-y
).
Once Snort is installed, you'll need to configure the network interface.
In this example, we'll use the IP address 10.128.69.150
for the lab.
Set your network interface IP to {YOUR IP ADDRESS}
.
ifconfig
or
ip addr
{YOUR ADDRESS}/24
which encompasses the subnet.Turn on promiscuous mode for Snort to detect traffic.
sudo ip link set {YOUR INTERFACE} promisc on
You will now need to edit Snort's configuration file and insert the ip address of your snort server
ipvar HOME_NET any
ipvar HOME_NET {THE SERVERS IP ADDRESS}
After editing, let's test the configuration.
sudo snort -T -i ens33 -c /etc/snort/snort.conf
Now, let’s create a local rule for Snort to trigger an alert.
sudo nano /etc/snort/rules/local.rules
Create a rule to detect an ICMP ping:
alert icmp any any -> $HOME_NET any (msg: "ICMP Ping Detected"; sid: 100001; rev:1;)
Now let’s run Snort with the rule you just created.
sudo snort -q -l /var/log/snort -i ens33 -A console -c /etc/snort/snort.conf
To test the rule, you can try pinging the configured IP from another machine:
ping 10.128.69.150
Now, we will forward Snort logs to Splunk using a Splunk universal forwarder.
cd /opt/splunkforwarder/bin
sudo ./splunk add monitor /var/log/snort/alert
Edit the Splunk configuration file to include the proper inputs.
sudo -i
cd /opt/splunkforwarder/etc/apps/search/local
nano inputs.conf
[splunktcp://9997]
connection_host = <Splunk_IP_Address>
[monitor:///var/log/snort/alert]
disabled = false
index = snort
sourcetype = snort_alert_full
source = snort
Now you’ve successfully set up Snort, created a local rule, and forwarded logs to Splunk! Create your own rulesets and learn how to get more out of it!
wrote by
bruhberto ^-^