]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
5 months agogithub-ci: skip rpm builds for now 12685/head
Jason Ish [Tue, 25 Feb 2025 16:53:44 +0000 (10:53 -0600)] 
github-ci: skip rpm builds for now

RPMs will need to be fixed after merge.

5 months agogithub-ci: add var to disable rpm builds
Jason Ish [Tue, 11 Feb 2025 23:09:23 +0000 (17:09 -0600)] 
github-ci: add var to disable rpm builds

There will be changes in our development branch that the RPMs need to
adapt to, but that can't be done until the changes have been merged to
master, then the RPM can catchup.

This gives us a single variable to turn off RPM building.

5 months agodoc: add upgrade note about suricatasc and suricatactl
Jason Ish [Mon, 10 Feb 2025 22:09:23 +0000 (16:09 -0600)] 
doc: add upgrade note about suricatasc and suricatactl

5 months agodist: include generate-evedoc.sh
Jason Ish [Mon, 10 Feb 2025 21:21:20 +0000 (15:21 -0600)] 
dist: include generate-evedoc.sh

Without this script `make distcheck` fails on a system with
documentation tooling installed, as its required to build the EVE
appendix.

5 months agogithub-ci: add check for update to date Cargo.lock.in
Jason Ish [Mon, 10 Feb 2025 19:47:57 +0000 (13:47 -0600)] 
github-ci: add check for update to date Cargo.lock.in

After a build, check if Cargo.lock.in and Cargo.lock differ, if so,
Cargo.lock.in needs an update as part of a depedency update.

5 months agodoc: remove python references related to suricatasc
Jason Ish [Thu, 6 Feb 2025 21:12:39 +0000 (15:12 -0600)] 
doc: remove python references related to suricatasc

These should probably be removed even without the rewrite, and
suricatasc has been installed as a proper program for many releases.

5 months agoqa: fix suricatasc path
Jason Ish [Sun, 22 Dec 2024 16:46:28 +0000 (10:46 -0600)] 
qa: fix suricatasc path

5 months agopython: remove python implementation of suricatasc/suricatactl
Jason Ish [Thu, 16 Nov 2023 22:19:23 +0000 (16:19 -0600)] 
python: remove python implementation of suricatasc/suricatactl

5 months agosuricatactl: rust version of suricatactl
Jason Ish [Tue, 27 Jun 2023 06:28:07 +0000 (00:28 -0600)] 
suricatactl: rust version of suricatactl

5 months agogithub-ci: do one Windows build from dist archive
Jason Ish [Thu, 4 May 2023 17:40:13 +0000 (11:40 -0600)] 
github-ci: do one Windows build from dist archive

As we have 2 Windows builds, do one using the release-style
distribution file.

5 months agosuricatasc: a Rust implementation of suricatasc
Jason Ish [Fri, 3 Mar 2023 14:54:07 +0000 (08:54 -0600)] 
suricatasc: a Rust implementation of suricatasc

This is a re-implementation of suricatasc program in Rust that
attempts to be a 100% drop-in replacement.

5 months agorust: remove allow of static mutables
Jason Ish [Mon, 24 Feb 2025 22:47:28 +0000 (16:47 -0600)] 
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

5 months agosmb: wrap read access to static mutables in function
Jason Ish [Wed, 26 Feb 2025 15:29:40 +0000 (09:29 -0600)] 
smb: wrap read access to static mutables in function

Simply wrapping in a function removes static_mut_refs compiler
warning.

Ticket: #7417

5 months agosmtp: suppress static_mut_refs where needed
Jason Ish [Tue, 25 Feb 2025 16:18:12 +0000 (10:18 -0600)] 
smtp: suppress static_mut_refs where needed

Allows us to get rid of the global supression.

Ticket: #7417

5 months agosmtp: remove SCMimeSmtpConfigExtractUrlsSchemeReset
Jason Ish [Tue, 25 Feb 2025 16:15:57 +0000 (10:15 -0600)] 
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

