]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
7 years agomodbus: duplicate alerts unaware of direction 3230/head
David DIALLO [Wed, 7 Feb 2018 23:20:09 +0000 (00:20 +0100)] 
modbus: duplicate alerts unaware of direction

Remove DetectAppLayerInspectEngineRegister for TOCLIENT direction
because Modbus inspection engine is only performing in request (TOSERVER).

Detect Value keyword in read access rule. In read access, match on value
is not possible.

Update Modbus keyword documentation.

7 years agorust: update 'external' api for app layer changes
Pierre Chifflier [Thu, 8 Feb 2018 18:41:49 +0000 (19:41 +0100)] 
rust: update 'external' api for app layer changes

Remove unused HasTxDetectState function and remove state argument
from SetTxDetectState.

Update NTP code.

7 years agoconf/yaml: don't allow empty key values
Jason Ish [Wed, 7 Feb 2018 21:11:54 +0000 (15:11 -0600)] 
conf/yaml: don't allow empty key values

When loading an empty file, libyaml will fire a single scalar
event causing us to create a key that contains an empty string.
We're not interested in this, so skip an empty scalar value
when expecting a key.

Redmine issue:
https://redmine.openinfosecfoundation.org/issues/2418

7 years agometadata: fix parsing when not k/v
Jason Ish [Mon, 5 Feb 2018 21:34:09 +0000 (15:34 -0600)] 
metadata: fix parsing when not k/v

Allows for parsing metadata with mixed single word and key/val
pairs.

7 years agorust/dns: simplify tx freeing 3223/head
Victor Julien [Tue, 6 Feb 2018 10:24:50 +0000 (11:24 +0100)] 
rust/dns: simplify tx freeing

Now that we no longer need the state when freeing a TX, we can simply
do cleanup from the Drop trait.

7 years agoapp-layer: remove unused HasTxDetectState call
Victor Julien [Tue, 6 Feb 2018 10:12:56 +0000 (11:12 +0100)] 
app-layer: remove unused HasTxDetectState call

Also remove the now useless 'state' argument from the SetTxDetectState
calls. For those app-layer parsers that use a state == tx approach,
the state pointer is passed as tx.

Update app-layer parsers to remove the unused call and update the
modified call.

7 years agonfs: remove old test code
Victor Julien [Tue, 6 Feb 2018 09:35:05 +0000 (10:35 +0100)] 
nfs: remove old test code

7 years agoapp-layer: add tx iterator API
Victor Julien [Wed, 31 Jan 2018 14:58:21 +0000 (15:58 +0100)] 
app-layer: add tx iterator API

Until now, the transaction space is assumed to be terse. Transactions
are handled sequentially so the difference between the lowest and highest
active tx id's is small. For this reason the logic of walking every id
between the 'minimum' and max id made sense. The space might look like:

    [..........TTTT]

Here the looping starts at the first T and loops 4 times.

This assumption isn't a great fit though. A protocol like NFS has 2 types
of transactions. Long running file transfer transactions and short lived
request/reply pairs are causing the id space to be sparse. This leads to
a lot of unnecessary looping in various parts of the engine, but most
prominently: detection, tx house keeping and tx logging.

    [.T..T...TTTT.T]

Here the looping starts at the first T and loops for every spot, even
those where no tx exists anymore.

Cases have been observed where the lowest tx id was 2 and the highest
was 50k. This lead to a lot of unnecessary looping.

This patch add an alternative approach. It allows a protocol to register
an iterator function, that simply returns the next transaction until
all transactions are returned. To do this it uses a bit of state the
caller must keep.

The registration is optional. If no iterator is registered the old
behaviour will be used.

7 years agodoc: improve eBPF and XDP doc
Eric Leblond [Fri, 2 Feb 2018 20:39:14 +0000 (21:39 +0100)] 
doc: improve eBPF and XDP doc

Remove reference to `buggy` clang as a workaround has been found in
libbpf.

Proof read and add information on the structure of eBPF code.

