Release 3.2Dev OISF
Total Page:16
File Type:pdf, Size:1020Kb
Suricata User Guide Release 3.2dev OISF Jun 07, 2017 Contents 1 What is Suricata 1 1.1 About the Open Information Security Foundation............................1 2 Installation 3 2.1 Source..................................................3 2.2 Binary packages.............................................4 2.3 Advanced Installation..........................................5 3 Command Line Options 7 3.1 Unit Tests.................................................9 4 Suricata Rules 11 4.1 Rules Introduction............................................ 11 4.2 Meta-settings............................................... 16 4.3 Header Keywords............................................ 20 4.4 Prefilter.................................................. 31 4.5 Payload Keywords............................................ 32 4.6 HTTP Keywords............................................. 51 4.7 Flow Keywords.............................................. 67 4.8 Flowint.................................................. 70 4.9 Xbits................................................... 72 4.10 File Keywords.............................................. 73 4.11 Rule Thresholding............................................ 75 4.12 DNS Keywords.............................................. 77 4.13 SSL/TLS Keywords........................................... 78 4.14 Modbus Keyword............................................ 81 4.15 DNP3 Keywords............................................. 82 4.16 ENIP/CIP Keywords........................................... 85 4.17 Generic App Layer Keywords...................................... 86 4.18 Lua Scripting............................................... 87 4.19 Normalized Buffers........................................... 88 4.20 Snort Compatibility........................................... 89 5 Rule Management 91 5.1 Rule Management with Oinkmaster................................... 91 5.2 Adding Your Own Rules......................................... 94 5.3 Rule Reloads............................................... 95 i 6 Making sense out of Alerts 97 7 Performance 99 7.1 Runmodes................................................ 99 7.2 Packet Capture.............................................. 100 7.3 Tuning Considerations.......................................... 102 7.4 Hyperscan................................................ 103 7.5 High Performance Configuration.................................... 105 7.6 Statistics................................................. 105 7.7 Ignoring Traffic.............................................. 108 7.8 Packet Profiling.............................................. 108 7.9 Rule Profiling............................................... 109 7.10 Tcmalloc................................................. 110 8 Configuration 111 8.1 Suricata.yaml............................................... 111 8.2 Global-Thresholds............................................ 152 8.3 Snort.conf to Suricata.yaml....................................... 155 8.4 Log Rotation............................................... 159 8.5 Multi Tenancy.............................................. 159 8.6 Dropping Privileges After Startup.................................... 162 9 Reputation 163 9.1 IP Reputation............................................... 163 10 Init Scripts 167 11 Setting up IPS/inline for Linux 169 11.1 Iptables configuration.......................................... 169 12 Output 173 12.1 EVE................................................... 173 12.2 Lua Output................................................ 181 12.3 Syslog Alerting Compatibility...................................... 191 12.4 Custom http logging........................................... 193 13 File Extraction 195 13.1 Architecture............................................... 195 13.2 Settings.................................................. 195 13.3 Output.................................................. 196 13.4 Rules................................................... 196 13.5 MD5................................................... 196 14 Public Data Sets 201 15 Using Capture Hardware 203 15.1 Endace DAG............................................... 203 15.2 Napatech Suricata Installation Guide.................................. 204 15.3 Myricom................................................. 207 16 Interacting via Unix Socket 211 16.1 Introduction............................................... 211 16.2 Commands in standard running mode.................................. 212 16.3 Commands on the cmd prompt...................................... 212 16.4 Pcap processing mode.......................................... 213 16.5 Build your own client.......................................... 214 ii 17 Man Pages 215 17.1 Suricata.................................................. 215 18 Acknowledgements 219 19 Licenses 221 19.1 GNU General Public License...................................... 221 19.2 Creative Commons Attribution-NonCommercial 4.0 International Public License........... 225 19.3 Suricata Source Code.......................................... 229 19.4 Suricata Documentation......................................... 230 iii iv CHAPTER 1 What is Suricata Suricata is a high performance Network IDS, IPS and Network Security Monitoring engine. It is open source and owned by a community-run non-profit foundation, the Open Information Security Foundation (OISF). Suricata is developed by the OISF. About the Open Information Security Foundation The Open Information Security Foundation is a non-profit foundation organized to build community and to support open-source security technologies like Suricata, the world-class IDS/IPS engine. License The Suricata source code is licensed under version 2 of the GNU General Public License. This documentation is licensed under the Creative Commons Attribution-NonCommercial 4.0 International Public License. 1 Suricata User Guide, Release 3.2dev 2 Chapter 1. What is Suricata CHAPTER 2 Installation Before Suricata can be used it has to be installed. Suricata can be installed on various distributions using binary packages: Binary packages. For people familiar with compiling their own software, the Source method is recommended. Advanced users can check the advanced guides, see Advanced Installation. Source Installing from the source distribution files gives the most control over the Suricata installation. Basic steps: tar xzvf suricata-3.2beta1.tar.gz cd suricata-3.2beta1 ./configure make make install This will install Suricata into /usr/local/bin/, use the default configuration in /usr/local/etc/ suricata/ and will output to /usr/local/var/log/suricata Common configure options --disable-gccmarch-native Do not optimize the binary for the hardware it is built on. Add this flag if the binary is meant to be portable or if Suricata is to be used in a VM. --prefix=/usr/ Installs the Suricata binary into /usr/bin/. Default /usr/local/ --sysconfdir=/etc Installs the Suricata configuration files into /etc/suricata/. Default /usr/local/etc/ 3 Suricata User Guide, Release 3.2dev --localstatedir=/var Setups Suricata for logging into /var/log/suricata/. Default /usr/local/var/log/suricata --enable-lua Enables Lua support for detection and output. --enable-geopip Enables GeoIP support for detection. Dependencies For Suricata’s compilation you’ll need the following libraries and their development headers installed: libpcap, libpcre, libmagic, zlib, libyaml The following tools are required: make gcc (or clang) pkg-config For full features, also add: libjansson, libnss, libgeoip, liblua5.1, libhiredis Ubuntu/Debian Minimal: apt-get install libpcre3 libpcre3-dbg libpcre3-dev build-essential libpcap-dev \ libyaml-0-2 libyaml-dev pkg-config zlib1g zlib1g-dev \ make libmagic-dev Recommended: apt-get install libpcre3 libpcre3-dbg libpcre3-dev build-essential libpcap-dev \ libnet1-dev libyaml-0-2 libyaml-dev pkg-config zlib1g zlib1g-dev \ libcap-ng-dev libcap-ng0 make libmagic-dev libjansson-dev \ libnss3-dev libgeoip-dev liblua5.1-dev libhiredis-dev Extra for iptables/nftables IPS integration: apt-get install libnetfilter-queue-dev libnetfilter-queue1 \ libnetfilter-log-dev libnetfilter-log1 \ libnfnetlink-dev libnfnetlink0 Binary packages Ubuntu For Ubuntu, the OISF maintains a PPA suricata-stable that always contains the latest stable release. To use it: sudo add-apt-repository ppa:oisf/suricata-stable sudo apt-get update sudo sudo apt-get install suricata 4 Chapter 2. Installation Suricata User Guide, Release 3.2dev Debian In Debian Jessie Suricata is out of date, but an updated version is in Debian Backports. As root do: echo"deb http://http.debian.net/debian jessie-backports main">\ /etc/apt/sources.list.d/backports.list apt-get update apt-get install suricata-t jessie-backports Fedora dnf install suricata RHEL/CentOS For RedHat Enterprise Linux 7 and CentOS 7 the EPEL repository can be used. yum install epel-release yum install suricata Advanced Installation Various installation guides for installing from GIT and for other operating systems are maintained at: https://redmine. openinfosecfoundation.org/projects/suricata/wiki/Suricata_Installation 2.3. Advanced Installation 5 Suricata User Guide, Release 3.2dev 6 Chapter 2. Installation CHAPTER 3 Command Line Options Suricata’s command line options: -h Display a brief usage overview. -V Displays the version of Suricata. -c <path> Path to configuration file. -T Test configuration. -v The -v option enables more verbosity of Suricata’s output. Supply