5 months agodns: move unit tests to suricata-verify 12679/head
Philippe Antoine [Tue, 25 Feb 2025 20:14:51 +0000 (21:14 +0100)] 
dns: move unit tests to suricata-verify

Ticket: 3725
Ticket: 7529

5 months agomain/flush: Support periodic flush logs
Jeff Lucovsky [Sat, 7 Oct 2023 21:08:27 +0000 (17:08 -0400)] 
main/flush: Support periodic flush logs

Issue: 3449

5 months agodetect/flag: Pseudo pkt "flush log" flag
Jeff Lucovsky [Sat, 7 Oct 2023 21:06:52 +0000 (17:06 -0400)] 
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.

5 months agooutput/log: Add flushing infrastructure
Jeff Lucovsky [Tue, 30 Apr 2024 14:44:54 +0000 (10:44 -0400)] 
output/log: Add flushing infrastructure

Issue: 3449

Add flushing functions and infrastructure. This includes:
- Flushing functions for packet loggers
- Log file flushing support

5 months agooutput: Support buffer-size value
Jeff Lucovsky [Mon, 2 Oct 2023 15:01:45 +0000 (11:01 -0400)] 
output: Support buffer-size value

Issue: 3449

5 months agodoc/output: EVE output buffering related settings
Jeff Lucovsky [Sat, 14 Oct 2023 13:00:14 +0000 (09:00 -0400)] 
doc/output: EVE output buffering related settings

5 months agoconf/output: Buffering related config settings
Jeff Lucovsky [Mon, 2 Oct 2023 15:00:46 +0000 (11:00 -0400)] 
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

5 months agooutput/log: Add flush function, collapse params
Jeff Lucovsky [Tue, 30 Apr 2024 13:45:25 +0000 (09:45 -0400)] 
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.

5 months agoflow: remove unused definition 12675/head
Philippe Antoine [Tue, 25 Feb 2025 09:12:48 +0000 (10:12 +0100)] 
flow: remove unused definition

Fixes: 3f3964555e4e ("detect/iponly: use flow first flags")
5 months agodetect/alert: optimize no-alert path
Victor Julien [Sun, 23 Feb 2025 11:04:17 +0000 (12:04 +0100)] 
detect/alert: optimize no-alert path

Skip qsort call if no alerts are queued. Move logic into inline helper func.

5 months agodetect: constify arguments
Victor Julien [Sun, 23 Feb 2025 11:03:03 +0000 (12:03 +0100)] 
detect: constify arguments

5 months agodetect/tx: improve branch prediction
Victor Julien [Mon, 11 Sep 2023 15:04:15 +0000 (17:04 +0200)] 
detect/tx: improve branch prediction

5 months agoapp-layer: optimize pstate check
Victor Julien [Mon, 11 Sep 2023 07:22:16 +0000 (07:22 +0000)] 
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.

5 months agothreads/flow: assist branch prediction
Victor Julien [Mon, 11 Sep 2023 07:21:47 +0000 (07:21 +0000)] 
threads/flow: assist branch prediction

5 months agodetect/pmq: assist branch prediction
Victor Julien [Mon, 11 Sep 2023 07:21:28 +0000 (07:21 +0000)] 
detect/pmq: assist branch prediction

5 months agoftp: Move config file handling to Rust
Jeff Lucovsky [Sun, 2 Feb 2025 16:10:59 +0000 (11:10 -0500)] 
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.

5 months agoftp: convert enumerations to Rust
Jeff Lucovsky [Sun, 2 Feb 2025 14:12:59 +0000 (09:12 -0500)] 
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

5 months agodcerpc: consume bytes after gap resync
Philippe Antoine [Thu, 20 Feb 2025 22:36:27 +0000 (23:36 +0100)] 
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))