7 years agoutil-ebpf: rename local variable
Eric Leblond [Wed, 31 Jan 2018 20:20:52 +0000 (21:20 +0100)] 
util-ebpf: rename local variable

7 years agoaf-packet: count only CPUs once
Eric Leblond [Wed, 31 Jan 2018 20:12:59 +0000 (21:12 +0100)] 
af-packet: count only CPUs once

7 years agodoc: update documentation
Eric Leblond [Fri, 26 Jan 2018 09:14:44 +0000 (10:14 +0100)] 
doc: update documentation

This patch adds info on kernel requirement for XDP and rework a few
things.

7 years agoebpf: allow modified build of xdp_filter
Eric Leblond [Fri, 26 Jan 2018 09:11:56 +0000 (10:11 +0100)] 
ebpf: allow modified build of xdp_filter

Using BUILD_CPUMAP constant will allow user to use XDP bypass on
kernel prior to 4.15.

7 years agoebpf: improve xdp-cpu-redirect distribution in xdp_filter.c
Jesper Dangaard Brouer [Thu, 25 Jan 2018 19:24:38 +0000 (20:24 +0100)] 
ebpf: improve xdp-cpu-redirect distribution in xdp_filter.c

The XDP CPU destination array/set, configured via xdp-cpu-redirect,
will always be fairly small.  My different benchmarking showed that
the current modulo hashing into the CPU array can easily result in bad
distribution, expecially if the number of CPU is an even number.

This patch uses a proper hashing function on the input key. The key
used for hashing is inspired by the ippair hashing code in
src/tmqh-flow.c, and is based on the IP src + dst.

An important property is that the hashing is flow symmetric, meaning
that if the source and destintation gets swapped then the selected CPU
will remain the same.  This is important for Suricate.

That hashing INITVAL (15485863 the 10^6th prime number) was fairly
arbitrary choosen, but experiments with kernel tree pktgen scripts
(pktgen_sample04_many_flows.sh +pktgen_sample05_flow_per_thread.sh)
showed this improved the distribution.

Signed-off-by: Jesper Dangaard Brouer <netoptimizer@brouer.com>
7 years agoebpf: add Paul Hsieh's (LGPL 2.1) hash function SuperFastHash
Jesper Dangaard Brouer [Thu, 25 Jan 2018 19:24:33 +0000 (20:24 +0100)] 
ebpf: add Paul Hsieh's (LGPL 2.1) hash function SuperFastHash

Adjusted function call API to take an initval. This allow the API
user to set the initial value, as a seed. This could also be used for
inputting the previous hash.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
7 years agodoc: how to get live info about ebpf behavior
Eric Leblond [Wed, 17 Jan 2018 15:59:23 +0000 (16:59 +0100)] 
doc: how to get live info about ebpf behavior

7 years agounix-socket: add ebpf-bypassed-stats command
Eric Leblond [Wed, 17 Jan 2018 02:45:01 +0000 (03:45 +0100)] 
unix-socket: add ebpf-bypassed-stats command

This command output the count of element in IPv4 and IPv6 flow
table of interfaces using eBPF/XDP bypass.

7 years agounix-socket: add bypassed counter to iface-stat
Eric Leblond [Wed, 17 Jan 2018 02:28:20 +0000 (03:28 +0100)] 
unix-socket: add bypassed counter to iface-stat

7 years agoutil-ebpf: add bypassed counters
Eric Leblond [Wed, 17 Jan 2018 02:24:58 +0000 (03:24 +0100)] 
util-ebpf: add bypassed counters

Use LiveDevice bypassed counter and also add hash size counters
for the v4 and v6 flow table.

7 years agoebpf: maintain a copy of kernel UAPI header file linux/bpf.h
Jesper Dangaard Brouer [Mon, 15 Jan 2018 18:31:27 +0000 (19:31 +0100)] 
ebpf: maintain a copy of kernel UAPI header file linux/bpf.h

7 years agoebpf: fix detection of llc
Eric Leblond [Fri, 12 Jan 2018 15:18:34 +0000 (16:18 +0100)] 
ebpf: fix detection of llc

