Commit Graph

16806 Commits (c33bebd630b304ab2a6ea9cf13fb150d7abf0fbc)
 

Author SHA1 Message Date
Jason Ish c33bebd630 rust: remove allow of static mutables
As references to static mutables are highly discouraged, remove the
global suppressing of the compiler warning. Each use case can be
suppressed as needed.

Ticket: #7417
2 days ago
Jason Ish 4a2f10d235 smb: wrap read access to static mutables in function
Simply wrapping in a function removes static_mut_refs compiler
warning.

Ticket: #7417
2 days ago
Jason Ish d8c080b268 smtp: suppress static_mut_refs where needed
Allows us to get rid of the global supression.

Ticket: #7417
2 days ago
Jason Ish 9ed5b4c002 smtp: remove SCMimeSmtpConfigExtractUrlsSchemeReset
It doesn't appear to be needed. The vec being cleared is only set once
per run, so never needs to be cleared.

Removes one point where we have to supress the static_mut_refs compiler
warning.

Ticket: #7417
2 days ago
Philippe Antoine 97ee95c1a2 dns: move unit tests to suricata-verify
Ticket: 3725
Ticket: 7529
3 days ago
Jeff Lucovsky 49d4686144 main/flush: Support periodic flush logs
Issue: 3449
3 days ago
Jeff Lucovsky 36111450ac detect/flag: Pseudo pkt "flush log" flag
Issue: 3449

Add a flush directive to the packet that is distinct from the existing
"log flush" flag as the new flag is to distinguish between the 2 use
cases.
3 days ago
Jeff Lucovsky b18622554d output/log: Add flushing infrastructure
Issue: 3449

Add flushing functions and infrastructure. This includes:
- Flushing functions for packet loggers
- Log file flushing support
3 days ago
Jeff Lucovsky 04767f69fc output: Support buffer-size value
Issue: 3449
3 days ago
Jeff Lucovsky a3a3ad8968 doc/output: EVE output buffering related settings 3 days ago
Jeff Lucovsky 92b2aebe75 conf/output: Buffering related config settings
This commit adds 2 EVE output buffering settings
- buffer-size value which specifies the amount of buffering, if any,
  for regular/file output types.
- flush-interval Specifies the cadence at which Suricata will direct
  detect threads to flush EVE output.

Issue: 3449
3 days ago
Jeff Lucovsky 7621029507 output/log: Add flush function, collapse params
Issue: 3449

Add a flush function to packet logger registration and collapse the
parameter count for registration functions.
3 days ago
Philippe Antoine 80dbaac206 flow: remove unused definition
Fixes: 3f3964555e ("detect/iponly: use flow first flags")
4 days ago
Victor Julien e1446c30fa detect/alert: optimize no-alert path
Skip qsort call if no alerts are queued. Move logic into inline helper func.
4 days ago
Victor Julien 98423a0009 detect: constify arguments 4 days ago
Victor Julien 39b030b791 detect/tx: improve branch prediction 4 days ago
Victor Julien 1000b0cf33 app-layer: optimize pstate check
To assist branch prediction, which showed a 100% miss rate, assume pstate
is non-NULL. Code review suggests all paths leading to the function actually
check pstate first, or alstate which can only be non-NULL if pstate was first
initialized. For now add a debug check.
4 days ago
Victor Julien 99eda1504a threads/flow: assist branch prediction 4 days ago
Victor Julien f876baab6b detect/pmq: assist branch prediction 4 days ago
Jeff Lucovsky dd344bd07c ftp: Move config file handling to Rust
Issue: 4082

Move the configuration file handling to Rust.

These changes will no longer terminate Suricata when there's an invalid
value for ftp.memcap. Like earlier Suricata releases, an error message
is logged "Invalid value <value> for ftp.memcap" but Suricata will no
longer terminate execution. It will use a default value of "0" instead.
4 days ago
Jeff Lucovsky f0410c93d0 ftp: convert enumerations to Rust
As part of the effort to convert the FTP/FTPDATA parser to rust, move
the enums from C to rust.

Issue: 4082
4 days ago
Philippe Antoine 8c3bd3e8a0 dcerpc: consume bytes after gap resync
Ticket: 7567

After a gap, we search a new record that may start later than
the beginning of current stream slice.
If so, consume the first bytes before the start of the record,
so that AppLayerResult::incomplete can be consistent and not
trigger assertion !((res.needed + res.consumed < input_len))
4 days ago
Philippe Antoine 3bc2a14fbf rust: fix clippy 1.85 precedence warnings
warning: operator precedence can trip the unwary
   --> src/jsonbuilder.rs:781:36
    |
781 |                 buf[offset] = HEX[(x >> 4 & 0xf) as usize];
    |                                    ^^^^^^^^^^^^ help: consider parenthesizing your expression: `(x >> 4) & 0xf`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#precedence
    = note: `#[warn(clippy::precedence)]` on by default
1 week ago
Philippe Antoine 726de5520f quic: discard late retry packets
Ticket: 7556

See RFC 9000 section 17.2.5.2 :
After the client has received and processed an Initial
or Retry packet from the server,
it MUST discard any subsequent Retry packets that it receives.
1 week ago
Jeff Lucovsky e45204aecf detect/transform: Refactor setup/apply pattern
git grep -A 1 -w InspectionBufferSetup shows many cases of the following
call patterns:
    - InspectionBufferSetup
    - InspectionBufferApplyTransforms

