Commit Graph

16656 Commits (4478c943950c1d4f4f47d42405707a8dffaf22f9)
 

Author SHA1 Message Date
Philippe Antoine 4478c94395 http: use const http_header_t in stub
In preparation of libhtp rust
1 month ago
Philippe Antoine 18dc86f50a http: constify some function arguments
In preparation of libhtp rust
1 month ago
Cole Dishington c46308957f flow: optionally use pkt recursion for hash
If a Suricata inline IPS device is routing traffic over a
non-encrypted tunnel, like IPv6 tunnels, packets in a flow
will be dropped and not be matched. e.g.

The following example is a Suricata inline IPS with an IPv6 tunnel:
request: IPv4]ICMP] -> |IPS| -> IPv6]IPv4]ICMP]
reply:              <- |IPS| <- IPv6]IPv4]ICMP]
Both the IPv4 request and IPv6 reply will be seen by Suricata on
ingress. The flows will not be matched due to flow recursion level.

Optionally use pkt recursion level in flow hash. Excluding recursion
level in flow hash allows matching of packet flows and defrag on an
inline IPS Suricata scenario where the IPS device is a tunnel
terminator.

Feature: 6260
1 month ago
Jeff Lucovsky 53abe1e5d7 doc: Add ftp.command sticky buffer
Issue: 7502

This commit documents the new FTP sticky buffer "ftp.command".
1 month ago
Jeff Lucovsky b662feb162 detect/ftp.command: Add sticky buffer
Issue: 7502

Add a sticky buffer for "ftp.command" for matching on FTP command names.
1 month ago
Philippe Antoine c5f3d33e51 detect/smtp: smtp.rcpt_to keyword
Ticket: 7516

It is a sticky buffer mapping to the smtp.rcpt_to[] log field
It is a multi-buffer
1 month ago
Philippe Antoine 32594766b7 detect/smtp: smtp.mail_from keyword
Ticket: 7517

It is a sticky buffer mapping to the smtp.mail_from log field
1 month ago
Philippe Antoine 3d3b1ade9d detect/smtp: smtp.helo keyword
Ticket: 7515

It is a sticky buffer mapping to the smtp.helo log field
1 month ago
Jason Ish 99096699c0 rust/logging: fix logging from plugins
Commit 2bcc66da58 broke logging from
plugins:

- debug visibility was reduced making it unusable from an external crate
- the plugins view of the log level was broken

To fix:
- make debug pub
- minor change to initialization of the log LEVEL as seen by the plugin
  so its seen by the plugin. I'm not really sure why the previous
  version wasn't working though, but this one does
1 month ago
Jason Ish d63ad75d91 lua: add "builtins" file to consolidate registration
Use a single array of built-ins and provide 2 functions for
registering them:

- SCLuaLoadBuiltIn: for loading built-in modules in sandboxed
  environments.

- SCLuaRequirefBuiltIns: registers built-in modules with the standard
  package tool, allows built-ins to be loaded by output scripts that are
  not restricted

I hope to refactor the sandbox so they can use SCLuaRequirefBuiltIns
as well.
1 month ago
Jason Ish c8b28b1512 doc/userguide: document lua hashlib 1 month ago
Jason Ish d3c556b82d lua: expose hashing functions to lua scripts
Expose md5, sha1, and sha256 to Lua scripts with
`require("suricata.hashing")`.

Ticket: 7073
1 month ago
Jason Ish c4fc2aac3b rust/hashing: add more hex variants
Make all the hasher's have the same variants:
- add hex digest for sha256
- add finalize to hex for sha1
- add hex digest for sha1
1 month ago
Philippe Antoine a0bb260d91 source/pcap-file: remove unused macro warning 1 month ago
Philippe Antoine b09c543d73 detect/base64: remove unused macro warning
when compiling without unit tests
detect-transform-base64.c:47:9: warning: macro is not used [-Wunused-macros]
   47 | #define DETECT_TRANSFORM_FROM_BASE64_MODE_DEFAULT (uint8_t) Base64ModeRFC4648
1 month ago
Philippe Antoine b11381d952 rust: AppLayerRegisterParser out of SuricataContext
Just use a regular compile time rust export, instead of having
a runtime definition through the SuricataContext structure
1 month ago
Philippe Antoine 5c93291565 rust: generated bindings depend on cbindgen.toml
make should rerun cbindgen if cbindgen.toml is modified
1 month ago
Alice Akaki 8416289752 detect: add ldap.responses.count
ldap.responses.count matches on the number of LDAP responses
This keyword maps to the eve field len(ldap.responses[])
It is an unsigned 32-bit integer
Doesn't support prefiltering

Ticket: #7453
1 month ago
Alice Akaki da593abd99 detect: add ldap.responses.operation
ldap.responses.operation matches on Lightweight Directory Access Protocol response operations
This keyword maps to the eve field ldap.responses[].operation
It is an unsigned 8-bit integer
Doesn't support prefiltering

Ticket: #7453
1 month ago
Alice Akaki cdb043810f detect: add ldap.request.operation
ldap.request.operation matches on Lightweight Directory Access Protocol request operations
This keyword maps to the eve field ldap.request.operation
It is an unsigned 8-bit integer
Doesn't support prefiltering

Ticket: #7453
1 month ago
Alice Akaki 824c5d4f06 rustfmt: rust/src/ldap/types.rs 1 month ago
Philippe Antoine b0db4e2dbe http: aliases for htp opaque htp_header_t
In preparation of libhtp rust
1 month ago
Philippe Antoine a0e44ebb17 http: use even more aliases for htp opaque htp_tx_t
For request and response headers