7 years agodoc: add info about xdp IPS bypass
Eric Leblond [Thu, 11 Jan 2018 15:56:18 +0000 (16:56 +0100)] 
doc: add info about xdp IPS bypass

7 years agoaf-packet: XDP bypass in IPS mode
Eric Leblond [Mon, 8 Jan 2018 23:25:02 +0000 (00:25 +0100)] 
af-packet: XDP bypass in IPS mode

Implement XDP bypass in IPS mode by using XDP redirect to send
packets from bypassed flow directly to the transmission interface.

7 years agoflow-bypass: introduce update function
Eric Leblond [Tue, 9 Jan 2018 22:11:23 +0000 (23:11 +0100)] 
flow-bypass: introduce update function

Main objective of the function is to be able to bypass a flow on
other interfaces. This is necessary in AF_PACKET case as the flow
table are per interface.

7 years agoebpf: add some comments to eBPF filter
Eric Leblond [Sun, 7 Jan 2018 21:05:40 +0000 (22:05 +0100)] 
ebpf: add some comments to eBPF filter

7 years agoebpf: slight bypass_filter optimization
Eric Leblond [Sun, 7 Jan 2018 20:58:09 +0000 (21:58 +0100)] 
ebpf: slight bypass_filter optimization

7 years agoutil-ebpf: simplify code cleaning
Eric Leblond [Sun, 7 Jan 2018 20:47:43 +0000 (21:47 +0100)] 
util-ebpf: simplify code cleaning

Avoid to use an unnecessary callback strategy as the purpose of the
function using the callback is hardcoded.

7 years agoaf-packet: add comments to eBPF/XDP code
Eric Leblond [Sun, 7 Jan 2018 12:16:27 +0000 (13:16 +0100)] 
af-packet: add comments to eBPF/XDP code

7 years agoaf-packet: fix error handling in bypass case
Eric Leblond [Sun, 7 Jan 2018 12:15:37 +0000 (13:15 +0100)] 
af-packet: fix error handling in bypass case

If the key is already in the hash table then the bypass is
succesful.

7 years agoutil-ebpf: fix libbpf error handling
Eric Leblond [Sun, 7 Jan 2018 11:59:16 +0000 (12:59 +0100)] 
util-ebpf: fix libbpf error handling

7 years agodoc: document XDP CPU redirect
Eric Leblond [Thu, 11 Jan 2018 15:52:21 +0000 (16:52 +0100)] 
doc: document XDP CPU redirect

7 years agoaf-packet: add support for XDP cpu redirect map
Eric Leblond [Tue, 2 Jan 2018 21:08:21 +0000 (22:08 +0100)] 
af-packet: add support for XDP cpu redirect map

This patch adds a boolean option "xdp-cpu-redirect" to af-packet
interface configuration. If set, then the XDP filter will load
balance the skb creation on specified CPUs instead of doing the
creation on the CPU handling the packet. In the case of a card
with asymetric hashing this will allow to avoid saturating the
single CPU handling the trafic.

The XDP filter must contains a set of map allowing load balancing.
This is the case of xdp_filter.bpf.

Fixed-by: Jesper Dangaard Brouer <netoptimizer@brouer.com>
7 years agoebpf: import more recent version of helpers
Eric Leblond [Tue, 2 Jan 2018 18:30:00 +0000 (19:30 +0100)] 
ebpf: import more recent version of helpers

7 years agoutil-affinity: export CPU set parsing function
Eric Leblond [Sat, 6 Jan 2018 08:44:00 +0000 (09:44 +0100)] 
util-affinity: export CPU set parsing function

7 years agoaf-packet: code cleaning and comments
Eric Leblond [Fri, 5 Jan 2018 22:32:54 +0000 (23:32 +0100)] 
af-packet: code cleaning and comments

7 years agoaf-packet: add missing copyright header
Eric Leblond [Fri, 5 Jan 2018 12:27:59 +0000 (13:27 +0100)] 
af-packet: add missing copyright header

And also fixes the copyright date in some files.