5 months agorust: fix clippy 1.85 precedence warnings 12653/head
Philippe Antoine [Fri, 21 Feb 2025 10:22:27 +0000 (11:22 +0100)] 
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

5 months agoquic: discard late retry packets
Philippe Antoine [Fri, 21 Feb 2025 09:38:06 +0000 (10:38 +0100)] 
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.

5 months agodetect/transform: Refactor setup/apply pattern
Jeff Lucovsky [Thu, 10 Oct 2024 13:31:12 +0000 (09:31 -0400)] 
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)

5 months agodcerpc: add iface to dcerpc request event
Shivani Bhardwaj [Wed, 19 Feb 2025 07:58:47 +0000 (13:28 +0530)] 
dcerpc: add iface to dcerpc request event

so as to avoid extra steps for correlation among events to find
this information.

Feature 7565

5 months agorust/bindgen: use temp file to generating bindings
Jason Ish [Wed, 19 Feb 2025 21:31:31 +0000 (15:31 -0600)] 
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.

5 months agodetect: add ldap.responses.dn
Alice Akaki [Thu, 6 Feb 2025 04:16:20 +0000 (00:16 -0400)] 
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

5 months agodetect: add ldap.request.dn
Alice Akaki [Tue, 4 Feb 2025 02:37:15 +0000 (22:37 -0400)] 
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

5 months agodoc: use the ldap protocol in rule examples in the LDAP keywords documentation
Alice Akaki [Wed, 19 Feb 2025 00:00:36 +0000 (20:00 -0400)] 
doc: use the ldap protocol in rule examples in the LDAP keywords documentation

5 months agodoc: replace 'eve' with 'EVE' in the LDAP keywords documentation
Alice Akaki [Tue, 18 Feb 2025 23:56:43 +0000 (19:56 -0400)] 
doc: replace 'eve' with 'EVE' in the LDAP keywords documentation

5 months agomisc: fix name prefix in detect register functions
Alice Akaki [Sun, 9 Feb 2025 04:50:25 +0000 (00:50 -0400)] 
misc: fix name prefix in detect register functions

5 months agoutil: fix -Wshorten-64-to-32 warnings
Philippe Antoine [Tue, 19 Sep 2023 12:45:47 +0000 (14:45 +0200)] 
util: fix -Wshorten-64-to-32 warnings

Ticket: #6186

5 months agoquic: decrypt only initial packets 12631/head
Philippe Antoine [Wed, 19 Feb 2025 09:08:58 +0000 (10:08 +0100)] 
quic: decrypt only initial packets

Ticket: 7556

Avoids failed_decrypt events when the first packet seen is not
a Quic Initial packet

5 months agoquic: handle retry packets
Philippe Antoine [Wed, 19 Feb 2025 12:01:36 +0000 (13:01 +0100)] 
quic: handle retry packets

Ticket: 7556

5 months agoquic: handle fragmented hello over multiple packets
Philippe Antoine [Mon, 17 Feb 2025 10:13:20 +0000 (11:13 +0100)] 
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

5 months agoquic: parse ack frame number 3
Philippe Antoine [Mon, 17 Feb 2025 14:04:59 +0000 (15:04 +0100)] 
quic: parse ack frame number 3

cf rfc9000 section 19.3. ACK Frames

Ticket: 7556

5 months agoquic: move all_consuming check to callee
Philippe Antoine [Mon, 17 Feb 2025 10:04:50 +0000 (11:04 +0100)] 
quic: move all_consuming check to callee

Will alow to have decode_frames accept one additional parameter
with past fragment data

5 months agoquic: rustfmt
Philippe Antoine [Mon, 17 Feb 2025 09:27:49 +0000 (10:27 +0100)] 
quic: rustfmt

5 months agohtp: macro hygiene
Philippe Antoine [Tue, 18 Feb 2025 20:23:19 +0000 (21:23 +0100)] 
htp: macro hygiene

make clang-tidy happy even if unneeded for the temporary workaround

