Release 5.0.3 OISF
Total Page:16
File Type:pdf, Size:1020Kb
Suricata User Guide Release 5.0.3 OISF Apr 28, 2020 Contents 1 What is Suricata 1 1.1 About the Open Information Security Foundation............................1 2 Quickstart guide 3 2.1 Installation................................................3 2.2 Basic setup................................................3 2.3 Signatures................................................4 2.4 Running Suricata.............................................4 2.5 Alerting..................................................5 2.6 EVE Json.................................................5 3 Installation 7 3.1 Source..................................................7 3.2 Binary packages.............................................9 3.3 Advanced Installation..........................................9 4 Upgrading 11 4.1 General instructions........................................... 11 4.2 Upgrading 4.1 to 5.0........................................... 11 5 Command Line Options 13 5.1 Unit Tests................................................. 16 6 Suricata Rules 17 6.1 Rules Format............................................... 17 6.2 Meta Keywords.............................................. 22 6.3 IP Keywords............................................... 25 6.4 TCP keywords.............................................. 29 6.5 UDP keywords.............................................. 32 6.6 ICMP keywords............................................. 32 6.7 Payload Keywords............................................ 35 6.8 Transformations............................................. 53 6.9 Prefiltering Keywords.......................................... 55 6.10 Flow Keywords.............................................. 59 6.11 Bypass Keyword............................................. 64 6.12 HTTP Keywords............................................. 64 6.13 File Keywords.............................................. 85 i 6.14 DNS Keywords.............................................. 88 6.15 SSL/TLS Keywords........................................... 89 6.16 SSH Keywords.............................................. 93 6.17 JA3 Keywords.............................................. 95 6.18 Modbus Keyword............................................ 96 6.19 DNP3 Keywords............................................. 99 6.20 ENIP/CIP Keywords........................................... 101 6.21 FTP/FTP-DATA Keywords....................................... 102 6.22 Kerberos Keywords........................................... 103 6.23 SNMP keywords............................................. 105 6.24 Base64 keywords............................................. 106 6.25 SIP Keywords.............................................. 107 6.26 Generic App Layer Keywords...................................... 110 6.27 Xbits Keyword.............................................. 111 6.28 Thresholding Keywords......................................... 113 6.29 IP Reputation Keyword......................................... 115 6.30 Datasets.................................................. 116 6.31 Lua Scripting............................................... 119 6.32 Differences From Snort......................................... 120 7 Rule Management 131 7.1 Rule Management with Suricata-Update................................. 131 7.2 Adding Your Own Rules......................................... 133 7.3 Rule Reloads............................................... 134 8 Making sense out of Alerts 135 9 Performance 137 9.1 Runmodes................................................ 137 9.2 Packet Capture.............................................. 141 9.3 Tuning Considerations.......................................... 143 9.4 Hyperscan................................................ 145 9.5 High Performance Configuration.................................... 147 9.6 Statistics................................................. 153 9.7 Ignoring Traffic.............................................. 155 9.8 Packet Profiling.............................................. 157 9.9 Rule Profiling............................................... 157 9.10 Tcmalloc................................................. 158 10 Configuration 161 10.1 Suricata.yaml............................................... 161 10.2 Global-Thresholds............................................ 209 10.3 Snort.conf to Suricata.yaml....................................... 212 10.4 Multi Tenancy.............................................. 216 10.5 Dropping Privileges After Startup.................................... 220 11 Reputation 221 11.1 IP Reputation............................................... 221 12 Init Scripts 225 13 Setting up IPS/inline for Linux 227 13.1 Setting up IPS with Netfilter....................................... 227 13.2 Settings up IPS at Layer 2........................................ 231 ii 14 Setting up IPS/inline for Windows 233 15 Output 235 15.1 EVE................................................... 235 15.2 Lua Output................................................ 269 15.3 Syslog Alerting Compatibility...................................... 270 15.4 Custom http logging........................................... 272 15.5 Custom tls logging............................................ 273 15.6 Log Rotation............................................... 273 16 Lua support 275 16.1 Lua usage in Suricata........................................... 275 16.2 Lua functions............................................... 275 17 File Extraction 291 17.1 Architecture............................................... 291 17.2 Settings.................................................. 291 17.3 Output.................................................. 292 17.4 Rules................................................... 293 17.5 MD5................................................... 294 18 Public Data Sets 297 19 Using Capture Hardware 299 19.1 Endace DAG............................................... 299 19.2 Napatech................................................. 300 19.3 Myricom................................................. 306 19.4 eBPF and XDP.............................................. 307 19.5 Netmap.................................................. 317 20 Interacting via Unix Socket 321 20.1 Introduction............................................... 321 20.2 Commands in standard running mode.................................. 322 20.3 Commands on the cmd prompt...................................... 323 20.4 Pcap processing mode.......................................... 323 20.5 Build your own client.......................................... 324 21 3rd Party Integration 327 21.1 Symantec SSL Visibility (BlueCoat)................................... 327 22 Man Pages 329 22.1 Suricata.................................................. 329 22.2 Suricata Socket Control......................................... 333 22.3 Suricata Control............................................. 335 22.4 Suricata Control Filestore........................................ 336 23 Acknowledgements 339 24 Licenses 341 24.1 GNU General Public License...................................... 341 24.2 Creative Commons Attribution-NonCommercial 4.0 International Public License........... 345 24.3 Suricata Source Code.......................................... 350 24.4 Suricata Documentation......................................... 350 Index 351 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. 1.1 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. 1.1.1 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 5.0.3 2 Chapter 1. What is Suricata CHAPTER 2 Quickstart guide This guide will give you a quick start to run Suricata and will focus only on the basics. For more details read through the different more specific chapters. 2.1 Installation It’s assumed that you run a recent Ubuntu release as the official PPA can be used for the installation. Installation steps: sudo add-apt-repository ppa:oisf/suricata-stable sudo apt update sudo apt install suricata jq The dedicated PPA repository is added and after updating the index Suricata can be installed. It’s recommended to install the tool jq as well to work with the EVE Json output which is used later in this guide. For the installation on other systems or to use specific compile options see Installation. When the installation is done you can check what version of Suricata you have running and with what options as well as the service state: sudo suricata--build-info sudo systemctl status suricata 2.2 Basic setup You should check on which interface Suricata should be running and also the IP(s) of the interface: 3 Suricata User Guide, Release 5.0.3 ip a 2: enp1s0:<BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group ,!default qlen 1000 link/ether 00:11:22:33:44:55 brd ff:ff:ff:ff:ff:ff inet 10.0.0.23/24 brd 10.23.0.255 scope global noprefixroute enp1s0 Use that information to