7 years agoutil-ebpf: add error handling in hash value fetch
Eric Leblond [Tue, 2 Jan 2018 11:50:26 +0000 (12:50 +0100)] 
util-ebpf: add error handling in hash value fetch

7 years agodoc: update xdp documentation
Eric Leblond [Fri, 5 Jan 2018 18:31:43 +0000 (19:31 +0100)] 
doc: update xdp documentation

Also remove configuration info from yaml as they are now in the
documentation.

7 years agodoc: add XDP setup documentation
Peter Manev [Sat, 30 Dec 2017 21:11:35 +0000 (22:11 +0100)] 
doc: add XDP setup documentation

7 years agoaf-packet: improve xdp error handling
Eric Leblond [Sat, 30 Dec 2017 21:04:04 +0000 (22:04 +0100)] 
af-packet: improve xdp error handling

Don't try to bypass the flow if the flow table is unknown.

Also continue after error message if ever XDP was not correctly
setup.

7 years agoaf-packet: add support for multi iface bypass
Eric Leblond [Tue, 26 Dec 2017 21:55:55 +0000 (22:55 +0100)] 
af-packet: add support for multi iface bypass

7 years agoutil-device: change logic of registration
Eric Leblond [Sat, 30 Dec 2017 18:50:12 +0000 (19:50 +0100)] 
util-device: change logic of registration

Device storage requires the devices to be created after storage
is finalized so we need to first get the list of devices then
create them when the storage is finalized.

This patch introduces the LiveDeviceName structure that is a list
of device name used during registration.

Code uses LiveRegisterDeviceName for pre registration and keep
using the LiveRegisterDevice function for part of the code that
create the interface during the runmode creation.

7 years agoutil-device: add an iteration function
Eric Leblond [Tue, 26 Dec 2017 21:47:44 +0000 (22:47 +0100)] 
util-device: add an iteration function

7 years agodevice-storage: introduce feature
Eric Leblond [Mon, 1 Jan 2018 23:33:23 +0000 (00:33 +0100)] 
device-storage: introduce feature

The capture method may have to store data depending related to the
offloading so having a per interface storage via LiveDevice seems
interesting.

7 years agoflow-bypass: fix sleep strategy
Eric Leblond [Thu, 28 Dec 2017 18:17:56 +0000 (19:17 +0100)] 
flow-bypass: fix sleep strategy

7 years agotm-threads: fix build warning in afl mode
Eric Leblond [Tue, 26 Dec 2017 19:14:24 +0000 (20:14 +0100)] 
tm-threads: fix build warning in afl mode

7 years agoaf-packet: remove done fixme in XDP
Eric Leblond [Sun, 24 Dec 2017 15:19:03 +0000 (16:19 +0100)] 
af-packet: remove done fixme in XDP

7 years agoaf-packet: end of map factoring
Eric Leblond [Sun, 24 Dec 2017 15:17:19 +0000 (16:17 +0100)] 
af-packet: end of map factoring

7 years agoaf-packet: cache map fd search
Eric Leblond [Thu, 21 Dec 2017 15:52:37 +0000 (16:52 +0100)] 
af-packet: cache map fd search

7 years agoaf-packet: fix bypassing of IPv6
Eric Leblond [Sun, 17 Dec 2017 21:09:23 +0000 (22:09 +0100)] 
af-packet: fix bypassing of IPv6

Also misc fixes.

7 years agoutil-ebpf: fix ipv6 cleaning and add comments
Eric Leblond [Sun, 17 Dec 2017 10:58:59 +0000 (11:58 +0100)] 
util-ebpf: fix ipv6 cleaning and add comments

7 years agoutil-ebpf: fix XDP delete key
Eric Leblond [Sun, 17 Dec 2017 10:47:11 +0000 (11:47 +0100)] 
util-ebpf: fix XDP delete key

The key was deleted twice so let's remove the local deletion.

7 years agoflow-bypass: add abstraction layer
Eric Leblond [Sat, 16 Dec 2017 23:01:42 +0000 (00:01 +0100)] 
flow-bypass: add abstraction layer

