Commit Graph

6382 Commits (11eb1d7c1d2b77d0706d7fd1632d9deeb7937a04)
 

Author SHA1 Message Date
Mats Klepsland 285022fde9 output-json-tls: added SNI field to extended output
Added SNI field to extended JSON output.
9 years ago
Mats Klepsland 3ac1a3d9fe app-layer-ssl: get server name from SNI extension
Decode client hello handshake to get server name from SNI extension.
9 years ago
Victor Julien bec913b40c json: fix malformed output
Even though the json output callback is called with a null terminated
string, it's not useable directly. The size parameter to the callback
might be a lot smaller than the string size. Libjansson gives the size
up to the first point that needs escaping.
9 years ago
Victor Julien c80990fe10 output: cleanup JSON logging 9 years ago
Victor Julien ad5a753dde output-json: don't alloc for JSON to string 9 years ago
Victor Julien c1bf0e1b07 rule profiling: json output 9 years ago
Victor Julien b03c288d9a profiling: cleanup, remove MIN declaration 9 years ago
Eric Leblond a4089873c7 rules-reload: fix reload with -s or -S
When using the -S or -s option, the reload was causing the specified
rules file to be forgotten and the default rules to be loaded at
reload time.
9 years ago
Eric Leblond b85901a6b4 prscript: add rm command
This command removes the container and the image allowing to
free the disk space allocated during the creation.
9 years ago
Eric Leblond 35c1b681ee prscript: docker do not need sudo
Usage is not to run docker command as root but to have the user
in the docker group to be able to run docker commands.
9 years ago
Eric Leblond c199fdcbb9 handle MTU discovery in multi iface case
This patch adds handling of multiple interface by using as
default-packet-size the maximum MTU + header length among the
live iface.
9 years ago
Eric Leblond affb399cd9 config: don't use hardcoded path
It is better to use a transformation to define the default
directory of output message instead of using an hardcoded value.
Same apply to the directory for the pid file.
9 years ago
Eric Leblond 9672e16323 suricata: clean dump-config output
When user asks for a configuration dump, it is useless to display
the version and CPU info. Also initializing the log system conduct
to overwrite the some log files and in particular suricata.log and
this is annoying as a command should not interfere with a running
daemon.
9 years ago
cardigliano c06dfe6e26 pfring pkt acq: keep running on 'pfring_set_cluster' failure when cluster is not required
Suricata creates a pfring cluster with a default ID = 1 when not explicitly configured,
unless the device has prefix 'dna' or 'zc'. Since pf_ring also supports other cards
implementing kernel-bypass (cluster not supported), this is preventing those cards from
running on top of this module. This patch stops suricata on 'pfring_set_cluster' failure
only when error code != PF_RING_ERROR_NOT_SUPPORTED or cluster ID has not been explicitly
configured.
9 years ago
Victor Julien 7f8795c756 threading: avoid autofp deadlock
When there are many threads and/or the packet pool (max-pending-packets) is
small, a potential dead lock exists between the packet pool return pool
logic and the capture threads. The autofp workers together can have all the
packets in their return pools, while the capture thread(s) are waiting at an
empty pool. A race between the worker threads and the capture thread, where
the latter signals the former, is lost by the capture thread. Now everyone
is waiting.

To avoid this scenario, this patch makes the previously hardcoded 'return
pool' threshold dynamic based on the number of threads and the packet pool
size.

It sets the threshold to the max pending packets value, divided by the number
of lister threads. The max value hasn't changed. Normally, in the autofp
runmode these are the stream/detect/log worker threads.

The max_pending_return_packets value needs to stay below the packet pool size
of the 'producers' (normally pkt capture threads but also flow timeout
injection) to avoid the deadlock.