In preparation of libhtp rust
1 month ago
Philippe Antoine 82e31e14c0 http: use alias for htp opaque htp_tx_t
In preparation of libhtp rust

This occurence was missed in 23050d70ed
1 month ago
Philippe Antoine 9a8e377a7a http: include htp-libhtp.h from header
Instead of C files requiring it.
In preparation of libhtp rust, to minimize the final commit.
1 month ago
Victor Julien d6b56929d3 detect: set mpm/prefilter during signature parsing
In preparation of flowbit prefilter work that needs this info
earlier.

Track potential prefilter sm's to avoid unnecessary looping during
setup.
1 month ago
Jason Ish 5d9fad5edf rust/ssh: rustfmt 1 month ago
Jason Ish 9c87ac1b9b ssh: cleanup rust visibility and naming
Remove pub and no_mangle from non-exported functions and rename to
Rust as-needed.

Ticket: 7498
1 month ago
Jason Ish f8d27992f7 rust/ntp: rustfmt 1 month ago
Jason Ish f023b3a6f1 ntp: cleanup visibility and naming
Remove pub and no_mangle from non-exported functions and rename to
Rust as-needed.

Ticket: 7498
1 month ago
Jason Ish 4cca135793 pgsql: cleanup visibility and naming
Remove pub and no_mangle from non-exported functions and rename to
Rust style as needed.

Ticket: 7498
1 month ago
Jason Ish a7f7dc5296 rust/dhcp: rustfmt 1 month ago
Jason Ish c5089ac5f4 dhcp: cleanup visibility and naming
- remove "rs_" prefix from functions that are not exported
- prefix exported functions with "SC"
- don't export functions that are only used by pointer

Ticket: 7498
1 month ago
Jason Ish c86b2608aa rust/applayer: clean visibility of export macros
Both the macros export_tx_data_get and export_state_data_get can
generate non-pub functions as the function they generate is only used
as a pointer during registration.

Remove "pub" and "no_mangle" from the generated functions and update
the names of the generated functions to follow Rust rules as they are
no longer exported into the global C namespace.

Ticket: 7498
1 month ago
Jason Ish c93bba8e2c rust/transforms: remove no_mangle from non-pub functions
Ticket: 7498
1 month ago
Jason Ish f370afb5bd rust/ldap: cleanup no_mangle and extern C pub functions
If a function is extern "C" and not pub, remove no_mangle so its not
exposed as-is into the global name space.

Ticket: 7498
1 month ago
Eric Leblond 8ae7054f1f decode/tcp: fix some macros
Ticket: #7509
1 month ago
Philippe Antoine 78715a5f3f smtp: recognize if client initiated TLS
Ticket: 7469
1 month ago
Philippe Antoine b5094b00b6 protodetect: finish probing parser sooner
Ticket: 7495

We want to finish also if we tested all the expected protocols
in mask, or if we tested even more.

There can be one more protocol coming from pe0, which can be
the protocol already found in the other direction.
1 month ago
Jeff Lucovsky 95e8427bae gen: Remove _AL_ usage in detect keywords
This commit removes the `_AL_` usage in detect keywords for improved
readability.

Some of the HTTP rule keywords already had counterparts without using
"_AL_". These rule keywords are the legacy content modifier keywords
that now have sticky buffer equivalents.

For these, "_AL_" was removed and a suffix was added to the #define:
src/detect-engine-register.h:151:    DETECT_HTTP_COOKIE_CM
src/detect-engine-register.h:153:    DETECT_HTTP_METHOD_CM
src/detect-engine-register.h:161:    DETECT_HTTP_HEADER_CM
src/detect-engine-register.h:173:    DETECT_HTTP_RAW_HEADER_CM
src/detect-engine-register.h:175:    DETECT_HTTP_URI_CM
src/detect-engine-register.h:179:    DETECT_HTTP_STAT_MSG_CM
src/detect-engine-register.h:181:    DETECT_HTTP_STAT_CODE_CM
src/detect-engine-register.h:185:    DETECT_HTTP_HOST_CM
1 month ago
Jason Ish c207cfc67e rust/detect: remove nested unsafe around keyword registration
Just a cleanup, I'm not sure why Rust wasn't warning on these
nested/unneeded unsafe's.
1 month ago
Jason Ish 2bcc66da58 rust/log: move rust log and debug utils to debug module
Move Rust logging, and debug_validation to a debug module to mirrow
the C side.
1 month ago
Jason Ish f62be374ea rust/direction: move direction to own file (cleanup)
Move the implementation of Direction to its own file, direction.rs.
1 month ago
Jason Ish 7ef4caf90e rust/flow: move flow support to its own file (cleanup)
Move the Rust Flow support from core.rs to flow.rs.
1 month ago
Philippe Antoine 23050d70ed http: aliases for htp opaque htp_tx_t
In preparation of libhtp rust
1 month ago
Philippe Antoine 8f6795d049 rust: remove unneeded mut for tx in detect
Detection does not change transactions, it reads only.
1 month ago
Philippe Antoine af4e1e8888 rust: remove unneeded mut for tx in loggers
Loggers do not change transactions, they read only.
1 month ago
Philippe Antoine 5ee6e7cef0 http: aliases for htp progresses
In preparation of libhtp rust
1 month ago
Philippe Antoine 8c612246c1 http: aliases for htp protocol versions
In preparation of libhtp rust
1 month ago
Philippe Antoine ef133942e8 http: aliases for htp stream states
In preparation of libhtp rust
1 month ago