The flow bypass thread can now be used by any capture method that
register it timeout check function.

7 years agoutil-ebpf: add call to remove memlock limit
Eric Leblond [Wed, 13 Dec 2017 22:09:42 +0000 (23:09 +0100)] 
util-ebpf: add call to remove memlock limit

Without that, user has to use ulimit to be able to load the eBPF
file.

7 years agoebpf: implement vlan filter
Eric Leblond [Fri, 1 Dec 2017 19:07:27 +0000 (20:07 +0100)] 
ebpf: implement vlan filter

Basic filter allowing only a list of VLANs.

7 years agoutil-ebpf: suppress call on loop init
Eric Leblond [Sun, 12 Nov 2017 14:53:39 +0000 (15:53 +0100)] 
util-ebpf: suppress call on loop init

7 years agoaf-packet: implementation of XDP bypass
Eric Leblond [Mon, 27 Nov 2017 23:21:54 +0000 (00:21 +0100)] 
af-packet: implementation of XDP bypass

This patch adds support for XDP bypass. It provides an XDP
filter that can be loaded to realize the bypass of flows.

7 years agoaf-packet: use per CPU hash in bypass
Eric Leblond [Fri, 5 Jan 2018 21:33:48 +0000 (22:33 +0100)] 
af-packet: use per CPU hash in bypass

eBPF has a data type which is a per CPU array. By adding one element
to the array it is in fact added to all per CPU arrays in the kernel.
This allows to have a lockless structure in the kernel even when doing
counter update.

In userspace, we need to update the flow bypass code to fetch all
elements of the per CPU arrays.

7 years agoflow-bypass: only start thread on demand
Eric Leblond [Fri, 29 Sep 2017 20:24:08 +0000 (22:24 +0200)] 
flow-bypass: only start thread on demand

7 years agoaf-packet: kernel bypass implementation
Eric Leblond [Sun, 26 Nov 2017 19:29:52 +0000 (20:29 +0100)] 
af-packet: kernel bypass implementation

This patch implements bypass capability for af-packet.

The filter only bypass TCP and UDP in IPv4 and IPv6. It don't
don't bypass IPv6 with extended headers.

This patch also introduces a bypassed flow manager that takes
care of timeouting the bypassed flows. It uses a 60 sec
timeout on flow. As they are supposed to be active we can
try that. If they are not active then we don't care to get them
back in Suricata.

7 years agoaf-packet: add support for eBPF cluster and filter
Eric Leblond [Sun, 26 Nov 2017 19:27:13 +0000 (20:27 +0100)] 
af-packet: add support for eBPF cluster and filter

This patch introduces the ebpf cluster mode. This mode is using
an extended BPF function that is loaded into the kernel and
provide the load balancing.

An example of cluster function is provided in the ebpf
subdirectory and provide ippair load balancing function.
This is a function which uses the same method as
the one used in autofp ippair to provide a symetrical
load balancing based on IP addresses.

A simple filter example allowing to drop IPv6 is added to the
source.

This patch also prepares the infrastructure to be able to load
and use map inside eBPF files. This will be used later for flow
bypass.

7 years agodoc: update file_data description 3209/head
Giuseppe Longo [Thu, 25 Jan 2018 07:58:01 +0000 (08:58 +0100)] 
doc: update file_data description

7 years agodetect-engine-hsbd: decompress swf files
Giuseppe Longo [Fri, 14 Jul 2017 12:32:25 +0000 (14:32 +0200)] 
detect-engine-hsbd: decompress swf files

This checks if a buffer is a swf file and try
to decompress it, if decompression is enabled.

7 years agoutil-file-decompression: add swf decompression API
Giuseppe Longo [Thu, 23 Jul 2015 08:39:35 +0000 (10:39 +0200)] 
util-file-decompression: add swf decompression API

This adds a new module that permits to decompress
swf file compressed with zlib or lzma algorithms.

The API that performs decompression will take a compressed
buffer and build a new decompressed buffer following the
FWS format which represents an uncompressed file.

The maximum buffer that can be created is up to 50mb.

