Commit Graph

28 Commits (1c8205e6b1cb1570517d86c9e6fe95b296c90b90)

Author SHA1 Message Date
Jason Ish 27672c950c dnp3: fixups to work with unified json tx logger
Update DNP3 to work with a single TX logger, and just register one
logger instead of 2.

This primarily creates a TX per message instead of correlating replies
to requests, which fits the DNP3 model better, but we didn't really have
this concept nailed down when DNP3 was written.
4 years ago
Victor Julien e250ef6402 debug: remove empty header 4 years ago
Philippe Antoine 16fc78645d dnp3: do not log empty objects array
Ticket: #5167
4 years ago
Philippe Antoine e3180e3248 output: fix integer warnings
Ticket: 4516
4 years ago
Jason Ish 6392216f6b base64: use the Rust base64 encode implementation
Replace our internal base64 implementation with a ffi wrapper
around the Rust implementation provided by an external crate.
5 years ago
Jason Ish 06f58650d6 eve: refactor OutputJsonBuilderBuffer to take context
All callers of OutputJsonBuilderBuffer are now calling it
using fields from an OutputJsonThreadCtx, so just pass
a pointer to the thread context now.
5 years ago
Jason Ish 08eee26d27 eve: convert many loggers to use generate thread context
- mqtt
- dnp3
- smtp
- ike
- dns
- alert
- tls
- anomaly
- drop
- file
- http
- http2
- templates
- dhcp

The idea is to factor out the commom code for setting
up the output file objects, which is repetitive, and
often done wrong when it comes to threading.
5 years ago
Jason Ish 06ba611667 eve cleanup: remove duplicate/redundant code
The first change was to have CreateEveHeader add the common options
as this was left out in a few loggers. While update all the loggers
that use CreateEveHeader, remove redundant code, in particular
from loggers that don't need to use their own context but
can use the generic one.
5 years ago
Jason Ish 76e011a5ba dnp3: set byte order when logging dnp3 src and dst
DNP3 uses little endian on the wire, for the most part this
is handled as the messages are deserialize. However, the link
header is a cast over raw data, so swap these bytes as they
are being logged.

Redmine issue:
https://redmine.openinfosecfoundation.org/issues/4173
6 years ago
Jeff Lucovsky 30ae98f658 output/json: Multi-threaded EVE logging support
This commit modifies the JSON loggers with changes necessary to support
multi-threaded EVE output.

Each "thread-init" function sets up the per-thread log file context for
subsequent calls to the JSON output to buffer function.
6 years ago
Jason Ish 8c98fa452f dnp3/eve: update for regenerated dnp3 object logging code
Migration from Jansson to JsonBuilder.
6 years ago
Jason Ish ccc057fdc9 dnp3/eve: convert to jsonbuilder (non generated code)
First step of converting DNP3 to JsonBuilder by first converting
the non-generated code.
6 years ago
Jason Ish 99f460aa5a eve/fivetuple: use intermediate address struct (jsonbuilder prep)
Currently alert logging relies on the ability to change existing
values in the json_t structure to overwrite addresses with xff
data. This feature is also used for the "target" logging.

As we can't do this with JsonBuilder, create a new struct to
hold the 5 tuple, with the values swapped as needed, and
overwritten with XFF data if needed. This struct will now
be used to write out the 5 tuple, as well as cache the information
for log fields to be written out later on in the log path.
6 years ago
Victor Julien edd2cd626f jansson: remove HAVE_LIBJANSSON guards 7 years ago
Jeff Lucovsky 3d5eccf084 output/json: Refactor output buffer size macro 7 years ago
Victor Julien e956b484c5 eve/json: handle common options in central function 8 years ago
Victor Julien df1ec82b55 eve/json: move common settings into it's own struct 8 years ago
Victor Julien 710c7b821f output/json: update callers to use explicit directions 9 years ago
Victor Julien 44c4008f77 output/json: clean up CreateJSONHeader calls 9 years ago
Jason Ish 7f5439a300 eve: dnp3: respect global metadata config 9 years ago
Jason Ish 00e6cd4ced output: introduce init return type
The new OutputInitResult is a struct return type that allows
logger init functions to return a NULL context without
raising error.

Instead of returning NULL to signal error, the "ok" field will
be set to false. If ok, but the ctx is NULL, then silently
move on to the next logger.

Use case: multiple versions of a specific logger, and one
implementation decides the configuration is not for that
implemenation. It can return NULL, ok.
9 years ago
Victor Julien d634140fa2 logging: unique id's per log direction
For loggers that register once per direction, use unique id's per
direction.

Reshuffle id's to keep tx log id's low so we can use u32 for tracking
logged loggers.
9 years ago
Jason Ish c4d30ddaf9 eve: fix context datatype used in init functions
Many were using AlertJsonThread instead of OutputJsonCtx,
but as the datatypes were similar enough no harm was done.

Now that they are using their proper datatype, removed
AlertJsonThread from output.h as its no longer used.
9 years ago
Jason Ish b005cceb0a eve.dnp3: removed unsed context field 9 years ago
Victor Julien ab1200fbd7 compiler: more strict compiler warnings
Set flags by default:

    -Wmissing-prototypes
    -Wmissing-declarations
    -Wstrict-prototypes
    -Wwrite-strings
    -Wcast-align
    -Wbad-function-cast
    -Wformat-security
    -Wno-format-nonliteral
    -Wmissing-format-attribute
    -funsigned-char

Fix minor compiler warnings for these new flags on gcc and clang.
9 years ago
Jason Ish f0de1d04a9 DNP3: Use directional logging.
Instead of waiting for a transaction complete, log the
request as soon as it is completes which will give it a
more accurate timestamp.
10 years ago
Jason Ish a59f31a99f DNP3: Lua detect support.
Adds support for access the DNP3 transaction in Lua rules.
10 years ago
Jason Ish 1c3f373543 DNP3: Log DNP3 transactions. 10 years ago