Commit Graph

7892 Commits (245a89b7e74cfa4d60ab4f93d9708dd1af7d803f)
 

Author SHA1 Message Date
Victor Julien 245a89b7e7 doc: http keywords update 8 years ago
Victor Julien 595f6d1f26 detect: implement http_content_len sticky buffer
This implements inspection of the Content-Length buffer as a content
sticky buffer.
8 years ago
Victor Julien d96cbddbe4 detect: implement http_content_type sticky buffer 8 years ago
Victor Julien 46febef7cd detect: implement http_accept_enc sticky buffer
Inspects Accept-Encoding header.
8 years ago
Victor Julien 9d5bbc3af6 detect: implement http_accept_lang sticky buffer
Inspects Accept-Language header
8 years ago
Victor Julien 1d1176b0d5 detect: implement http_connection sticky buffer 8 years ago
Victor Julien 5714129e32 detect: implement http referer sticky buffer 8 years ago
Victor Julien 88cfb99910 detect: http_accept sticky buffer + common code
Implement common code to easily add more per HTTP header detection
keywords.

Implement http_accept sticky buffer. It operates on the HTTP Accept
header.
8 years ago
Ray Ruvinskiy 7539973109 tls: logging for session resumption
We assume session resumption has occurred if the Client Hello message
included a session id, we have not seen the server certificate, but
we have seen a Change Cipher Spec message from the server.

Previously, these transactions were not logged at all because the
server cert was never seen.

Ticket: https://redmine.openinfosecfoundation.org/issues/1969
8 years ago
Ray Ruvinskiy 0dc57c937e device: fix warning about NULL device
Fix '[ERRCODE: SC_ERR_INVALID_VALUE(130)] - Name of device should not be null'
warning on start-up with pfring.

Ticket: https://redmine.openinfosecfoundation.org/issues/2097
8 years ago
Victor Julien 29c8125758 redis: use SCCalloc to reduce risk of unitialized vars 8 years ago
fooinha a64e5e77c7 eve: async mode for redis output
eve: detects libevent for async redis at configure
eve: moves redis output code to new file - util-log-redis.{c,h}
eve: redis ECHO and QUIT commands for async mode
eve: redis output defaults if conf is missing
8 years ago
fooinha 36667ab8a1 doc: async mode for redis eve output
async: true ## if redis replies are read asynchronously
8 years ago
Victor Julien c3b4dd5a7d qa: add --no-random commandline option 8 years ago
Victor Julien ba61265403 qa: add rand/rand_r to banned functions 8 years ago
Victor Julien 535d9e3529 random: convert stream and htp to new call 8 years ago
Victor Julien dd70b3fda0 random: improve random logic
Improve random logic for hash tables.

Implement Windows random API if it is available.
8 years ago
Victor Julien ec964ebf84 mingw: don't use uint type as mingw doesn't have it 8 years ago
Victor Julien 8f15e30a58 common: improve byte order and wordsize detection 8 years ago
Victor Julien a4dce24151 core dumps: check for sys/resource.h 8 years ago
Victor Julien 618f351210 cleanup: get rid of %llu format specifiers
Use more explicit types instead.
8 years ago
psanders240 1223de4208 doc: Napatech docs improvement
Fix errors and simplify filters.
8 years ago
Jason Ish e69ce30d87 template script: typo in app-layer setup script
Check for ed was failing, as it was actually looking for edx.
8 years ago
Victor Julien cee5c9fa60 pcre: on ppc64 disable only for specific versions
Disable jit only for libpcre 8.39 and 8.40 as those were the buggy
versions.

Thanks to Zoltán Herczeg.
8 years ago
Victor Julien aca27ff383 doc: expand on bpf 8 years ago
Jason Ish 9ff8882cbd detect: don't consider an empty rule file an error 8 years ago
Jason Ish 8436a892f9 logging: only do non-blocking writes if live
If running against a pcap there is no reason to drop events,
a blocking socket is fine here. So only do non-blocking writes
when running off a live device.
8 years ago
Jason Ish 673549e5cf eve: log number of events dropped at exit 8 years ago
Jason Ish 59b98649de logging: don't block on socket writes
Writing to a unix socket can cause Suricata to block in the
packet path. This could happen if the read-endpoint of the
unix socket stays connected, but stops reading, or simply
can't read fast enough as part of its event processing.

To choose packets over events, do non-blocking socket
writes and drop the event if the write would block and
update a dropped counter.
8 years ago
Mats Klepsland 8b9f84bff2 doc: add documentation for date modifiers in eve-log 8 years ago
Mats Klepsland 37a12fe799 doc: add documentation for eve-log file rotation 8 years ago
Mats Klepsland ffbf8cec16 logging: create log directories when needed
Recursively create new log directories when needed. This makes it
possible to use date modifiers in the file path to create
directories based on date, e.g.:

  /var/log/suricata/2017/02/14/
8 years ago
Mats Klepsland 47a5b493d7 output-json: rotate log file based on time
Rotate log file based on time. Support both rotating based on a timer (XXs,
XXm, XXd, XXw) and rotating based on a absolute time, like each minute,
hour or day.
8 years ago
Mats Klepsland db6c80fd8e logging: support date modifiers in log filenames
Allow log filenames to contain date modifiers, e.g.:

  - eve-log:
    filename: eve-%Y-%m-%d-%H:%M:%S.json
