### Doc/Userguide/3rd Party Integration/Symantec Sslv Symantec SSL Visibility (BlueCoat) ================================== As Suricata itself cannot decrypt SSL/TLS traffic, some organizations use a decryption product to handle this. This document will offer some advice on using Suricata with the Symantec SSL Visibility appliance (formerly known as BlueCoat). Appliance Software Version -------------------------- The appliance comes with two major software version options. The 3.x and 4.x series. Suricata works best with the 4.x series. TLS1.3 is only properly supported in the 4.x version of the appliance software. Magic Markers ------------- The appliance has an indicator that data is decrypted. This is done using a special magic source MAC address, or using a special VLAN header. Since Suricata can use VLANs as part of flow tracking, it is recommended to use the source MAC method. In the 3.x version of the software these markers are always there, the config just allows setting which type will be used. In the 4.x software the markers are optional. TCP handling ------------ In the 3.x software, a bit of care is required in TCP stream reassembly handling in Suricata. The decrypted traffic is presented to the IDS as TCP data packets, that are not ack'd as regularly as would be expected in a regular TCP session. A large TCP window is used to not violate the TCP specs. Since in IDS mode Suricata waits for ACKs for much of its processing, this can lead to delays in detection and logging, as well as increased resource usage due to increased data buffering. To avoid this, enable the 'stream.inline' mode, which processed data segments as they come in without waiting for the ACKs. The 4.x software sends more regular ACKs and does not need any special handling on the Suricata side. TLS matching in Suricata ------------------------ The appliance takes care of the TLS handling and decryption, presenting only the decrypted data to Suricata. This means that Suricata will not see the TLS handshake. As a consequence of this, Suricata cannot inspect the TLS handshake or otherwise process it. This means that for decrypted TLS sessions, Suricata will not do any TLS keyword inspection (such as fingerprint matching and ja3), TLS logging or TLS certificate extraction. If it is important to match on and/or log such information as well, the appliance facilities for matching and logging themselves will have to be used. For TLS traffic where the appliance security policy does not lead to decryption of the traffic, the TLS handshake is presented to Suricata for analysis and logging. IPS --- When using Suricata in IPS mode with the appliance, some things will have to be considered: * if Suricata DROPs a packet in the decrypted traffic, this will be seen by the appliance after which it will trigger a RST session teardown. * if a packet takes more than one second to process, it will automatically be considered a DROP by the appliance. This should not happen in normal traffic, but with very inefficient Lua scripts this could perhaps happen. The appliance can also be configured to wait for 5 seconds. * When using the Suricata 'replace' keyword to modify data, be aware that the 3.x appliance software will not pass the modification on to the destination so this will not have any effect. The 4.x appliance software does support passing on modifications that were made to the unencrypted text, by default this feature is disabled but you can enable it if you want modifications to be passed on to the destination in the re-encrypted stream. Due to how Suricata works, the size of the payloads cannot be changed. --- ### Doc/Userguide/Appendix/Eve Schema EVE JSON Schema ############### The Suricata source distribution contains a JSON schema for the EVE log files. This schema follows the `JSON Schema `_ specification and can be found in ``etc/schema.json``. If your distribution does not contain this file, it can be viewed online at https://github.com/OISF/suricata/blob/main/etc/schema.json, but note that it is version-specific and may change between major versions of Suricata. This schema attempts to log all possible fields that may be seen in Suricata's **EVE** output, including their datatype. It also includes extensions to help map log fields to related detection keywords. Suricata Schema Extensions ^^^^^^^^^^^^^^^^^^^^^^^^^^ We have extended JSON schema with a ``suricata`` object to add extra Suricata context such as detection keywords related to a log field, for example: .. code-block:: json "rrname": { "type": "string", "suricata": { "keywords": [ "dns.answers.rrname", "dns.response.rrname" ] } } The above shows that a field named ``rrname`` has 2 keywords that are related. Please refer to the keyword documentation to see precisely how they are used and related to the field being logged. Extension Reference =================== The ``suricata`` extension object is valid on objects inside the ``properties`` object. The ``suricata`` object may accept the following fields: ``keywords`` ------------ **Type:** ``array`` or ``boolean`` * **When an array:** Contains keyword names that are related to this JSON property. Each keyword in the array represents a detection rule keyword that can be used to match against the corresponding field value. * **When ``false``:** Indicates that this JSON property has no applicable keyword. This is used for metadata fields that don't correspond to actual network data. For example, the ``version`` field inside a DNS object denotes the version of the log format and is unrelated to any aspect of a DNS message, therefore no keyword is applicable. .. note:: As of Suricata 8.0, mapping log fields to detection keywords is a work in progress. Any field that does not have a ``suricata.keywords`` value still needs to be evaluated. Schema Tooling ^^^^^^^^^^^^^^ * `Suricata-Verify `_: Our own tool for verifying every Suricata pull request, validates all EVE logs generated against the schema. * ``./scripts/eve-parity.py``: Found inside the Suricata source code when checked out with ``git``, is a tool to provide information on how log fields map to keywords, or how keywords map to log entries. * ``./scripts/evedoc.py``: Generate documentation from the schema, such as the :doc:`eve-index` included in this documentation. --- ### Doc/Userguide/Capture Hardware/Af Packet .. _afpacket: AF_PACKET ######### Introduction ************ AF_PACKET is a capture interface to the Linux Kernel. Config Options ************** enable-hwtimestamp ================== Boolean option to enable hardware timestamping on an interface. By default the hardware timestamping support is disabled. Hardware timestamping can lead to issue of the NIC and kernel getting out of sync. See `ticket 7585 `_. :: af-packet: - interface: eth0 cluster-id: 99 enable-hwtimestamp: true cluster-type: cluster_flow --- ### Doc/Userguide/Capture Hardware/Af Xdp AF_XDP ====== AF_XDP (eXpress Data Path) is a high speed capture framework for Linux that was introduced in Linux v4.18. AF_XDP aims at improving capture performance by redirecting ingress frames to user-space memory rings, thus bypassing the network stack. Note that during ``af_xdp`` operation the selected interface cannot be used for regular network usage. Further reading: - https://www.kernel.org/doc/html/latest/networking/af_xdp.html Compiling Suricata ------------------ Linux ~~~~~ libxdp and libpbf are required for this feature. When building from source the development files will also be required. Example:: dnf -y install libxdp-devel libbpf-devel This feature is enabled provided the libraries above are installed, the user does not need to add any additional command line options. The command line option ``--disable-af-xdp`` can be used to disable this feature. Example:: ./configure --disable-af-xdp Starting Suricata ----------------- IDS ~~~ Suricata can be started as follows to use af-xdp: :: af-xdp: suricata --af-xdp= suricata --af-xdp=igb0 In the above example Suricata will start reading from the `igb0` network interface. AF_XDP Configuration -------------------- Each of these settings can be configured under ``af-xdp`` within the "Configure common capture settings" section of suricata.yaml configuration file. The number of threads created can be configured in the suricata.yaml configuration file. It is recommended to use threads equal to NIC queues/CPU cores. Another option is to select ``auto`` which will allow Suricata to configure the number of threads based on the number of RSS queues available on the NIC. With ``auto`` selected, Suricata spawns receive threads equal to the number of configured RSS queues on the interface. :: af-xdp: threads: threads: auto threads: 8 Advanced setup --------------- af-xdp capture source will operate using the default configuration settings. However, these settings are available in the suricata.yaml configuration file. Available configuration options are: force-xdp-mode ~~~~~~~~~~~~~~ There are two operating modes employed when loading the XDP program, these are: - XDP_DRV: Mode chosen when the driver supports AF_XDP - XDP_SKB: Mode chosen when no AF_XDP support is unavailable XDP_DRV mode is the preferred mode, used to ensure best performance. :: af-xdp: force-xdp-mode: where: value = force-xdp-mode: drv force-bind-mode ~~~~~~~~~~~~~~~ During binding the kernel will first attempt to use zero-copy (preferred). If zero-copy support is unavailable it will fallback to copy mode, copying all packets out to user space. :: af-xdp: force-bind-mode: where: value = force-bind-mode: zero For both options, the kernel will attempt the 'preferred' option first and fallback upon failure. Therefore the default (none) means the kernel has control of which option to apply. By configuring these options the user is forcing said option. Note that if enabled, the bind will only attempt this option, upon failure the bind will fail i.e. no fallback. mem-unaligned ~~~~~~~~~~~~~~~~ AF_XDP can operate in two memory alignment modes, these are: - Aligned chunk mode - Unaligned chunk mode Aligned chunk mode is the default option which ensures alignment of the data within the UMEM. Unaligned chunk mode uses hugepages for the UMEM. Hugepages start at the size of 2MB but they can be as large as 1GB. Lower count of pages (memory chunks) allows faster lookup of page entries. The hugepages need to be allocated on the NUMA node where the NIC and CPU resides. Otherwise, if the hugepages are allocated only on NUMA node 0 and the NIC is connected to NUMA node 1, then the application will fail to start. Therefore, it is recommended to first find out to which NUMA node the NIC is connected to and only then allocate hugepages and set CPU cores affinity to the given NUMA node. Memory assigned per socket/thread is 16MB, so each worker thread requires at least 16MB of free space. As stated above hugepages can be of various sizes, consult the OS to confirm with ``cat /proc/meminfo``. Example :: 8 worker threads * 16Mb = 128Mb hugepages = 2048 kB so: pages required = 62.5 (63) pages See https://www.kernel.org/doc/Documentation/vm/hugetlbpage.txt for detailed description. To enable unaligned chunk mode: :: af-xdp: mem-unaligned: mem-unaligned: yes Introduced from Linux v5.11 a ``SO_PREFER_BUSY_POLL`` option has been added to AF_XDP that allows a true polling of the socket queues. This feature has been introduced to reduce context switching and improve CPU reaction time during traffic reception. Enabled by default, this feature will apply the following options, unless disabled (see below). The following options are used to configure this feature. enable-busy-poll ~~~~~~~~~~~~~~~~ Enables or disables busy polling. :: af-xdp: enable-busy-poll: enable-busy-poll: yes busy-poll-time ~~~~~~~~~~~~~~ Sets the approximate time in microseconds to busy poll on a ``blocking receive`` when there is no data. :: af-xdp: busy-poll-time: