Commit Graph

18863 Commits (5bbe99188b71ccd9d9b2d0130857df50b6fd0600)
 

Author SHA1 Message Date
Jeff Lucovsky d0ba1c4c5e output/flush: Remove pkt-based flush logic
Remove packet-based flush logic in favor of simpler solution

Issue: 8286
4 months ago
Jeff Lucovsky a78911fce7 output/flush: Add EVE flushing logic
Add flushing logic driven off of the file contexts. This is a simpler
solution that removes the need for logger registration changes.

Overview:
Use the heartbeat-driven thread to periodically flush all registered EVE
contexts via a global flush list.

The global flush list is a mutex-protected TAILQ of LogFileFlushEntry
nodes; each node points to a LogFileCtx. Mutex = log_file_flush_mutex

Periodic flushing performed by a thread according to the
heartbeat.output-flush-interval [1,60]. LogFileFlushAll() is invoked to
initiate flushing of registered LogFileCtx structs; each struct's
fp_mutex is obtained while the flush occurs to synchronize with
LogFileWrite activity.

Interacts with file-rotation via the fp_mutex.

Deadlock prevention: the log_file_flush_mutex must be obtained before
the fp_mutex.

Issue: 8286
4 months ago
Philippe Antoine d4c036718a detect/geoip: do not require packet
Ticket: 8333

Allows to pass on pseudo packets

So, that a ruleset like
pass ssh any any -> any any (geoip:any,US,IN; sid: 1;)
drop ip any any -> any any (flow:established, to_server; sid:2;)

Does not lead to a drop on the pseudo-packet when we flush
because ssh traffic gets encrypted
4 months ago
Victor Julien bc4a055e73 github-ci: remove coveralls
Seems less reliable than codecov, so remove again.
4 months ago
Juliana Fajardini c790a9f774 userguide/exceptions: update for qa-simulation use
The docs still referred to ``debug`` mode.

Related to
Task #7885
4 months ago
Juliana Fajardini 56917cf8f3 rules: fix typos & missing keywords in examples
Task #8372
4 months ago
Jason Ish 9cab99fbd3 rust: rust fmt derive crate 4 months ago
Jeff Lucovsky 14ebba6382 gen/unused: Remove unused function
Remove unused function is_alphanumeric_or_slash
4 months ago
Jeff Lucovsky 98070a7ace misc/cleanup: remove rust if <cond> ....
Cleanup the few instances of rust where if cond return true else false
exist

rg = ripgrep

rg -n -U '^\s*if .* \{\s*\n\s*return true;\s*\n\s*\}\s*\n\s*return false;' rust/src/ --glob '*.rs'

rg -n -U '^\s*if .* \{\s*\n\s*return false;\s*\n\s*\}\s*\n\s*return true;' rust/src/ --glob '*.rs'
4 months ago
Jeff Lucovsky 022a79fdd5 misc/cleanup: Simplify <cond> ? true : false
Simplify statements where there's a conditional statement followed by
return true or return false.

Instead of
    if (conditional)
        return true;
    else
        return false;

Use:
        return conditional
4 months ago
Jason Ish 468a13e052 log-cf-common: let mktime determine proper tz
In some timezones, LogCustomFormatTest01 was failing as we were
specifying the wrong setting for is_dst. Instead set it to -1 so mktime
can make the decision based on the environment. Appears to fix this test
for "Brazil/East" in the summer.

Add GitHub CI tests to test this specific test with a few different
timezones.
4 months ago
Philippe Antoine 6587e363a3 dcerpc: use bind context_id in SMB
Ticket: 8375

logger already read this variable but it was never set, and
the rust compiler did not warn about this

Allows to log the interface uuid when ctx_id > 0

Wireshark filter for related pcaps
dcerpc.cn_ctx_id > 0 && dcerpc.pkt_type == 0
4 months ago
Philippe Antoine 2c2a3c800f dcerpc: support multiple PDU in one parser call
Ticket: 7254

With TCP, we receive a stream of data, which may contain multiple
PDUs in one call
4 months ago
Philippe Antoine db51314478 rust: rustfmt dcerpc.rs 4 months ago
Philippe Antoine 55ad2953bf dcerpc: do not error the whole flow on unhandled packet type
Ticket: 5133
4 months ago
Jason Ish e9f8e17b16 rust/Makefile: add RUSTC and RUSTDOC to CARGO_ENV
And consistently use the CARGO_ENV for all cargo calls.

This allows a user to point to rust binaries that are not on their
path just during ./configure, for example:

  PATH=/usr/lib/rust-1.89/bin:$PATH ./configure ...

The full path to rustc and rustdoc will now be used, as discovered in
the PATH without the user have to carry the path over to the "make"
command. This was already done for cargo.

Related to ticket: #8381
4 months ago
Jason Ish 551f6ded69 github-ci: update almalinux minimal build to use dist archive
Update the AlmaLinux recommended minimal build to use the pre built
distribution archive as this is the type of build the documentation is
targetting.
4 months ago
Jason Ish 87dba92bdd github-ci: update debian/ubuntu minimal build to use dist
Update the Ubuntu/Debian minimal recommended build to use the
pre-built dist archive instead of building from git, as that is the
type of build this documentation targets.

Also use the ubuntu:22.04 container. The GitHub provided Ubuntu 22.04
VM appears to contain some new additions like a newer Rust that is not
found on a typical Ubuntu 22.04 installation.
4 months ago
Philippe Antoine ebe0ba4ebb rust: limit clap verson to 4.5.57
clap 4.5.58 and further requires edition2024 which is incompatible with MSRV
4 months ago
Jason Ish 46d666cdde github-ci: enable debug for ndpi, pfring and netmap builds 4 months ago
Victor Julien 1732257923 ldap: add rules file to dist 4 months ago
Victor Julien 45d94a7726 stream: restore pcap_cnt in debug output 4 months ago
Victor Julien ac1a514c7b stream/reassembly: improve progress tracking for GAP cases
When during raw reassembly it is detected that last ack is moved beyond
the progress and also beyond the data retrieved, update progress to the
last ack value.

Bug: #8272.
4 months ago
Philippe Antoine 76d2925bdf ldap: abandon request does not wait for a response
Ticket: 8356

As such, abandon request is a complete tx
4 months ago
Philippe Antoine 784e173278 http2: bound number of http2 frames per tx
Ticket: 8289

If stream.reassembly.depth is unlimited,
an attacker controlling the 2 sides of a communication going through Suricata
can send a transition with an infinite number of headers, until suricata OOMs

Solution is to offer a configuration option to bound the number
of HTTP2 frames we store in a HTTP2 transaction, and produce an
anomaly if this bound is crossed
4 months ago
Philippe Antoine cb76301581 detect/tls: add null check for tls.alpn keyword
Ticket: 8294

Fixes: 6c1238b7bd ("tls: Integrate ALPNs into HandshakeParams object")

May happen if we analyze TLS without seeing the hello
4 months ago
Philippe Antoine 49fd7001ff smtp/mime: fix urls finding in buffering case
We used to look for a full line, but as we look fot the last eol
we need to use the right index in the not-reversed list
4 months ago
Philippe Antoine 8bba47aa09 smtp/mime: avoid quadratic complexity in mime_smtp_find_url_strings
Ticket: 8292

When we have buffered something in ctx.decoded_line,
we already looked for '\n' in it, so we do not need to run it again

Otherwise, callers that supply mime_smtp_find_url_strings with
a few bytes at a time without "\n", have a quadratic
complexity
4 months ago
Juliana Fajardini 8c29c471b4 userguide: add references to rules/README to docs
To make it more visible/easier to find.
4 months ago
Giuseppe Longo b6fa3c8e8c ldap: add ldap.rules file
Add a file containing rules to match LDAP protocol events.

