Commit Graph

688 Commits (a8f147d17a54b3199020f51cd2b811d91488393d)

Author SHA1 Message Date
Shivani Bhardwaj a8f147d17a datasets: Init even in socket mode
Closes redmine ticket 3476.
5 years ago
Sascha Steinbiss 4e1a41a17d output-json: add MAC address output
This commit adds MAC address output to the EVE-JSON format. We follow the
remarks made in Redmine ticket #962: for packets, log MAC src/dst as a
scalar field in EVE; for flows, log MAC src/dst as lists in EVE. Field names
are different between flow and packet context to avoid type confusion
(src_mac vs. src_macs). Configuration approach and JSON representation is
taken from previous GitHub PR #2700.
5 years ago
Shivani Bhardwaj 6f7d8e50c8 src: use FatalError whenever possible
Replaces all patterns of SCLogError() followed by exit() with
FatalError(). Cocci script to do this:

@@
constant C;
constant char[] msg;
@@

- SCLogError(C,
+ FatalError(SC_ERR_FATAL,
  msg);
- exit(EXIT_FAILURE);

Closes redmine ticket 3188.
5 years ago
Emmanuel Thompson 275f6ae96f detect/asn1: Remove asn1 C parser
- In favor of rust parser
5 years ago
Victor Julien 9f3f07dd97 reject: get MTU for reject-dev and use it 5 years ago
Victor Julien c594d0c1ad reject: allow configuration of the reject interface
Using the '--reject-dev <dev>' commandline option. This is a global option
that applies to all 'reject' actions.

If the interface specified is using ethernet, libnet will use the faster
L2 (link) layer. Suricata sets up the ethernet header based on the packet.

When the interface is specified, cache libnet_t ctx for (much) better
performance.
5 years ago
Joshua Lumb 82fb72678f cmdline: --list-app-layer-protos respects -c arg 5 years ago
Eric Leblond ae5650d443 magic: get rid of global lock
Global magic context was involving a lock that appear to be really
costly for some traffic.
5 years ago
Philippe Antoine 304aedfa95 fuzz: improves sigpcap target
So that it can cover alert generation
ie in function DetectRun, get past scratch.sgh == NULL condition
5 years ago
Victor Julien 26bcc97515 detect/keywords: dynamic version part of doc URL 5 years ago
Victor Julien 3ba4afd40b threads: make thread local storage manadatory
Support either the __thread GNUism or the C11 _Thread_local.

Use 'thread_local' to point to the one that is used. Convert existing
__thread user to 'thread_local'.

Remove non-thread-local code from the packet pool code.
5 years ago
Victor Julien 109b2ae551 atomics: avoid unnecessary (direct) CAS use 5 years ago
Victor Julien c660757153 atomics: remove useless SC_ATOMIC_DESTROY 5 years ago
Victor Julien 48bb26abe7 util/mem: remove old debug code for counting allocs 5 years ago
Philippe Antoine 91b2930891 fuzz: build compatibility with oss-fuzz flags
ie C define FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
5 years ago
Shivani Bhardwaj 0e4f261224 Use StringParse* for all parsers and configurations 5 years ago
Philippe Antoine 293eebd999 fuzz: remove obsolete AFL code 5 years ago
Pierre Chifflier 1d9f37a60e DER: remove the C parser for DER 5 years ago
Jason Ish a0e3e2d7b4 dns: register parsers from Rust
And port the C DNS tests to Rust.
5 years ago
Jeff Lucovsky 1519c1f006 detect/feature: Support --dump-features 6 years ago
Jeff Lucovsky 8f6e133497 main: feature init and release 6 years ago
Philippe Antoine af2a689a99 init: move main to a separate file
so as to reuse code from suricata.c with fuzz targets
6 years ago
Philippe Antoine bb42be7e08 fuzz: disable signal handlers while fuzzing 6 years ago
Philippe Antoine 47eba33110 init: make PostConfLoadedSetup global
to be used by fuzz targets
6 years ago
Philippe Antoine 913082941c init: fix PostConfLoadedSetup to use local suri ptr 6 years ago
Philippe Antoine d2b3668a68 init: InitGlobal function
To be reused by fuzz targets
6 years ago
Victor Julien 0e3f27a87e threading: remove 'trans_q' array of packet queues
Let the queues code set up PacketQueues on demand.
6 years ago
Danny Browning b573c16dd5 build: cbindgen
Rust headers are now generated using cbindgen. If cbindgen is present, they can
be generated during dist, otherwise they will be available for builds.
6 years ago
Eric Leblond 1b9009ea0e suricata: fix computing of default packet size
Update the default packet size computation to use LiveDeviceName
instead of LiveDevice as the LiveDevice list is not built when
the default packet size is built.
6 years ago
Victor Julien 2ab7fb4b41 version: automate and cleanup ver handling
Create a single function to return the version string, to avoid lots
of ifdefs in multiple places.

Make the version determine the 'release' status. If the version from
autoconf has '-dev' in the name, it is not a release. If it hasn't
it is considered a release version.
6 years ago
Victor Julien edd2cd626f jansson: remove HAVE_LIBJANSSON guards 6 years ago
Victor Julien 5e9714e384 rust: remove all HAVE_RUST guards 6 years ago
Jason Ish 8425259c88 help: better description for -v
-v: be more verbose (use multiple times to increase verbosity)
6 years ago
Victor Julien b5521b58bc detect/parse: add --strict-rule-keywords option
Add --strict-rule-keywords commandline option to enable strict rule
parsing.

It can be used without options or with a comma separated list:
--strict-rule-keywords
--strict-rule-keywords=all
--strict-rule-keywords=classtype,reference

Parsing implementations can use SigMatchStrictEnabled to check
if strict parsing is enabled for them and act accordingly.
6 years ago
Shivani Bhardwaj ac55b21184 suricata: Check if default log dir is writable
At the startup, if the default log dir provided either by command line
options or suricat.yaml is not writable, the error comes quite later.
This patch makes suricata exit if there is such an error in the
beginning itself.

Closes redmine ticket #2386.
6 years ago
Yujie Zhao a121c7b460 Avoid to shutdown NSS if it is not initialized 6 years ago
Jason Ish 178d420f36 main: enable coredumps after privileges are dropped
On Linux, by default, coredumps are disabled after
privileges are dropped. This re-enables coredumps
after privileges are dropped.

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

Credit to Elazar Broad for the pull request:
https://github.com/OISF/suricata/pull/3362
6 years ago
Victor Julien 317376f59d datasets: match on lists of data
Datasets are sets/lists of data that can be accessed or added from
the rule language.

This patch implements 3 data types:

1. string (or buffer)
2. md5
3. sha256

The patch also implements 2 new rule keywords:

1. dataset
2. datarep

The dataset keyword allows matching against a list of values to see if
it exists or not. It can also add the value to the set. The set can
optionally be stored to disk on exit.

The datarep support matching/lookups only. With each item in the set a
reputation value is stored and this value can be matched against. The
reputation value is unsigned 16 bit, so values can be between 0 and 65535.

Datasets can be registered in 2 ways:

1. through the yaml
2. through the rules

The goal of this rules based approach is that rule writers can start using
this without the need for config changes.

A dataset is implemented using a thash hash table. Each dataset is its own
separate thash.
6 years ago
Victor Julien 0b120bbe34 suricata: expose system as global 6 years ago
Victor Julien 5d5612f98e suricata: --data-dir option 6 years ago
Victor Julien 399ab35aa1 afl: fix compile warnings for decoder fuzz funcs 6 years ago
Jeff Lucovsky 240520a3cc main: fix typo in output 6 years ago
Andreas Herz 6ebb1b2cc4 rule-reload: enable rule-reload for -s and -S run as well 6 years ago
Shivani Bhardwaj 8c2c78f0b6 configure: Add date with rev information
Date makes it even clearer that when was the last commit for the build
that one is running. Add this info alongwith rev. Change inspired by
rustc.

Before
```
$ suricata -V
This is Suricata version 5.0.0-dev (rev 2d217e666)
```

After
```
This is Suricata version 5.0.0-dev (2d217e666 2019-07-12)
```

Closes redmine ticket #3092
6 years ago
Max Fillinger 44bea80d3c decode erspan: Always fill in vlan_id
Fill in the vlan_id fields unconditionally. We can now remove the check
for the vlan.use-for-tracking setting in decode.c. The debug log message
is moved to suricata.c.
6 years ago
Max Fillinger cef9961f59 flow hash: Mask vlan_id if not used for tracking
If vlan.use-for-tracking is disabled, set the vlan_id fields to 0 when
hashing or comparing flows. This is done using a bitmask as suggested by
Victor Julien in IRC, in order to avoid adding more branches to this
code.

Currently, suricata does not fill in vlan_id fields if
vlan.use-for-tracking is disabled and instead leaves them at the default
0 value, so this commit makes no functional change. This change is in
preparation for future commits where the vlan_ids will be always filled
in.

Related to https://redmine.openinfosecfoundation.org/issues/3076
6 years ago
Victor Julien c12252617c afl: fix afl-ftp causing FPE due to missing ippair 6 years ago
Eric Leblond b07bda7a7b bypass: new callback stragegy
This patch introduces and uses a new bypass strategy
based on a callback. EBPF bypass implementation is
updated to use this new strategy.

Once the flow manager detect that a flow should be timeouted,
it asks the capture method if it has seen packets in the interval.
If it is the case the lastts of the flow is updated and the timeout
is postponed.
6 years ago
Eric Leblond 6ab1cbcb8e bypass: use flow storage for bypass counter
There is a synchronization issue occuring when a flow is
added to the eBPF bypass maps. The flow can have packets
in the ring buffer that have already passed the eBPF stage.
By consequences, they are not accounted in the eBPF counter
but are accounted by Suricata flow engine.

This was causing counters to be completely wrong. This code
fixes the issue by avoiding the counter change in invalid
case.

To avoid adding 4 64bits integers to the Flow structure for the
bypass accounting, we use instead a FlowStorage. This limits the
memory usage to the size of a pointer.
6 years ago
Eric Leblond 4e6add7faa bypass: generalize iface bypass stats
Introduce functions in util-device.c to be able to manage the
flow bypassed count stats.
6 years ago