Commit Graph

40 Commits (50a762bfd164e27c55624c7e4f7e3c2e064ca788)

Author SHA1 Message Date
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.
8 years ago
Clément Galland 3396747cd6 Dns logger display flags information 8 years ago
Giuseppe Longo 44bf785ecf dns: log flags field
This adds dns header's flags in eve
log.

Signed-off-by: Eric Leblond <eric@regit.org>
8 years ago
Jason Ish ba1a67e2cb rust: dns: add log filtering on rrtype
While the filtering is still configured in C, the filtering
flags are passed into Rust so it can determine if a record
should be logged or not.
8 years ago
Jason Ish 73388042b2 rust: DNS app-layer.
A DNS application layer in Rust. This is different than the
C based one, as it is partially stateless by not matching
up responses to replies.
8 years ago
Jason Ish c7ddbbc586 dns: fix log filtering
Previously only a subset of the records could be selected
in custom. Now allow any to be selected.
8 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.
8 years ago
Victor Julien 71710f088e dns: fix outputs with 0-len A/AAAA records 9 years ago
Jason Ish 3fab684f97 logging: don't log that json is disabled in each logger
A warning log is already emitted if eve-log is enabled in the
configuration but json support is not built so the logger
registration functions can be silent.
9 years ago
Jason Ish 1b4ba4496c logging: rename registration functions to not have tmm
As the logging modules are no longer threading modules, rename
them so they don't look like they are being registered as
threading modules.

Also, move the registration to the output.c which will handle
registration of the loggers.
9 years ago
Jason Ish fa27a76462 logging: add profiling back for non-tmm loggers
The loggers moved away from a TMM required a new
profiling support.
9 years ago
Jason Ish 687602c0ca logging: convert eve dns logging to non-thread module 9 years ago
Victor Julien 1cc5f9825d dns: use nonnull attr for log functions 9 years ago
Victor Julien bbcc22d2ad dns: fix coverity warning
** CID 1372324:  Null pointer dereferences  (FORWARD_NULL)
/src/output-json-dns.c: 532 in OutputAnswer()

________________________________________________________________________________________________________
*** CID 1372324:  Null pointer dereferences  (FORWARD_NULL)
/src/output-json-dns.c: 532 in OutputAnswer()
526             }
527         }
528
529         /* reset */
530         MemBufferReset(aft->buffer);
531         json_object_set_new(djs, "dns", js);
>>>     CID 1372324:  Null pointer dereferences  (FORWARD_NULL)
>>>     Dereferencing null pointer "entry".
532         if (likely(DNSRRTypeEnabled(entry->type, aft->dnslog_ctx->flags))) {
533             OutputJSONBuffer(djs, aft->dnslog_ctx->file_ctx, &aft->buffer);
534         }
535         json_object_del(djs, "dns");
536
537         return;

Move checks to the top of the functions. Should be more efficient too.
9 years ago
Victor Julien 2eb941f9d9 output dns: fix bit declarations 9 years ago
Tom DeCanio 0f6c8806a0 output-json-dns: dns output filtering. 9 years ago
Victor Julien a8da6bbd71 output: use safer logic for fingerprint printing 9 years ago
Jason Ish 73a0451070 output-json-dns: allocate correct size hexstring buffer
The buffer allocated for the hexstring was not large enough
for a ':' separated hex string.
9 years ago
Jason Ish f397e7bfc2 dns: directional logging
Register loggers for to server and to client so requests
and responses can be logged independently of each other.

This results in the request log having the actual timestamp of
the request instead of the reply.
9 years ago
Victor Julien 1334859379 dns: add support for sshfp records
Update parser to process the records.

Update json output to log it.
9 years ago
maxtors 69863f7b1c Corrected and unified debugmessages for init data errors in *ThreadInit. 9 years ago
Victor Julien c446abeb47 jansson: include in suricata-common.h 10 years ago
Tom DeCanio 8f059b2841 output-json-dns: add logging of NS answer record content. 10 years ago
Victor Julien 8bb1cf08ef eve: fix mishandling of big messages
When the string representation of a JSON message grew bigger than
64k, the JSON record would just be truncated. This lead to errors
in the parser(s) of the JSON stream.