Refactor the implementations of those functions into
InspectionBufferSetupAndApplyTransforms to reduce function call count.

Issue: 2290 (related to changed for this issue)
1 week ago
Shivani Bhardwaj a551674eae dcerpc: add iface to dcerpc request event
so as to avoid extra steps for correlation among events to find
this information.

Feature 7565
1 week ago
Jason Ish 4cdb879538 rust/bindgen: use temp file to generating bindings
Prefixing a file with sed doesn't appear to be portable. Instead, make
use of a temporary file.

Fixes generating the bindings on FreeBSD and Mac.
1 week ago
Alice Akaki 73ae6e997f detect: add ldap.responses.dn
ldap.responses.dn matches on LDAPDN from responses operations
This keyword maps the following eve fields:
ldap.responses[].search_result_entry.base_object
ldap.responses[].bind_response.matched_dn
ldap.responses[].search_result_done.matched_dn
ldap.responses[].modify_response.matched_dn
ldap.responses[].add_response.matched_dn
ldap.responses[].del_response.matched_dn
ldap.responses[].mod_dn_response.matched_dn
ldap.responses[].compare_response.matched_dn
ldap.responses[].extended_response.matched_dn
It is a sticky buffer
Supports prefiltering

Ticket: #7471
1 week ago
Alice Akaki 16dcee46fc detect: add ldap.request.dn
ldap.request.dn matches on LDAPDN from request operations
This keyword maps the following eve fields:
ldap.request.bind_request.name
ldap.request.add_request.entry
ldap.request.search_request.base_object
ldap.request.modify_request.object
ldap.request.del_request.dn
ldap.request.mod_dn_request.entry
ldap.request.compare_request.entry
It is a sticky buffer
Supports prefiltering

Ticket: #7471
1 week ago
Alice Akaki 8f807fcfcf doc: use the ldap protocol in rule examples in the LDAP keywords documentation 1 week ago
Alice Akaki 31ee18b5be doc: replace 'eve' with 'EVE' in the LDAP keywords documentation 1 week ago
Alice Akaki 7b350e9933 misc: fix name prefix in detect register functions 1 week ago
Philippe Antoine 359f736542 util: fix -Wshorten-64-to-32 warnings
Ticket: #6186
1 week ago
Philippe Antoine d61f36c66f quic: decrypt only initial packets
Ticket: 7556

Avoids failed_decrypt events when the first packet seen is not
a Quic Initial packet
1 week ago
Philippe Antoine 6d8910d245 quic: handle retry packets
Ticket: 7556
1 week ago
Philippe Antoine f295cc059d quic: handle fragmented hello over multiple packets
Ticket: 7556

To do so, we need to add 2 buffers (one for each direction)
to the QuicState structure, so that on parsing the second packet
with hello/crypto fragment, we still have the data of the first
hello/crypto fragment.

Use a hardcoded limit so that these buffers cannot grow indefinitely
and set an event when reaching the limit
1 week ago
Philippe Antoine 68adc87bd2 quic: parse ack frame number 3
cf rfc9000 section 19.3. ACK Frames

Ticket: 7556
1 week ago
Philippe Antoine ee04d667b5 quic: move all_consuming check to callee
Will alow to have decode_frames accept one additional parameter
with past fragment data
1 week ago
Philippe Antoine 294a33a890 quic: rustfmt 1 week ago
Philippe Antoine 649f30b46b htp: macro hygiene
make clang-tidy happy even if unneeded for the temporary workaround
1 week ago
Philippe Antoine 9e73de3d80 http: aliases for htp log code
In preparation of libhtp rust
1 week ago
Philippe Antoine 62a4254f5b http: constify some variables
In preparation of libhtp rust
1 week ago
Philippe Antoine 486bdc99c0 http: aliases for opaque htp_conn_t
In preparation of libhtp rust
1 week ago
Philippe Antoine e079604f79 http: aliases for opaque htp_tx_data_t
In preparation of libhtp rust
1 week ago
Jason Ish 6fc617c652 build: use expanded localstatedir for #define
Use the expanded form of localstatedir in autoconf.h instead of the
unexpanded one, the difference being:

    #define LOCAL_STATE_DIR "${prefix}/var"

and

    #define LOCAL_STATE_DIR "/usr/local/var"

assuming default ./configure arguments.

Fixes commit b6a610df26.
1 week ago
Juliana Fajardini ae00181736 pgsql/parser: fix type complexity clippy warning
Cf https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
1 week ago
Juliana Fajardini a4ce9cfe15 pgsql/logger: don't log empty transactions
This may happen in some situations if the app-layer parser only sees
unknown messages and sets an event: there will be an empty transaction,
but nothing to log.

Related to
Task #5566
1 week ago
Juliana Fajardini d676d711ee pgsql: add case for Unknown response message state
No state change, but since we added Unknown responses, we should handle
that case -- should we have a specific state for such cases?

Related to
Bug #5524
Task #5566
1 week ago
Juliana Fajardini 1b6f4da23b pgsql: add events
Events for:
- parsing error when parsing pgsql packet length
- parsing error for pgsql requests (post length parsing)
- parsing error for pgsql responses (post length parsing)
- too many transactions

Include `pgsql-events.rules` file, and PGSQL events SID range definition

Task #5566
1 week ago
Juliana Fajardini 6eadb752ec pgsql/parser: add more debug statements 1 week ago