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
-
New Steam Client Ups the Ante for Linux
The latest release from Steam has some pretty cool tricks up its sleeve.
-
Gnome OS Transitioning Toward a General-Purpose Distro
If you're looking for the perfectly vanilla take on the Gnome desktop, Gnome OS might be for you.
-
Fedora 41 Released with New Features
If you're a Fedora fan or just looking for a Linux distribution to help you migrate from Windows, Fedora 41 might be just the ticket.
-
AlmaLinux OS Kitten 10 Gives Power Users a Sneak Preview
If you're looking to kick the tires of AlmaLinux's upstream version, the developers have a purrfect solution.
-
Gnome 47.1 Released with a Few Fixes
The latest release of the Gnome desktop is all about fixing a few nagging issues and not about bringing new features into the mix.
-
System76 Unveils an Ampere-Powered Thelio Desktop
If you're looking for a new desktop system for developing autonomous driving and software-defined vehicle solutions. System76 has you covered.
-
VirtualBox 7.1.4 Includes Initial Support for Linux kernel 6.12
The latest version of VirtualBox has arrived and it not only adds initial support for kernel 6.12 but another feature that will make using the virtual machine tool much easier.
-
New Slimbook EVO with Raw AMD Ryzen Power
If you're looking for serious power in a 14" ultrabook that is powered by Linux, Slimbook has just the thing for you.
-
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.