5 months agohttp: aliases for htp log code
Philippe Antoine [Thu, 6 Feb 2025 15:09:10 +0000 (16:09 +0100)] 
http: aliases for htp log code

In preparation of libhtp rust

5 months agohttp: constify some variables
Philippe Antoine [Thu, 6 Feb 2025 13:51:28 +0000 (14:51 +0100)] 
http: constify some variables

In preparation of libhtp rust

5 months agohttp: aliases for opaque htp_conn_t
Philippe Antoine [Thu, 6 Feb 2025 13:31:40 +0000 (14:31 +0100)] 
http: aliases for opaque htp_conn_t

In preparation of libhtp rust

5 months agohttp: aliases for opaque htp_tx_data_t
Philippe Antoine [Thu, 6 Feb 2025 13:26:14 +0000 (14:26 +0100)] 
http: aliases for opaque htp_tx_data_t

In preparation of libhtp rust

5 months agobuild: use expanded localstatedir for #define 12625/head
Jason Ish [Tue, 18 Feb 2025 21:15:43 +0000 (15:15 -0600)] 
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 b6a610df2669336756c67f77eb857b190b77770a.

5 months agopgsql/parser: fix type complexity clippy warning
Juliana Fajardini [Tue, 18 Feb 2025 20:17:13 +0000 (17:17 -0300)] 
pgsql/parser: fix type complexity clippy warning

Cf https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity

5 months agopgsql/logger: don't log empty transactions
Juliana Fajardini [Mon, 17 Feb 2025 19:50:38 +0000 (16:50 -0300)] 
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

5 months agopgsql: add case for Unknown response message state
Juliana Fajardini [Mon, 17 Feb 2025 15:06:39 +0000 (12:06 -0300)] 
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

5 months agopgsql: add events
Juliana Fajardini [Mon, 17 Feb 2025 15:05:09 +0000 (12:05 -0300)] 
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

5 months agopgsql/parser: add more debug statements
Juliana Fajardini [Fri, 14 Feb 2025 17:46:00 +0000 (14:46 -0300)] 
pgsql/parser: add more debug statements

5 months agopgsql: apply rustfmt changes
Juliana Fajardini [Fri, 14 Feb 2025 16:29:33 +0000 (13:29 -0300)] 
pgsql: apply rustfmt changes

5 months agopgsql: don't always return error for parsing errors
Juliana Fajardini [Thu, 15 Sep 2022 15:19:43 +0000 (12:19 -0300)] 
pgsql: don't always return error for parsing errors

This allows the app-proto to continue onto parsing next PDUs, if
possible.

Bug #5524

5 months agopgsql: don't fail if proto parses unknown message
Juliana Fajardini [Fri, 7 Feb 2025 21:40:08 +0000 (18:40 -0300)] 
pgsql: don't fail if proto parses unknown message

Even if unknown, if the message is properly parsed, allow the parser to
proceed.

Related to
Bug #5524

5 months agopgsql/parser: always use fn for parsing PDU length
Juliana Fajardini [Mon, 17 Feb 2025 22:13:50 +0000 (19:13 -0300)] 
pgsql/parser: always use fn for parsing PDU length

Some inner parsers were using it, some weren't. Better to standardize
this. Also take the time to avoid magic numbers for representing the
expected lengths for pgsql PDUs.
Also throwing PgsqlParseError and allowing for incomplete results.

Related to
Task #5566
Bug #5524

5 months agopgsql: add PgsqlParserError
Juliana Fajardini [Mon, 17 Feb 2025 22:24:22 +0000 (19:24 -0300)] 
pgsql: add PgsqlParserError

Building on top of work done by Jason Ish.

Related to
Bug #5524

5 months agopgsql/parser: simplify response parsing
Juliana Fajardini [Fri, 7 Feb 2025 20:57:50 +0000 (17:57 -0300)] 
pgsql/parser: simplify response parsing

The initial parsing for message type checking was more complex than
needed be.