7 years agodetect: set events in inspection phase
Giuseppe Longo [Thu, 13 Jul 2017 22:22:13 +0000 (00:22 +0200)] 
detect: set events in inspection phase

During the inspection phase actually is not possible to catch
an error if it occurs.
This patch permits to store events in the detection engine
such that we can match on events and catch them.

7 years agoapp-layer-htp: add swf decompression settings
Giuseppe Longo [Thu, 13 Jul 2017 19:37:39 +0000 (21:37 +0200)] 
app-layer-htp: add swf decompression settings

This adds some settings needed to do swf file decompression
under libhtp section in suricata.yaml

7 years agoconfigure: check for zlib and liblzma
Giuseppe Longo [Thu, 13 Jul 2017 19:09:38 +0000 (21:09 +0200)] 
configure: check for zlib and liblzma

This checks if zlib and libzma are installed on the system
in order to decompress swf files.

7 years agosignal: enable SIGUSR2 after Reload when delayed-detect
Maurizio Abba [Wed, 24 Jan 2018 12:09:11 +0000 (12:09 +0000)] 
signal: enable SIGUSR2 after Reload when delayed-detect

Enable SIGUSR2 Handler after the first rule reload when delayed-detect
is enabled

7 years agosuricatasc: implement autoreconnect
Eric Leblond [Tue, 2 Dec 2014 16:37:23 +0000 (17:37 +0100)] 
suricatasc: implement autoreconnect

Implement a basic autoreconnect support. It tries to reconnect once
when connection has been lost. If it fails, it discards the command
and try again to connect at next command.

7 years agounix socket: protocol v0.2
Eric Leblond [Fri, 20 Mar 2015 13:23:12 +0000 (14:23 +0100)] 
unix socket: protocol v0.2

This patch updates the unix socket protocol. Messages send from
the server and the client have now a '\n' at the end. This allows
both sides to detect easily the end of a command.

As a side effect, this fixes the problem of long answer in
suricatasc. There is now a limit at the arbitrary value of 65536.

Backward compatility is preserved as a client with the older
version of the protocol can still connect to a Suricata with
version 2 of the protocol.

7 years agosetup-app-layer-detect: update for changes in detect
Jason Ish [Tue, 30 Jan 2018 18:27:38 +0000 (12:27 -0600)] 
setup-app-layer-detect: update for changes in detect

7 years agodoc: update eve/alert/metadata configuration 3205/head
Jason Ish [Tue, 30 Jan 2018 21:09:17 +0000 (15:09 -0600)] 
doc: update eve/alert/metadata configuration

7 years agoeve/alert: new metadata configuration (sane defaults)
Jason Ish [Tue, 30 Jan 2018 21:40:26 +0000 (15:40 -0600)] 
eve/alert: new metadata configuration (sane defaults)

Under eve/alert, introduce a new metadata configuration
section. If no provided, or simply yes defaults will be used.
Otherwise this a map with fields that can be toggled on and
off. The defaults are:

outputs:
  - eve-log:
      types:
        - alert:
            metadata:
              app-layer: true
              flow: true
              rule:
                raw: false
                metadata: true

To enable something that is disabled by default, or to disable
something that is enabled by default, only that key need to
be changed, everything else will keep its default value.

7 years agoconf: new function: ConfNodeHasChildren
Jason Ish [Tue, 30 Jan 2018 21:22:10 +0000 (15:22 -0600)] 
conf: new function: ConfNodeHasChildren

Test if a configuration node has any children, indicating
that it is a non-empty map or sequence.

7 years agoeve/alert: include rule text in alert output
Martin Natano [Fri, 11 Aug 2017 16:11:09 +0000 (18:11 +0200)] 
eve/alert: include rule text in alert output

For SIEM analysis it is often useful to refer to the actual rules to
find out why a specific alert has been triggered when the signature
message does not convey enough information.

Turn on the new rule flag to include the rule text in eve alert output.
The feature is turned off by default.

With a rule like this:

    alert dns $HOME_NET any -> 8.8.8.8 any (msg:"Google DNS server contacted"; sid:42;)

