Protecting your network with the Suricata intrusion detection system
Guard on Duty
Snort isn't the only free intrusion detection tool in the barnyard. We'll show you a powerful and promising alternative known as Suricata.
When most Linux users think of an open source IDS/IPS (intrusion detection|prevention system), they think of Snort. But Linux users have another option for intrusion detection and prevention: Suricata [1]. Suricata is developed by the Open Information Security Foundation (OISF), which is tasked "to build a next generation IDS/IPS engine." The funding for the OISF comes from several US government agencies and private firms, but since Suricata is licensed under the common "GPLv2 and later" license, it is true open source and also freely available.
Why Suricata?
Why choose Suricata instead of Snort? Suricata uses Snort-compatible rulesets, which is good for compatibility, but if you're already using Snort rulesets, why not just use Snort? For one thing, Suricata is multithreaded, meaning it can easily take advantage of multiple cores, so you can more easily examine large volumes of traffic without having to make sacrifices like reducing the number of rules. Suricata can also do protocol inspection, so you don't have to rely on port numbers to identify traffic – you can easily examine HTTP traffic no matter what port it is on. Suricata also allows you to look inside of the protocol streams and extract the files, so they can then be examined. You can also block files based on their MD5 signature (more on this later). Suricata also allows you to examine TSL/SSL certificates and match them based on their fingerprints (a SHA1 hash of the certificate typically), so even if you can't intercept the TLS/SSL connection, you can still exert some control over it. However the main advantage of Suricata over Snort is that it isn't Snort. Don't get me wrong, Snort is awesome and I really like it, but Snort is also showing its age and some of the design decisions are less than optimal in the modern world (e.g., 10Gb Ethernet is cheap now) – things that Suricata addresses. Note: The latest version of Snort addresses some of these problems – see the article on Snort elsewhere in this issue.
Suricata Install
The three primary options for installing Suricata [2] are from a package, from a source tarball, and from Git. I would only recommend using the Git version if you are a developer or need access to some bleeding-edge feature that hasn't yet made it into a release tarball. The package installation is less than optimal; at the time of this writing, Debian has a really old version of Suricata (1.2, current is 2.0.2), so unless you can get at least version 2.0.x, I would recommend installing from the release tarball. But first you're going to need some build dependencies: libpcap-devel
, libnet-devel
, pcre-devel
, libyaml-devel
, zlib-devel
, libcap-ng-devel
, and file-devel
. If you want to use the IPS mode to block attacks, you're also going to need libnfnetlink-devel
and libnetfilter_queue-devel
(on RHEL and CentOS you can find these in EPEL). Then, grab the tarball and execute the usual configure, make, and make install:
wget http://www.openinfosecfoundation.org/download/suricata-2.0.2.tar.gz tar -xvzf suricata-2.0.2.tar.gz cd suricata-2.0.2 ./configure --enable-nfqueue --prefix=/usr --sysconfdir=/etc --localstatedir=/var make sudo make install sudo ldconfig
You also have some options when installing; by using make install-conf
, you can install the configuration files into /etc/
, the make install-rules
command will get the latest emerging threat rules from Suricata and install them, and make install-full
will do both. You'll then need to create the Suricata log directory:
sudo mkdir /var/log/suricata
At this point, you might also need to get the Snort rules – more on this later.
Suricata Configuration
Configuring Suricata is a lot like configuring Snort, except with even more options. The primary configuration file is /etc/suricata/suricata.yaml
, with several sections you'll certainly want to configure, including outputs
(logging and output of data), vars
(variables), and host-os-policy
(allows you to specify the IP/network of operating systems, which helps Suricata determine how best to defragment and reassemble the TCP stream). Your choice of output log will largely depend on how you want to process the data (if at all). The vars
section allows you to specify various network and service configurations (such as your DNS, SMTP, and SQL servers), which are used by various signatures. The cuda
section even allows you to configure a GPU to accelerate Suricata.
The final section is the app-layer
configuration. Suricata understands a wide variety of protocols, and you have the option of detecting the traffic only, detecting and parsing the traffic, and not detecting or parsing it (e.g., you might want to ignore DNS traffic since you can easily log and firewall it).
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
The Gnome Foundation Struggling to Stay Afloat
The foundation behind the Gnome desktop environment is having to go through some serious belt-tightening due to continued financial problems.
-
Thousands of Linux Servers Infected with Stealth Malware Since 2021
Perfctl is capable of remaining undetected, which makes it dangerous and hard to mitigate.
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.
-
OSI and LPI Form Strategic Alliance
With a goal of strengthening Linux and open source communities, this new alliance aims to nurture the growth of more highly skilled professionals.
-
Fedora 41 Beta Available with Some Interesting Additions
If you're a Fedora fan, you'll be excited to hear the beta version of the latest release is now available for testing and includes plenty of updates.
-
AlmaLinux Unveils New Hardware Certification Process
The AlmaLinux Hardware Certification Program run by the Certification Special Interest Group (SIG) aims to ensure seamless compatibility between AlmaLinux and a wide range of hardware configurations.
-
Wind River Introduces eLxr Pro Linux Solution
eLxr Pro offers an end-to-end Linux solution backed by expert commercial support.
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.