This patch changes the buffer logic to grow the buffer on demand.
10 years ago
Jason Ish b512580bbe logging: integrate rotation into SCConfLogOpenGeneric.
Addresses issue 1492, and will make it harder to omit
rotation on new outputs.
10 years ago
David Cannings 2918a75da1 Added support for full parsing of the rcode header in DNS answer
packets. Where rcode isn't "no error" this is displayed in both DNS and
JSON logs.

Note that this changes the current "No such domain" to "NXDOMAIN" in DNS
logs. This could be fixed if desired to maintain compatibility with
anybody crazy enough to parse the DNS log.

When the rcode is not "no error" (for example NXDOMAIN or SERVFAIL) it
is unlikely that there will be answer RRs. Therefore the rname from the
query is used.

Because the rcode applies to a whole answer packet (not individual
queries) it is impossible to determine which query RR caused the error.
Because of this most DNS servers currently reject multiple queries per
packet. Therefore each query RR is output instead with the relevant
error code, likely to be FORMERR if queries > 1.
10 years ago
Ken Steele 8f1d75039a Enforce function coding standard
Functions should be defined as:

int foo(void)
{
}

Rather than:
int food(void) {
}

All functions where changed by a script to match this standard.
11 years ago
Victor Julien de4e2221d8 eve: add tx_id to output for alerts and events
Add tx_id field for correlating alerts and events per tx.
11 years ago
Victor Julien 462f9de134 dns: unify type to string logging utility
Both DNS loggers had their own CreateTypeString. This patch unifies
them.
11 years ago
Victor Julien 5e87257845 dns: add names for common types
Add names for SRV, NAPTR, DS, RRSIG, NSEC, NSEC3 types.
11 years ago
Victor Julien bddb2c3bdc dns json: log TXT response data
Log TXT data in the rdata field.
11 years ago
Tom DeCanio 11ca25ddca eve-log: swap ip/port pairs in dns answers 11 years ago
Victor Julien 7ee3b456a3 dns-json: fix cleanup
Use specialized cleanup function for sub-module case. Freeing the
LogFileCtx is not the responsibility of a sub-module.
11 years ago
Victor Julien 4ce1fd347e json dns: fix tx logic
The JSON DNS logger would still have some conditions in the main
Logger function. This led to some transactions not beeing logged.
12 years ago
Victor Julien a3b0577a1f output: add TM_FLAG_LOGAPI_TM thread module flag
The TM_FLAG_LOGAPI_TM flag indicates that a module is run by the log
api, not by the 'regular' thread module call functions.

Set flag in all all Log API users' registration code.

Purpose of this flag is in profiling. In profiling output it will be
used to list log api thread modules separately.
12 years ago
Victor Julien 74fb60c010 Replace remaining SCStrndup calls
Replace them with BytesToString().
12 years ago
Eric Leblond 6fd9b4b255 json: add event_type key
This patch adds an event_type key to the generated events. Current
value is one of "dns", "alert, "file", "tls", "http", "drop". It is
then easy to differentiate in log analysis tools the events based on
source inside Suricata.
12 years ago
Eric Leblond 93a84180dc json dns: do not use array to output answer
Without this patch DNS answers for a single query are stored in a
single json event. The result is an array in the object like this one:
 {"type":"answer","id":45084,"rrname":"s-static.ak.facebook.com","rrtype":"CNAME","ttl":734},
 {"type":"answer","id":45084,"rrname":"s-static.ak.facebook.com.edgekey.net","rrtype":"CNAME","ttl":1710},
This type of output is not well supported in logstash. It is
displayed as it is written above and it is not possible to
query the fields.

I think the reason is that this is not logical if we consider search
query. For example if we search for "rrname" equal "s-static.ak.facebook.com"
we got one entry with two values in it. That's against the logic
of event. Furthermore, if we want to get a complete query, we can
used the id.

This patch splits the answer part in mulitple message. The result
is then accepted by logstash and fields can be queried easily.
12 years ago
Eric Leblond eab0b7fae9 json-dns: sync field names with draft rfc2629
This patch updates DNS field name to be in sync with RFC 2629:
 https://github.com/adulau/pdns-qof
This will allow to easily use Suricata with other passive DNS tools.
12 years ago
Victor Julien 6cecb4e4d2 json dns: rename output-dnslog -> output-json-dns 12 years ago