The eve alert output might look something like this (pretty-printed for
readability):

    {
      "timestamp": "2017-08-14T12:35:05.830812+0200",
      "flow_id": 1919856770919772,
      "in_iface": "eth0",
      "event_type": "alert",
      "src_ip": "10.20.30.40",
      "src_port": 50968,
      "dest_ip": "8.8.8.8",
      "dest_port": 53,
      "proto": "UDP",
      "alert": {
        "action": "allowed",
        "gid": 1,
        "signature_id": 42,
        "rev": 0,
        "signature": "Google DNS server contacted",
        "category": "",
        "severity": 3,
        "rule": "alert dns $HOME_NET any -> 8.8.8.8 any (msg:\"Google DNS server contacted\"; sid:43;)"
      },
      "app_proto": "dns",
      "flow": {
        "pkts_toserver": 1,
        "pkts_toclient": 0,
        "bytes_toserver": 81,
        "bytes_toclient": 0,
        "start": "2017-08-14T12:35:05.830812+0200"
      }
    }

Feature #2020

7 years agodoc: documentation update on metadata
Eric Leblond [Thu, 26 Oct 2017 08:31:46 +0000 (10:31 +0200)] 
doc: documentation update on metadata

7 years agodetect-metadata: add a string storage to de_ctx
Eric Leblond [Sat, 4 Nov 2017 15:10:15 +0000 (11:10 -0400)] 
detect-metadata: add a string storage to de_ctx

To avoid to have a lot of string allocations, we use a hash table
stored in de_ctx to point to existing string instead of duplicating
them.

7 years agosuricata: init output before detection
Eric Leblond [Sat, 4 Nov 2017 15:06:16 +0000 (11:06 -0400)] 
suricata: init output before detection

As we need to know if we should parse the signature metadata, we
have to parse the output configuration before initializing the
detection engine.

7 years agooutput-json-alert: conditionaly output metadata
Eric Leblond [Fri, 21 Apr 2017 17:42:04 +0000 (19:42 +0200)] 
output-json-alert: conditionaly output metadata

Metadata of the signature can now conditionaly put in the alert
events. This will allow user to get more context about the events
generated by the alert.

detect-metadata: conditional parsing

Only parses metadata if an output module will use the information.
Patch also adds a unittest to check metadata is not parsed if not
asked to.

output-json-alert: optional output keys as array

Update rule metadata configuration to have an option to output
value as array. Also adds an option to log only a series of keys
as array. This is useful in the case of some ruleset where from
instance the `tag` key is used multiple time.

(Jason Ish) rule metadata: always log as lists

After review of rule metadata, we can't make assumptions
on what should be a list or not. So log everything as a list.

7 years agodetect-metadata: add unit test
Eric Leblond [Wed, 25 Oct 2017 19:46:05 +0000 (21:46 +0200)] 
detect-metadata: add unit test

7 years agodetect-metadata: store metadata key value pairs
Eric Leblond [Wed, 14 Dec 2016 16:59:23 +0000 (17:59 +0100)] 
detect-metadata: store metadata key value pairs

This patch updates the Signature structure so it contains the
metadata under a key value form.
Later patch will make that dictionary available in the events.

7 years agotravis/rust: update rust minimum to 1.21 3202/head
Victor Julien [Tue, 30 Jan 2018 16:28:47 +0000 (17:28 +0100)] 
travis/rust: update rust minimum to 1.21

Ubuntu LTS and CentOS7/EPEL has upgraded to 1.21.

Update highest known working version to 1.23.

7 years agoautogen/rust: remove Cargo.lock 3201/head
Victor Julien [Tue, 30 Jan 2018 11:20:42 +0000 (12:20 +0100)] 
autogen/rust: remove Cargo.lock

Remove Cargo.lock to avoid issues when updating Cargo.toml

7 years agorust: update dependencies
Victor Julien [Mon, 29 Jan 2018 14:02:13 +0000 (15:02 +0100)] 
rust: update dependencies

