Commit Graph

6356 Commits (d0ebe04c8b376b1c6ff537023a480a4ea2619ef6)
 

Author SHA1 Message Date
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
Alessandro Guido 53bfcf64b7 Add option to omit payload in unified2 output
Add a boolean option named "payload" to the unified2-alert output type.
Such options makes suricata omit the payload in the resulting unified2
file. The default value is true in order to preserve the current behaviour.
10 years ago
Jason Ish 413082afc0 GPL license sync with official gpl-2.0.txt
Synced up with:
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
10 years ago
Jason Ish 580728087c fix util-host-os-info unit tests.
- Some tests always passed due to the result value being
  initialized to 1.

- Fix tests that now fail.  Looks like just the test were wrong
  and that the code does the right thing.
10 years ago
Jason Ish 4185f3ee92 detect-pcre: allow upper cases metachars for host (/W).
Redmine issue 1490.
10 years ago
Eric Leblond 6572725a7a util-debug: don't colorize if a redirect is used
It is better to disable the color mode when a redirect of stderr
is done to avoid getting colorized output in the generated file.
10 years ago
Victor Julien 4d83318b46 defrag tests: fix compiler warnings
defrag.c:2423:9: error: variable 'p' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
defrag.c:2460:9: note: uninitialized use occurs here
    if (p != NULL) {
        ^
defrag.c:2423:5: note: remove the 'if' if its condition is always false
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
defrag.c:2423:9: error: variable 'p' is used uninitialized whenever '||' condition is true [-Werror,-Wsometimes-uninitialized]
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~~~~~~~~~~~~~~~
defrag.c:2460:9: note: uninitialized use occurs here
    if (p != NULL) {
        ^
defrag.c:2423:9: note: remove the '||' if its condition is always false
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
defrag.c:2423:9: error: variable 'p' is used uninitialized whenever '||' condition is true [-Werror,-Wsometimes-uninitialized]
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~
defrag.c:2460:9: note: uninitialized use occurs here
    if (p != NULL) {
        ^
defrag.c:2423:9: note: remove the '||' if its condition is always false
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~~~~
defrag.c:2427:5: note: variable 'p' is declared here
    Packet *p = Defrag(NULL, NULL, p1, NULL);
    ^
defrag.c:2486:9: error: variable 'p' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
defrag.c:2523:9: note: uninitialized use occurs here
    if (p != NULL) {
        ^
defrag.c:2486:5: note: remove the 'if' if its condition is always false
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
defrag.c:2486:9: error: variable 'p' is used uninitialized whenever '||' condition is true [-Werror,-Wsometimes-uninitialized]
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~~~~~~~~~~~~~~~
defrag.c:2523:9: note: uninitialized use occurs here
    if (p != NULL) {
        ^
defrag.c:2486:9: note: remove the '||' if its condition is always false
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
defrag.c:2486:9: error: variable 'p' is used uninitialized whenever '||' condition is true [-Werror,-Wsometimes-uninitialized]
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~
defrag.c:2523:9: note: uninitialized use occurs here
    if (p != NULL) {
        ^
defrag.c:2486:9: note: remove the '||' if its condition is always false
    if (p1 == NULL || p2 == NULL || p3 == NULL) {
        ^~~~~~~~~~~~~
defrag.c:2490:5: note: variable 'p' is declared here
    Packet *p = Defrag(NULL, NULL, p1, NULL);
    ^
6 errors generated.
make[3]: *** [defrag.o] Error 1
10 years ago
Jason Ish 6f223c6dba defrag: stop reassembly at the first packet with more flags not set 10 years ago
Jason Ish 3aa7e38c14 defrag: tracker initialization cleanup
Remove the old tracker reset macro which is no longer being used.
Clear last_seen and remove flags on initialization.
Remove extra call to DefragTrackerInit as it was being called 2x
for each new tracker.

Now that DefragTrackerNew is just a wrapper for DefragTrackerAlloc,
remove it and just call DefragTrackerAlloc directly.
10 years ago
Jason Ish 69b4218afc defrag: don't use trackers marked for removal
These trackers are likely for completed fragments, but have
not been cleaned up. If a packet on the same flow with an
already seen IP ID is seen, it could be reused prior to
being properly reinitialized.
10 years ago
Jason Ish ed400acf8e defrag: unit test for tracker reuse (current fails)
Will be fixed in subsequent commits as tracker reuse is fixed.
10 years ago
Alexander Gozman 3e29a23208 unix-manager: log client (dis)connection with DEBUG level.
Also select/receive errors are logged as ERROR.
10 years ago
Alexander Gozman 437fe40660 Feature 1527: ability to compile as a position independent executable
Adds corresponding configure option which enables proper CPPFLAGS
and LDFLAGS.
10 years ago
Mats Klepsland e634fcee60 lua: TLS lua output support
Support TLS in lua output scripts (Feature #1568).

function init (args)
    local needs = {}
    needs["protocol"] = "tls"
    return needs
end

function setup (args)
    filename = SCLogPath() .. "/" .. "lua_tls.log"
    file = assert(io.open(filename, "a"))
end

function log (args)
    ts = SCPacketTimeString()
    ipver, srcip, dstip, proto, sp, dp = SCFlowTuple()

    version, subject, issuer, fingerprint = TlsGetCertInfo();
    if version == nil then
        return 0
    end

    file:write(ts .. " " .. srcip .. ":" .. sp .. " -> " .. dstip  ..
               ":" .. dp .. "  TLS: " .. "Subject='" .. subject ..
               "' " .. "Issuerdn='" .. issuer .. "\n")
    file:flush()
end

function deinit (args)
    file:close(file)
end
10 years ago
Eric Leblond 2ecab3f765 decode-mime: fix body md5 computation
Previous code was wrongly supposing the lines are ending with CRLF.
But this is not the case so we must propagate the length of end of
line delimiter to be able to compute the md5 of the mail body.
10 years ago
Eric Leblond 53419b93c8 util-decode-mime: fix some unittests
Unittests were failling when ASAN is activated because it was
finding some read outside of bounds. This patch fixes the different
reported issues.
10 years ago
Eric Leblond dbb3e1976e util-decode-mime: fix IsIpv6Host function
Using in6_addr is better when calling inet_pton. This fixes an
issue reported by ASAN.
10 years ago
Eric Leblond 38750f1313 smtp-layer: remove FIXME and del excessive newline 10 years ago
Eric Leblond 6f04988ba1 output-json: add tx_id to events
This patch updates alert, stmp and http JSON logging to have a
tx_id in the root of the JSON log message.
10 years ago
Eric Leblond 113d6a3950 output-json: add create header with tx function
To be able to correlate between events, it is better to have the
tx_id information in the root object. This function adds a new
function to automate the addition of the field.
10 years ago
Eric Leblond 96412e8921 json-email: JsonEmailAddMetadata update
Add tx_id to the list of params to be in sync with recent changes.
10 years ago
Eric Leblond bf6b0145e2 json-http: gen metadata function with tx_id param 10 years ago
Eric Leblond d9b602fc0f json-smtp: add tx_id param to metadata generation
In all metadata generation contexts we know the tx_id so we better
used it to log the correct transaction and not an other one.
10 years ago
Eric Leblond 0ef0f1d526 json-smtp: change copyright date 10 years ago
Eric Leblond f03a7a032f json-alert: add smtp elements in alert 10 years ago
Eric Leblond 77a5273cde json-smtp: fix a debug message 10 years ago
Eric Leblond 946f2a6acc email-json: add bcc to extended fields 10 years ago