Related to
Bug #5524

5 months agopgsql/parser: fix response message length
Juliana Fajardini [Fri, 7 Feb 2025 15:16:53 +0000 (12:16 -0300)] 
pgsql/parser: fix response message length

Some backend messages can be the shortest pgsql length possible,
4 bytes, but the parser expectd all messages to be longer than that.

Related to
Bug #5524

5 months agogen/typo: Improve grammar
Jeff Lucovsky [Mon, 17 Feb 2025 17:08:00 +0000 (12:08 -0500)] 
gen/typo: Improve grammar

5 months agogen/bool: Clarify bool checks
Jeff Lucovsky [Mon, 17 Feb 2025 14:11:03 +0000 (09:11 -0500)] 
gen/bool: Clarify bool checks

Remove comparisons with true or false with C bools.

5 months agodetect/flow: move keyword parsing code to rust
Philippe Antoine [Mon, 17 Feb 2025 11:49:59 +0000 (12:49 +0100)] 
detect/flow: move keyword parsing code to rust

for flow.pkts and flow.bytes keywords

Ticket: 7562

Avoid null deref when parsing flow.bytes:toserver;

5 months agodetect/krb5: avoid integer underflow with krb5.ticket_encryption
Philippe Antoine [Mon, 17 Feb 2025 08:08:54 +0000 (09:08 +0100)] 
detect/krb5: avoid integer underflow with krb5.ticket_encryption

Ticket: 7560

When passing INT32_MIN aka 0x80000000, we cannot compute -vali
as it does not fit into a i32

5 months agoanalysis: report rule state altered by other rule
Juliana Fajardini [Fri, 17 Jan 2025 20:43:34 +0000 (17:43 -0300)] 
analysis: report rule state altered by other rule

Flowbits can make a rule such as a packet rule be treated as a stateful
rule, without actually changing the rule type.

Add a flag to allow reporting such cases via engine analysis.

Task #7456

5 months agodetect/flowbits: only walk over array if needed
Juliana Fajardini [Fri, 17 Jan 2025 20:41:19 +0000 (17:41 -0300)] 
detect/flowbits: only walk over array if needed

For setting s->init_data for flowbit rules impacted by `set`, we can
first check whether this will be needed, and *then* walk over the
flowbits array.

5 months agorust: add bindings to SCPlugin.* to sys crate 12357/head 12590/head
Jason Ish [Fri, 24 Jan 2025 15:56:58 +0000 (09:56 -0600)] 
rust: add bindings to SCPlugin.* to sys crate

Also disable bindgen's generated layout tests.  They are valid for the
platform generating the tests, but may not be valid for other
platforms. For example, if the tests are generated on a 64 bit
platform the tests will not be valid when run on a 32 bit platform as
pointers are a different size.

However, the generating bindings are valid for both platform.

Ticket: #7341

5 months agorust: add auto-generated header to sys.rs
Jason Ish [Fri, 24 Jan 2025 15:05:03 +0000 (09:05 -0600)] 
rust: add auto-generated header to sys.rs

We don't keep bindgen's autogenerated do not edit line as it contains
the bindgen version which could break the CI check for out of date
bindings. So add our own do not edit line.

Ticket: #7341

5 months agogithub-ci: test that bindgen bindings are up to date
Jason Ish [Fri, 24 Jan 2025 14:59:39 +0000 (08:59 -0600)] 
github-ci: test that bindgen bindings are up to date

Regenerates the `sys.rs` and looks for any difference. Check will fail
if there is a difference.

Ticket: #7341

5 months agorust: use AppProto from generated bindings instead of duplicating
Jason Ish [Thu, 23 Jan 2025 22:40:22 +0000 (16:40 -0600)] 
rust: use AppProto from generated bindings instead of duplicating

Have bindgen generate bindings for app-layer-protos.h, then use the
generated definitions of AppProto/AppProtoEnum instead if defining
them ourselves.