7 years agorust: don't gen C headers if Rust isn't enabled
Victor Julien [Mon, 29 Jan 2018 13:16:01 +0000 (14:16 +0100)] 
rust: don't gen C headers if Rust isn't enabled

7 years agodoc: breakout eve-log section to a partial file
Jason Ish [Thu, 25 Jan 2018 22:20:32 +0000 (16:20 -0600)] 
doc: breakout eve-log section to a partial file

Both the suricata.yaml and eve configuration sections
included the eve-log section from suricata.yaml. First,
sync these up with the actual suricata.yaml then break
it out into its own file, so only one file needs to
be kept in sync with the actual configuration file.

7 years agoeve/alert: log metadata be default
Jason Ish [Thu, 25 Jan 2018 21:33:31 +0000 (15:33 -0600)] 
eve/alert: log metadata be default

By default log metadata.

Remove toggles for individual protocol types and just use a
single toggle to control including the app-layer with the
alert.

The metadata (currently app-layer and flow) can be disabled
by setting metadata to a falsey value, but its removed
from the default configuration (but wil be in docs)

7 years agoeve/metadata: log flowvars as a list of k/v pairs
Jason Ish [Thu, 25 Jan 2018 20:55:55 +0000 (14:55 -0600)] 
eve/metadata: log flowvars as a list of k/v pairs

To match the pktvars output.

7 years agoeve/metadata: special handling for traffic-id labels
Jason Ish [Thu, 25 Jan 2018 20:49:38 +0000 (14:49 -0600)] 
eve/metadata: special handling for traffic-id labels

Give traffic/id and traffic/label flowbits special handling
in the eve output. Instead of just logging them as flowbits,
give them their own top level object.

{
  "traffic": {
    "id": ["id0", "id1"],
    "label": ["label0", "label1"]
  }
}

7 years agodoc: update eve-log section for metadata
Jason Ish [Thu, 25 Jan 2018 14:52:47 +0000 (08:52 -0600)] 
doc: update eve-log section for metadata

7 years agooutput-json-vars: rename to metadata
Jason Ish [Wed, 24 Jan 2018 22:40:11 +0000 (16:40 -0600)] 
output-json-vars: rename to metadata

No functional change, just rename of files and functions
to reflect the metadata event type now used.

7 years agojson-vars: rename to metadata and use new metadata format
Jason Ish [Wed, 24 Jan 2018 20:51:03 +0000 (14:51 -0600)] 
json-vars: rename to metadata and use new metadata format

7 years agoeve: netflow: global metadata config
Jason Ish [Mon, 11 Dec 2017 21:50:54 +0000 (15:50 -0600)] 
eve: netflow: global metadata config

7 years agoeve: http: global metadata config
Jason Ish [Mon, 11 Dec 2017 21:50:42 +0000 (15:50 -0600)] 
eve: http: global metadata config

7 years agoeve: flow: global metadata config
Jason Ish [Mon, 11 Dec 2017 21:50:36 +0000 (15:50 -0600)] 
eve: flow: global metadata config

7 years agoeve: dns: global metadata config
Jason Ish [Mon, 11 Dec 2017 21:50:30 +0000 (15:50 -0600)] 
eve: dns: global metadata config

7 years agoeve: alert: global metadata config
Jason Ish [Mon, 11 Dec 2017 21:50:25 +0000 (15:50 -0600)] 
eve: alert: global metadata config

Also, remove vars as a subtype. Adding the top level metadata
field is an eve lebel parameter, not alert now.

7 years agoeve: drop: global metadata config
Jason Ish [Mon, 11 Dec 2017 21:50:18 +0000 (15:50 -0600)] 
eve: drop: global metadata config

7 years agoeve: email: respect global metadata config
Jason Ish [Mon, 11 Dec 2017 21:50:07 +0000 (15:50 -0600)] 
eve: email: respect global metadata config

7 years agoeve: nfs: respect global metadata config
Jason Ish [Mon, 11 Dec 2017 21:49:57 +0000 (15:49 -0600)] 
eve: nfs: respect global metadata config