Ticket #8368
4 months ago
Philippe Antoine 062f56ddde detect/http2: use ThreadCtx for all headers keywords
Instead of custom inefficient "escaped" Vec

Ticket: 8291
4 months ago
Philippe Antoine 4e538dfa3b detect/http2: use ThreadCtx for http.request_header
And also for http.response_header

Instead of custom inefficient "escaped" Vec

Ticket: 8291
4 months ago
Philippe Antoine 0933e944df detect/http2: use ThreadCtx for http.header.raw
Instead of custom inefficient "escaped" Vec

Ticket: 8291
4 months ago
Philippe Antoine 711de8a5ea detect/http2: use ThreadCtx for http.header
Instead of custom inefficient "escaped" Vec

Ticket: 8291
4 months ago
Philippe Antoine 52a2f2dd19 detect/http2: use ThreadCtx for http.header_names
Instead of custom inefficient "escaped" Vec

Ticket: 8291
4 months ago
Jason Ish 648a867049 psl: update to 2.1.197
Update the Mozilla public suffix list to 2.1.197.
4 months ago
Philippe Antoine 61b5461782 app-layer: fix uint overflow in debug assertion
Krb5 can request it needs a 0xFFFFFFFF record
4 months ago
Philippe Antoine 8e886a8ecd krb5: use app-layer incomplete support
Ticket: 3540
Ticket: 8305
4 months ago
Lukas Sismis 0cb88d6260 configure: move -march=native flag insertion at the end
When libraries add their own -march flags to CFLAGS, let them.
But if -march=native should be added (it should by default),
add it as the last -march flag to "win".
This ensures, that even if a library brings their own minimal -march,
it will not downgrade the instruction set for the whole Suricata.
This happened with DPDK which, when enabled, downgraded the instruction
set to -march=corei7 or -march=haswell.

When building packages with --disable-gccmarch-native, the instruction set
is auto-upgraded to instruction set requested by libraries.
E.g. from RPM builds: `CFLAGS="-march=x86_64" ./configure --enable-dpdk`
upgrades instruction set to DPDK's corei7 architecture.

Ticket: 8169
4 months ago
Lukas Sismis 1d06103e08 dpdk: adjust burst size to mempool size
When mempool size was configured really low (<32), Suricata exhausted
the mempool with the rx_burst call, which led to undefined behavior.
The current fix ensures the burst size is at most the size of the mempool,
if the mempool is smaller than BURST_SIZE macro.
4 months ago
Victor Julien 565c1831a0 detect: convert unittest into fail/pass api 4 months ago
Victor Julien 25a8559cd4 pcap/file: add proto check for fuzzing
Based on review it seems p->proto should always be set to the same
value as what `PacketGetIPProto` returns. Add a check to validate
in a decoder that the fuzzer executes.
4 months ago
Victor Julien 2658a366ad qa: move live tests into qa/live dir
They are not github specific.
4 months ago
Victor Julien cb24430a0a firewall: don't overwrite with ips mode
When a capture method set IPS mode, it could overwrite already set Firewall mode.

Ticket #8311.
4 months ago
Antoine Abou Faysal 29834e3917 plugins/ndpi: guard against NULL f->storage in all callbacks 4 months ago
Giuseppe Longo a072ca02be suricata.yaml: add missing modbus logger
Ticket #8347
4 months ago
Philippe Antoine d77c43c79b rust/ffi: move build_slice macro to ffi crate
Ticket: 7666
4 months ago
Philippe Antoine 4a0143c8d4 rust/ffi: move cast_pointer macro to ffi crate
Ticket: 7666
4 months ago
Philippe Antoine aae154874b src/detect: remove unneeded variables
just use the constant
4 months ago
Philippe Antoine 65993d4a41 util/lua: remove unneeded variable
just use the constant
4 months ago