This header was chosen as its used by Rust, and its a simple header
with no circular dependencies.

Ticket: #7341

5 months agorust: integrate bindgen to generate Rust bindings to C
Jason Ish [Thu, 23 Jan 2025 22:26:25 +0000 (16:26 -0600)] 
rust: integrate bindgen to generate Rust bindings to C

Bindgen works by processing a header file which includes all other
header files it should generate bindings for. For this I've created
bindgen.h which just includes app-layer-protos.h for now as an
example.

These bindings are then generated and saved in the "suricata-sys"
crate and become availale as "suricata_sys::sys".

Ticket: #7341

5 months agorust/sys: stub in suricata-sys crate for Rust bindings to C
Jason Ish [Thu, 23 Jan 2025 22:19:09 +0000 (16:19 -0600)] 
rust/sys: stub in suricata-sys crate for Rust bindings to C

Follow Rust convention of using a "sys" crate for bindings to C
functions. The bindings don't exist yet, but will be generated by
bindgen and put into this crate.

Ticket: #7341

5 months agoconfigure: check for existence of bindgen
Jason Ish [Thu, 23 Jan 2025 22:14:36 +0000 (16:14 -0600)] 
configure: check for existence of bindgen

Require a minimum version of 0.66.0.

Ticket: #7341

5 months agodetect/profile: convert rule grouping dump to json builder
Victor Julien [Sat, 15 Feb 2025 18:20:14 +0000 (19:20 +0100)] 
detect/profile: convert rule grouping dump to json builder

Ticket: #7558.

5 months agotls: more permissive empty data eof check
Victor Julien [Thu, 13 Feb 2025 13:30:39 +0000 (14:30 +0100)] 
tls: more permissive empty data eof check

If not all data is ACK'd during the FIN session shutdown, the last calls
to the parser can be with a non-NULL data pointer, but a input length of
0. This wasn't considered by the EOF check, which then lead to it being
seen as an error. No event was raised, but the tls error stats were
incremented.

Bug: #7554.

5 months agoconfigure: require minimum version of cbindgen to be 0.20.0 12584/head
Jason Ish [Thu, 13 Feb 2025 17:35:46 +0000 (11:35 -0600)] 
configure: require minimum version of cbindgen to be 0.20.0

0.10.0 doesn't work anymore. In some combinations 0.20.0 doesn't work
either, however it does work in our CI jobs.

5 months agodatasets: move initial file reading to rust
Shivani Bhardwaj [Thu, 9 Jan 2025 06:48:24 +0000 (12:18 +0530)] 
datasets: move initial file reading to rust

In a recent warning reported by scan-build, datasets were found to be
using a blocking call in a critical section.