8 years ago
Victor Julien bc480fa8c3 pcre: disable jit on powerpc64
It appears that both using gcc and clang something gets misoptimised
around pcre's jit. So disable jit for now.
8 years ago
Jason Ish 845e18f25a defrag: (windows) detect more overlaps 8 years ago
Jason Ish 7922f9be1b defrag: (linux) fix an error in overlapping fragments
If a subsequent fragment has a lower offset than a previous
one and overlaps, trim off the beginning of the previous
fragment.

Based on an issue reported privately.
8 years ago
Jason Ish ca92be896e defrag: use new unit test macros
Also reformat unit test functions to Suricata style.
8 years ago
Jason Ish 00cd47b2bf travis: use new container build infrastructure
Migrate to the new Travis container build system. This build system does
not allow use of sudo, so required packages must be done declaratively
which required reworking how we install packages that are conditional
based on the build being done.

Mac builds are still done with sudo=true.
8 years ago
Jason Ish ff30d924db unix-socket: return failure on failure
UnixManagerThreadInit needs to return a failure code if the socket
fails to initialize to avoid entering the UnixManager loop which
will continuously fail on the call to bind, as no listening
socket was setup.

This can occur when the socket fails to initialize due to a
permissions error and fatal init errors is not on.
8 years ago
fooinha 20d4d40051 log: tls custom format log 8 years ago
fooinha af174c82bb log: common custom format output 8 years ago
Victor Julien d5a0eb4b2c geoip: fix compiler warning
detect-geoip.c:78:40: error: incompatible pointer types assigning to 'int (*)(ThreadVars *, DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)' from 'int (ThreadVars *, DetectEngineThreadCtx *, Packet *, Signature *, const SigMatchCtx *)' [-Werror,-Wincompatible-pointer-types]
    sigmatch_table[DETECT_GEOIP].Match = DetectGeoipMatch;
                                       ^ ~~~~~~~~~~~~~~~~
1 error generated.

Bug #2045
8 years ago
Victor Julien b134dfcce7 modbus: fix compiler warnings about alignment
app-layer-modbus.c:1226:39: warning: taking address of packed member 'transactionId' of class or structure 'ModbusHeader_' may result in an unaligned pointer value [-Waddress-of-packed-member]
    if (ModbusExtractUint16(modbus, &(header->transactionId), input, input_len, &offset)    ||
                                      ^~~~~~~~~~~~~~~~~~~~~
app-layer-modbus.c:1228:39: warning: taking address of packed member 'protocolId' of class or structure 'ModbusHeader_' may result in an unaligned pointer value [-Waddress-of-packed-member]
        ModbusExtractUint16(modbus, &(header->protocolId), input, input_len, &offset)       ||
                                      ^~~~~~~~~~~~~~~~~~
app-layer-modbus.c:1230:39: warning: taking address of packed member 'length' of class or structure 'ModbusHeader_' may result in an unaligned pointer value [-Waddress-of-packed-member]
        ModbusExtractUint16(modbus, &(header->length), input, input_len, &offset)           ||
                                      ^~~~~~~~~~~~~~
3 warnings generated.

Bug #2088
8 years ago
Victor Julien e1bf48c0ee pool: fix compiler warning
clang-4.0 reported:

util-pool.c:242:13: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
        if (! pb->flags & POOL_BUCKET_PREALLOCATED) {
            ^           ~
util-pool.c:242:13: note: add parentheses after the '!' to evaluate the bitwise operator first
        if (! pb->flags & POOL_BUCKET_PREALLOCATED) {
            ^
              (                                   )
util-pool.c:242:13: note: add parentheses around left hand side expression to silence this warning
        if (! pb->flags & POOL_BUCKET_PREALLOCATED) {
            ^
            (          )
util-pool.c:261:13: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
        if (! pb->flags & POOL_BUCKET_PREALLOCATED) {
            ^           ~
util-pool.c:261:13: note: add parentheses after the '!' to evaluate the bitwise operator first
        if (! pb->flags & POOL_BUCKET_PREALLOCATED) {
            ^
              (                                   )
util-pool.c:261:13: note: add parentheses around left hand side expression to silence this warning
        if (! pb->flags & POOL_BUCKET_PREALLOCATED) {
            ^
            (          )
2 warnings generated.
8 years ago
Victor Julien 6227d0955f af-packet: fix cppcheck false positive
[src/source-af-packet.c:1903]: (error) Resource leak: fd
8 years ago
Victor Julien 3726fd66be http: fix body tracking corner case
In some cases, observed with inspect limits 0, the body tracking could
get confused. When all chunks were already freed, a new chunk would
be considered to be the start of the body. This would overwrite the
bodies 'content_len_so_far' tracker, instead of adding to it. This in
turn could lead to a assertion abort in the inspection code.

This patch redoes the append code to always add the current lenght. It
cleans up the code to remove redundant logic.

Issue: https://redmine.openinfosecfoundation.org/issues/2078
Reported-By: Jørgen Bøhnsdalen
8 years ago
Jason Ish 3ca1a29bbd defrag: fix argument used in macro to match signature
"p" was being used in the macro but was not an argument to
the macro, but it worked due to the context of the macro.

Use the actual macro argument, d2, instead of p.

Results in no change to generated code.
8 years ago
Mats Klepsland 7b1dae6251 doc: add documentation for Lua SCFlowTimestamps 8 years ago
Mats Klepsland 365aa1f3e5 lua: add SCFlowTimestamps function
Add SCFlowTimestamps() to return startts and lastts as seconds and
microseconds from flow.

Examples:

  startts, lastts = SCFlowTimestamps()
  startts_s, lastts_s, startts_us, lastts_us = SCFlowTimestamps()
8 years ago