As it's quite impossible at this time to learn how many threads will be
created before starting the runmodes, and thus spawning the threads and
already initializing the packet pools, this code sets a global variable
after runmode setup, but before the threads are 'unpaused'.
9 years ago
Victor Julien 8d06d7bccc threads: add func to count running threads of types 9 years ago
Victor Julien ca3916881f threading: store thread module flags in threadvars 9 years ago
Victor Julien 77624701e7 htp: cleanup, remove unused declaration 10 years ago
cardigliano 86711a1332 pfring pkt acq: capture loop optimisation
For each packet the capture module checks whether it is time to dump stats calling
TimeGet(). TimeGet() is an expensive function using gettimeofday() or SCSpinLock()
which affect performance. Since gettimeofday() is already called for setting packet
timestamp, it is more efficient to use the packet timestamp directly.
10 years ago
cardigliano 70c98c1ff2 pfring pkt acq: removed reentrant flag
PF_RING_REENTRANT is not needed as each pfring socket is used by a single thread.
10 years ago
cardigliano c4850c1d8f pfring pkt acq: use zero-copy recv in workers runmode
This patch removes packet copy when suricata is running in workers runmode,
packet copy is not needed in this case since packets are processed in sequence.
10 years ago
Eric Leblond d88e133428 util-logopenfile: don't allocate redis command
As we only have two different commands we don't need to allocate
it and can use pointer to global variables.
10 years ago
Eric Leblond 2ea4bbc492 util-logopenfile: move sensor_name to filectx
We will now output the sensor name independantly of the output
method if it is set in the YAML file. In the case of redis we are
using the hostname value if unset.
10 years ago
Eric Leblond 7e3a5a0db2 util-logopenfile: log queued events at exit
Do a redis query at exit to log possibly existing events.
10 years ago
Eric Leblond 404e660410 util-logopenfile: don't lock syslog write 10 years ago
Eric Leblond c5d939834f util-logopenfile: cleaner free function 10 years ago
Eric Leblond 1b0f2774f2 util-logopenfile: don't use atomic for batch_count 10 years ago
Eric Leblond e9d26dd510 util-logopenfile: use a function for redis write 10 years ago
Eric Leblond f11b269ef1 redis-output: fix sensor-name code
The sensor-name was not freed at exist and the result of SCStrdup
was not checked.
10 years ago
Eric Leblond 594f62b523 util-logopenfile: reconnect handling
This patch implements reconnection handling for the redis output.
A reconnect limitation has been implemented with a limitation of
one connection per second.
10 years ago
Eric Leblond b834e2d19a util-logopenfile: implement redis pipelining
This patch implements redis pipelining. This consist in contacting
the redis server every N events to minimize the number of TCP
exchange. This is optional and setup via the configuration file.
10 years ago
Eric Leblond f953fdfbac util-logopenfile: introduce SCConfLogOpenRedis
Introduce a function to realize the parsing and config file and
opening of connection to the database. Only used by output-json
for now it will be usable by other logging modules.
10 years ago
Eric Leblond a13be67b5e util-logopenfile: add write function
Introduce a function LogFileWrite that will handle the writing with
respect of the type defined in the configuration. This is used in
this patch to remove the write complexity from output-json.
10 years ago
Eric Leblond 60ea49c777 output-json: add sensor-name config variable
When using redis output, we are loosing the host key (added by
logstash or logstash-forwarder) and we can't find anymore what
Suricata did cause the alert.

This patch is adding this key during message generation using the
'sensor-name' variable or the hostname is 'sensor-name' is not
defined.
10 years ago
Eric Leblond 9286360f86 travis: add libjansson and hiredis
Install the libs and force usage of hiredis. We will have a more
complete build with this two libs.
10 years ago
Eric Leblond 31c91d53bb output-json: improve hiredis define
Use #ifdef instead of #if and don't include the header which is
not needed anymore.
10 years ago
Eric Leblond eef5678e5e output-json: add redis support
This patch adds redis support to JSON output.
10 years ago
Giuseppe Longo 769722101e decode: add flow memcap counter
This adds a counter indicating how many times
the flow max memcap has been reached

Since there is no always a reference to FlowManagerThreadData,
the counter is put in DecodeThreadVars.

Currently when there is no counter increase in one call of FlowGetNew
because we don't have tv or dtv at the time of the call.

The following is a snippet of the generated EVE entry:
"flow":{"memcap":0,"spare":10000,"emerg_mode_entered":0,"emerg_mode_over":0,"tcp_reuse":0,"memuse":7085248}
10 years ago
cardigliano c2704c3933 workers runmode: allow multiple input devices
This fix allows multiple input devices when running in 'workers' mode.
10 years ago
Eric Leblond 16b210f1ea json-file: avoid allocation 10 years ago
Eric Leblond f8b6768d05 json-email: fix coverity alert
The code was not correct and coverity did detect a potential
overflow problem that should not happen because of the structure
of md5 string and of format.
10 years ago
Jason Ish dc2c896781 app-layer setup scripts: enable new modules on copy
The templates are disabled by default, enable the copy
of the template so the new app-layer modules are enabled by
by default.
10 years ago
Jason Ish 9697a09d21 template app-layer: disable if not in config file (default)
Unlike other app-layer protocols which are enabled by default,
disable this one by default as it likely shouldn't be enabled
in production use of Suricata.
10 years ago
Eric Leblond 38c21077e6 json-email-common: fix email extended logging
Two structure fields were uninitialized and used has a bit field.
Weird behavior were seen in list of logged fields due to that with
some build options.
10 years ago
Eric Leblond 3676bd667d json-email-common: suppress commented code 10 years ago
Eric Leblond 484885b70f json-email-common: can now log same header twice
Multiple events can be applied on a transaction so we may need to
log the same header twice.

The HDR_IS_LOGGED flag was making it impossible. And this system
is usless as email application layer is transaction based.
10 years ago
Torgeir Natvig af6d1dddfa Bugfix for detect-engine.luajit-states
detect-engine is a list, and luajit-states was looked up as a map.
10 years ago
Mats Klepsland 70cc1ddbcd lua: SSH output support
Support SSH in lua output scripts (Feature #1569).
10 years ago
Mats Klepsland 7eab16c478 lua: SSH support
Support SSH in lua detection scripts (Feature #1569).
10 years ago
Alessandro Guido dcbbda505f Describe new unified2-alert "payload" option 10 years ago