datasets.c:187:12: warning: Call to blocking function 'fgets' inside of critical section [unix.BlockInCriticalSection]
  187 |     while (fgets(line, (int)sizeof(line), fp) != NULL) {
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
datasets.c:292:12: warning: Call to blocking function 'fgets' inside of critical section [unix.BlockInCriticalSection]
  292 |     while (fgets(line, (int)sizeof(line), fp) != NULL) {
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
datasets.c:368:12: warning: Call to blocking function 'fgets' inside of critical section [unix.BlockInCriticalSection]
  368 |     while (fgets(line, (int)sizeof(line), fp) != NULL) {
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
datasets.c:442:12: warning: Call to blocking function 'fgets' inside of critical section [unix.BlockInCriticalSection]
  442 |     while (fgets(line, (int)sizeof(line), fp) != NULL) {
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
datasets.c:512:12: warning: Call to blocking function 'fgets' inside of critical section [unix.BlockInCriticalSection]
  512 |     while (fgets(line, (int)sizeof(line), fp) != NULL) {
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 warnings generated.

These calls are blocking in the multi tenant mode where several tenants
may be trying to load the same dataset in parallel.
In a single tenant mode, this operation is performed as a part of a
single thread before the engine startup.

In order to evade the warning and simplify the code, the initial file
reading is moved to Rust with this commit with a much simpler handling
of dataset and datarep.

Bug 7398

5 months agorust: add C callback for FatalErrorOnInit
Shivani Bhardwaj [Thu, 9 Jan 2025 06:47:13 +0000 (12:17 +0530)] 
rust: add C callback for FatalErrorOnInit

5 months agorust: add macro to return val if unwrap fails
Shivani Bhardwaj [Thu, 9 Jan 2025 06:46:09 +0000 (12:16 +0530)] 
rust: add macro to return val if unwrap fails

5 months agodatasets: remove unused fn definition
Shivani Bhardwaj [Fri, 29 Nov 2024 10:10:16 +0000 (15:40 +0530)] 
datasets: remove unused fn definition

5 months agodoc/userguide: upgrade notes for Lua 12581/head
Jason Ish [Tue, 11 Feb 2025 22:37:54 +0000 (16:37 -0600)] 
doc/userguide: upgrade notes for Lua

- Sandboxed Lua for rules
- Search path changes for Lua output scripts

5 months agooutput-lua: lua module search path configuration
Jason Ish [Tue, 11 Feb 2025 22:26:39 +0000 (16:26 -0600)] 
output-lua: lua module search path configuration

By default, use an empty search path. This gives us a predictable
default. If a user needs access to external modules, the search path
must be set in the configuration file.

Ticket: #7169

5 months agooutput-lua: remove unused includes
Jason Ish [Tue, 11 Feb 2025 21:52:29 +0000 (15:52 -0600)] 
output-lua: remove unused includes

5 months agooutput-lua: rename script directory variable
Jason Ish [Tue, 11 Feb 2025 21:51:25 +0000 (15:51 -0600)] 
output-lua: rename script directory variable

It had a rather generic name of "path", which in Lua usually means a
search path, which we'll be adding.

5 months agodoc/userguide: document Lua base64 library 12579/head
Jason Ish [Mon, 27 Jan 2025 22:56:29 +0000 (16:56 -0600)] 
doc/userguide: document Lua base64 library

Ticket: #7074

5 months agolua: add base64 lib
Jason Ish [Mon, 27 Jan 2025 21:57:13 +0000 (15:57 -0600)] 
lua: add base64 lib

Export our base64 decoding and encoding functions to Lua.

Ticket: #7074

5 months agobase64: expose no padding and padding optional variants
Jason Ish [Thu, 30 Jan 2025 16:49:37 +0000 (10:49 -0600)] 
base64: expose no padding and padding optional variants

A no padding option is provided as a mode, as its a variant suitable
for encoding and decoding.

A padding optional function is added that is indifferent to padding
when decoding. This can be useful when you're not sure if padding
exists, and don't really care.

5 months agobase64: prefix base64 C API with "SC"
Jason Ish [Thu, 30 Jan 2025 16:29:36 +0000 (10:29 -0600)] 
base64: prefix base64 C API with "SC"

5 months agolua: update lua to 5.4.7
Jason Ish [Fri, 24 Jan 2025 17:50:42 +0000 (11:50 -0600)] 
lua: update lua to 5.4.7

This version of out Lua crate also supports cross compiling.

5 months agodoc/userguide: add lua packetlib docs 12569/head
Victor Julien [Mon, 10 Feb 2025 15:57:55 +0000 (16:57 +0100)] 
doc/userguide: add lua packetlib docs

5 months agodetect/lua: register built-in libs also for open setup
Victor Julien [Wed, 22 Jan 2025 18:28:43 +0000 (19:28 +0100)] 
detect/lua: register built-in libs also for open setup

Register internal libs for the case where loading external modules is allowed.

5 months agodoc: remove old lua packet methods
Victor Julien [Tue, 11 Feb 2025 10:05:48 +0000 (11:05 +0100)] 
doc: remove old lua packet methods