]> git.ipfire.org Git - thirdparty/suricata.git/log
thirdparty/suricata.git
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

5 months agolua: remove old lua payload/packet calls
Victor Julien [Tue, 21 Jan 2025 19:14:07 +0000 (20:14 +0100)] 
lua: remove old lua payload/packet calls

Moving forward the packetlib is to be used.

Ticket: #7488.

5 months agolua: add initial suricata.packet lib
Victor Julien [Tue, 21 Jan 2025 19:03:17 +0000 (20:03 +0100)] 
lua: add initial suricata.packet lib

Example:

```
local packet = require "suricata.packet"

function init (args)
    local needs = {}
    return needs
end

function match (args)
    p = packet.get()
    payload = p:payload()
    ts = p:timestring()

    for line in payload:gmatch("([^\r\n]*)[\r\n]+") do
        if line == "GET /index.html HTTP/1.0" then
            ipver, srcip, dstip, proto, sp, dp = p:tuple()
            SCLogNotice(string.format("%s %s->%s %d->%d (pcap_cnt:%d) match! %s", ts, srcip, dstip, sp, dp, p:pcap_cnt(), line));
            return 1
        end
    end

    return 0
end
```

Methods:
`get` creates the packet object.
`payload` returns the packet payload as a buffer
`packet` returns the whole packet (includes headers)
`pcap_cnt` returns the `pcap_cnt` (pcap file mode only)
`tuple` returns various fields: srcip, dstip, proto, sp, dp
`sp` returns source port
`dp` returns destination port
`timestamp` returns time as 2 numbers: seconds and microseconds
`timestring_legacy` returns a timestamp as a string (like fastlog)
`timestring_iso8601` returns a iso8601 compat timestring (like eve)

Ticket: #7488.

5 months agodetect/lua: minor code cleanup
Victor Julien [Sun, 19 Jan 2025 09:53:54 +0000 (10:53 +0100)] 
detect/lua: minor code cleanup

5 months agodetect/lua: remove unused tls flag
Victor Julien [Sun, 19 Jan 2025 09:53:30 +0000 (10:53 +0100)] 
detect/lua: remove unused tls flag

5 months agothreads: fix int as pointer warning for pthread_exit 12565/head
Victor Julien [Tue, 11 Feb 2025 18:32:40 +0000 (19:32 +0100)] 
threads: fix int as pointer warning for pthread_exit

 clang-tidy:
        warning: integer to pointer cast pessimizes optimization opportunities

Since the returned code of -1 was never read, just return NULL.

5 months agocommandline: fix undefined behavior in parsing list-keywords
Victor Julien [Tue, 11 Feb 2025 18:31:43 +0000 (19:31 +0100)] 
commandline: fix undefined behavior in parsing list-keywords

Flagged by clang-tidy.

5 months agoflow/queue: remove circular dependency
Victor Julien [Tue, 11 Feb 2025 18:18:41 +0000 (19:18 +0100)] 
flow/queue: remove circular dependency

flow-queue.h included flow.h, but was also included by it.

5 months agoincludes: explicitly check for and include mm_malloc.h
Victor Julien [Tue, 11 Feb 2025 18:17:27 +0000 (19:17 +0100)] 
includes: explicitly check for and include mm_malloc.h

Helps code analyzers.

5 months agobuild: pass LOCAL_STATE_DIR through autoconf.h
Victor Julien [Tue, 11 Feb 2025 12:50:32 +0000 (13:50 +0100)] 
build: pass LOCAL_STATE_DIR through autoconf.h

Helps tooling like cppcheck, clang-tidy.

5 months agodetect: remove unused arg from get detect tx
Victor Julien [Tue, 11 Feb 2025 11:58:50 +0000 (12:58 +0100)] 
detect: remove unused arg from get detect tx

5 months agodetect: don't cast void on void func
Victor Julien [Tue, 11 Feb 2025 11:57:03 +0000 (12:57 +0100)] 
detect: don't cast void on void func

5 months agodetect: remove unused args from detect flag storing
Victor Julien [Tue, 11 Feb 2025 11:56:21 +0000 (12:56 +0100)] 
detect: remove unused args from detect flag storing

5 months agodetect/mpm: fix chop flag passed on incorrectly
Victor Julien [Tue, 11 Feb 2025 11:42:37 +0000 (12:42 +0100)] 
detect/mpm: fix chop flag passed on incorrectly

5 months agoautoconf: don't pretent we can build w/o autoconf.h
Victor Julien [Tue, 11 Feb 2025 11:41:11 +0000 (12:41 +0100)] 
autoconf: don't pretent we can build w/o autoconf.h

Helps tooling like cppcheck and clang-tidy.

5 months agomacros: provide fallbacks for common macros
Victor Julien [Tue, 11 Feb 2025 11:40:27 +0000 (12:40 +0100)] 
macros: provide fallbacks for common macros

These are set by our build-system, but some tools like cppcheck don't use that.

5 months agoaf-packet: code cleaning
Eric Leblond [Sat, 11 Jan 2025 19:16:02 +0000 (20:16 +0100)] 
af-packet: code cleaning

clang-tidy did detect the -1 return value was not compatible with
TmEcode enum.

5 months agogithub-ci: update actions/cache 12562/head
Jason Ish [Tue, 11 Feb 2025 15:40:59 +0000 (09:40 -0600)] 
github-ci: update actions/cache

The version we have been using will be deprecated soon.

https://github.blog/changelog/2024-12-05-notice-of-upcoming-releases-and-breaking-changes-for-github-actions/#actions-cache-v1-v2-and-actions-toolkit-cache-package-closing-down

5 months agodoc/userguide: fix typo
AlirezaPourchali [Sat, 1 Feb 2025 13:26:11 +0000 (16:56 +0330)] 
doc/userguide: fix typo

Issue: #7540

fixed doc/userguide/performance/hyperscan.rst
fixed doc/userguide/performance/runmodes.rst

5 months agodetect/integers: add support for negated strings when enum is used
Alice Akaki [Tue, 21 Jan 2025 04:23:54 +0000 (00:23 -0400)] 
detect/integers: add support for negated strings when enum is used

function detect_parse_uint_enum can parse strings like !bind_request

Ticket: #7513

5 months agodcerpc: prevent integer underflow 12553/head
Philippe Antoine [Mon, 3 Feb 2025 15:20:20 +0000 (16:20 +0100)] 
dcerpc: prevent integer underflow

in case a fragment has a length lesser than DCERPC_HDR_LEN

Fixes: 9daf8528b72c ("dcerpc: tidy up code")
Ticket: 7548

5 months agodpdk/rss: add rte_flow rss support for mlx5
Adam Kiripolsky [Tue, 14 Jan 2025 11:58:47 +0000 (12:58 +0100)] 
dpdk/rss: add rte_flow rss support for mlx5

The configuration of this rule is the same as for ixgbe driver except
the hash function is not RTE_ETH_HASH_FUNCTION_DEFAULT but
RTE_ETH_HASH_FUNCTION_TOEPLITZ.

The syntax in dpdk-testpmd for this rule with attributes:
port index == 0
used rx queue indices == 0 1 2 3
<hash_key> == 6d5a symmetric hash key
is as follows:
"flow create 0 ingress pattern eth / end actions rss types ipv4 ipv6
end queues 0 1 2 3 end key <hash_key> key_len 40 func toeplitz / end"

Ticket: 7337

5 months agodpdk/rss: add rte_flow rss support for ice
Adam Kiripolsky [Tue, 10 Dec 2024 15:27:23 +0000 (16:27 +0100)] 
dpdk/rss: add rte_flow rss support for ice

ice driver requires 2 rte_flow rules for matching and
redistributing incoming traffic with RSS.

The rules set up by iceDeviceSetRSSFlowIPv4() and
iceDeviceSetRSSFlowIPv6() are different only in the pattern
("pattern eth / ipv4 / end" or "pattern eth / ipv6 / end"
in dpdk-testpmd syntax) and in the hash type (ipv4 src dst / ipv6 src
dst). ice will match all ipv4 or ipv6 traffic independently of
following l4 protocol. The rules can not have queues configured,
implicitly they will use all queues available.
The hash function is set to RTE_ETH_HASH_FUNCTION_TOEPLITZ.
The hash key can not be set.

The syntax in dpdk-testpmd for rule to match all ipv4 traffic
with attributes:
port index == 0
is as follows:
"flow create 0 ingress pattern eth / ipv4 / end actions rss types ipv4
end queues end func toeplitz / end"
(queues need to be set to NULL)

Ticket: 7337

5 months agodpdk/rss: add rte_flow rss support for ixgbe
Adam Kiripolsky [Tue, 10 Dec 2024 15:26:49 +0000 (16:26 +0100)] 
dpdk/rss: add rte_flow rss support for ixgbe

ixgbe driver requires different configuration of RSS rte_flow
rule than i40e, with just one generic rule matching all traffic.

The generic rule configured by DeviceCreateRSSFlowGeneric() has pattern
equivalent to "pattern eth / end" in dpdk-testpmd syntax. The rule must
have rx queues configured. The rule hashes traffic to different queues
based on ipv4 and ipv6 hash types (ipv4 src dst / ipv6 src dst).
The hash key is 40 bytes long  symmetric hash key. ixgbe does not
support any other hash function than RTE_ETH_HASH_FUNCTION_DEFAULT.

The syntax in dpdk-testpmd for this rule with attributes:
port index == 0
used rx queue indices == 0 1 2 3
<hash_key> == 6d5a symmetric hash key
is as follows:
"flow create 0 ingress pattern eth / end actions rss types ipv4 ipv6
end queues 0 1 2 3 end key <hash_key> key_len 40 func default / end"

Ticket: 7337

5 months agodpdk/rss: move and change rss rte_flow functions
Adam Kiripolsky [Thu, 12 Dec 2024 12:28:02 +0000 (13:28 +0100)] 
dpdk/rss: move and change rss rte_flow functions

Move and adjust the base of  RSS configuration from util-dpdk-i40e.c to
a new file that can be later utilized by other cards.

RSS configuration can be configured via rte_flow rules. This is useful
for possible future features such as specific header offload
(vxlan, nvgre) also implemented via rte_flow rules, as rte_flow
rules can be chained via groups and priorities.

i40e uses multiple different rte_flow rules to setup RSS. At first,
function DeviceSetRSSFlowQueues() is used to setup rx queues.
This rule matches all types of traffic, so the equivalent
to dpdk-testpmd pattern would be "pattern end"
This rule can not contain hash types (ipv4, ipv6 etc.) nor hash key.
The hash function used here is RTE_ETH_HASH_FUNCTION_DEFAULT.

The syntax in dpdk-testpmd for this rule with attributes:
port index == 0
used rx queue indices == 0 1 2 3
is as follows:
"flow create 0 ingress pattern end actions rss queues 0 1 2 3 end
func default / end"

The other rules configured by i40eDeviceSetRSSFlowIPv4() and
i40eDeviceSetRSSFlowIPv6() match specific type of traffic by l4 protocol
(none, TCP, UDP, SCTP). For example, pattern to match l3 ipv4 with l4
tcp traffic in dpdk-testpmd syntax would be equivalent of
"pattern eth / ipv4 / tcp / end".
These rules can not have rx queues configured, but have hash types
(l3 src and dst address). This means that the traffic distribution
is affected only by l3 addresses, independent of the l4 specifics.

Also these pattern matching rules have symmetric 6d5a
hash key configured. The length of the key is dependent on DPDK version.
The hash function (either RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ or
RTE_ETH_HASH_FUNCTION_TOEPLITZ, depending on DPKD version) used
in these rules hashes symmetricaly due to the symmetric hash key.

The syntax in dpdk-testpmd for rule to match ipv4-tcp traffic with
attributes:
port index == 0
<hash_key> == 52 bytes long 6d5a symmetric hash key
is as follows:
"flow create 0 ingress pattern eth / ipv4 / tcp / end actions rss types
ipv4-tcp l3-src-only l3-dst-only end queues end key <hash_key>
key_len 52 func toeplitz / end"
(queues need to be set to NULL)

Ticket: 7337

5 months agofuzz: init reverse before calling AppLayerProtoDetectGetProto
Philippe Antoine [Mon, 3 Feb 2025 12:47:37 +0000 (13:47 +0100)] 
fuzz: init reverse before calling AppLayerProtoDetectGetProto

Completes commit fec06f8ac3954c19081fcf4005543b845dbef245

The 2 callers in suricata itself already do that

5 months agoaf-packet: clean up IPS config check
Victor Julien [Wed, 22 Nov 2023 09:41:47 +0000 (10:41 +0100)] 
af-packet: clean up IPS config check

Don't emmit generic error statements on things that are not errors. Instead,
for cases where (part of) the config is missing, use the defaults and log
only a more detailed explanation at the 'config' level.

Minor code cleanups.

5 months agogithub-actions: bump actions/upload-artifact from 4.5.0 to 4.6.0 11996/head 12521/head
dependabot[bot] [Sat, 1 Feb 2025 19:44:44 +0000 (19:44 +0000)] 
github-actions: bump actions/upload-artifact from 4.5.0 to 4.6.0

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.5.0 to 4.6.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/6f51ac03b9356f520e9adb1b1b7802705f340c2b...65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
5 months agogithub-actions: bump github/codeql-action from 3.28.0 to 3.28.8
dependabot[bot] [Sat, 1 Feb 2025 19:44:41 +0000 (19:44 +0000)] 
github-actions: bump github/codeql-action from 3.28.0 to 3.28.8

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.0 to 3.28.8.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](https://github.com/github/codeql-action/compare/v3.28.0...v3.28.8)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
6 months agogithub-actions: bump codecov/codecov-action from 5.1.2 to 5.3.1 12518/head
dependabot[bot] [Sat, 1 Feb 2025 19:44:26 +0000 (19:44 +0000)] 
github-actions: bump codecov/codecov-action from 5.1.2 to 5.3.1

Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.1.2 to 5.3.1.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/1e68e06f1dbfde0e4cefc87efeba9e4643565303...13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
6 months agooutput: Log ethernet type 12514/head
Jeff Lucovsky [Tue, 1 Oct 2024 13:19:25 +0000 (09:19 -0400)] 
output: Log ethernet type

Issue 7129

When configured with the existing "ethernet" switch, include the ether
type in the output.

This is most useful with anomaly records indicating unknown ethertypes.

6 months agodoc/decode-events: new: unknown event description
Jeff Lucovsky [Fri, 27 Sep 2024 14:33:49 +0000 (10:33 -0400)] 
doc/decode-events: new: unknown event description

Issue: 7129

Document the unknown ethertype event.

6 months agodoc/threshold: Threshold keyword clarifications
Jeff Lucovsky [Sun, 7 Jul 2024 13:24:33 +0000 (09:24 -0400)] 
doc/threshold: Threshold keyword clarifications

Issue: 7129

6 months agodecode/ethertype: Event on unknown ethertype
Jeff Lucovsky [Wed, 3 Jul 2024 12:30:44 +0000 (08:30 -0400)] 
decode/ethertype: Event on unknown ethertype

Issue: 7129

Create a decode/engine event if unknown ethertypes are observed.

6 months agohttp: remove obsolete comment
Philippe Antoine [Thu, 30 Jan 2025 13:56:11 +0000 (14:56 +0100)] 
http: remove obsolete comment

In preparation of libhtp rust

6 months agohttp: minor cleanups for unit tests
Philippe Antoine [Thu, 30 Jan 2025 13:44:53 +0000 (14:44 +0100)] 
http: minor cleanups for unit tests

In preparation of libhtp rust

Mainly adding some const

6 months agohttp: minor cleanups for log
Philippe Antoine [Thu, 30 Jan 2025 12:48:06 +0000 (13:48 +0100)] 
http: minor cleanups for log

In preparation of libhtp rust

Mainly adding some const

6 months agohttp: minor cleanups for lua
Philippe Antoine [Thu, 30 Jan 2025 12:42:19 +0000 (13:42 +0100)] 
http: minor cleanups for lua

In preparation of libhtp rust

Mainly adding some const

6 months agoprotodetect: simplify code since DCERPC UDP detection is improved
Ilya Bakhtin [Sun, 21 Jul 2024 18:01:51 +0000 (20:01 +0200)] 
protodetect: simplify code since DCERPC UDP detection is improved

Protocol detection code is simplified. Removed dependency on explicit
alproto constants from the common part of code that must not be aware of
the each specific protocol features.

Ticket - 7111

6 months agoprotodetect/dcerpc: improve DCERPC UDP probing parser
Ilya Bakhtin [Sun, 21 Jul 2024 17:15:00 +0000 (19:15 +0200)] 
protodetect/dcerpc: improve DCERPC UDP probing parser

Several additional checks are added to the probing parser to avoid false
detection of DNS as DCERPC

Ticket - 7111

6 months agodetect: remove unused SignatureInitData member
Victor Julien [Sat, 25 Jan 2025 09:12:32 +0000 (10:12 +0100)] 
detect: remove unused SignatureInitData member

6 months agodetect/prefilter: fix prefilter setup
Victor Julien [Sat, 25 Jan 2025 08:52:16 +0000 (09:52 +0100)] 
detect/prefilter: fix prefilter setup

If `prefilter` is used it should override automatic fast pattern
selection.

Fixes: d6b56929d3c6 ("detect: set mpm/prefilter during signature parsing")
Ticket: #7523.

6 months agofuzz: better init for signature parsing target 12507/head
Philippe Antoine [Thu, 30 Jan 2025 07:54:53 +0000 (08:54 +0100)] 
fuzz: better init for signature parsing target

Fixes https://issues.oss-fuzz.com/u/1/issues/391975646

6 months agodcerpc/tcp: add frames support
Shivani Bhardwaj [Fri, 28 Jul 2023 05:43:54 +0000 (11:13 +0530)] 
dcerpc/tcp: add frames support

Frames of the following types have been added for toserver direction:
1. Pdu: The entire Protocol Data Unit
2. Hdr: Header of the request
3. Data: PDU data

Feature 4904

6 months agoapplayer: remove complex unittest
Shivani Bhardwaj [Wed, 4 Dec 2024 10:44:39 +0000 (16:14 +0530)] 
applayer: remove complex unittest

as it is now covered by the suricata-verify test
dcerpc-request-http-response.

6 months agodcerpc: tidy up code
Shivani Bhardwaj [Wed, 18 Sep 2024 09:01:28 +0000 (14:31 +0530)] 
dcerpc: tidy up code

- remove unneeded variables
- remove unnecessary tracking of bytes in state
- modify calculations as indicated by failing tests

6 months agodcerpc: remove fragmented data tests
Shivani Bhardwaj [Fri, 21 Jul 2023 07:34:21 +0000 (13:04 +0530)] 
dcerpc: remove fragmented data tests

With the introduction of AppLayerResult::incomplete API, fragmented data
is no longer handled fully in the dcerpc code. Given that these code
paths are already covered by the following s-v tests, these tests can now be
safely removed.
- dce-gap-handling
- dcerpc-dce-iface-*

Ticket 5699

6 months agodcerpc: use AppLayerResult::incomplete API
Shivani Bhardwaj [Fri, 21 Jul 2023 07:28:50 +0000 (12:58 +0530)] 
dcerpc: use AppLayerResult::incomplete API

Instead of own internal mechanism of buffering in case of fragmented
data, use AppLayerResult::incomplete API to let the AppLayer Parser take
care of it. This makes the memory use more efficient.
Remove any unneeded variables and code with the introduction of this
API.

Ticket 5699

6 months agodcerpc: save version info in tx
Shivani Bhardwaj [Wed, 18 Sep 2024 08:54:12 +0000 (14:24 +0530)] 
dcerpc: save version info in tx

to make it available for logging.

6 months agodcerpc: do not assume an upper bound on data
Shivani Bhardwaj [Fri, 13 Sep 2024 08:56:05 +0000 (14:26 +0530)] 
dcerpc: do not assume an upper bound on data

TCP data can be presented to the protocol parser in any way e.g. one
byte at a time, single complete PDU, fragmented PDU, multiple PDUs at
once. A limit of 1MB can be easily reached in some of such scenarios.
Remove the check that rejects data that is more than 1MB.

6 months agoapp-layer: update flow counter if an alproto is detected
Shivani Bhardwaj [Thu, 23 Jan 2025 05:39:46 +0000 (11:09 +0530)] 
app-layer: update flow counter if an alproto is detected

If alproto for the current direction was not detected but the opposite
side was successfully detected, if the Pattern Matching and Pattern
Probing on the flow was also successfully done and the current
direction's alproto is still unknown, a decoder event is set to indicate
that the protocol detection only happened in one direction.

This event is set after having sent the current data to the applayer
parser. Now, the respective applayer parser may or may not successfully
parse the data. However, the alproto on flow is already set from the
other direction so there will be a flow event generated by Suricata. In
order to keep this consistent with the stats, also make sure to
increment the flow counter when the decode event is set so that the flow
counter is incremented irrespective of the parsing status reported by
the applayer parser.

This patch makes stats for several specific applayer flow count equal to
the number of flow events logged for those specific applayer protocols.

Bug 7238

6 months agodoc/csum: Stream checksum validation change 12499/head
Jeff Lucovsky [Tue, 21 Jan 2025 14:21:24 +0000 (09:21 -0500)] 
doc/csum: Stream checksum validation change

Describe the change of behavior between the stream.checksum-validation
setting and checksum-based rule keywords.

6 months agodetect/csum: rm interaction btw stream setting/csum
Jeff Lucovsky [Mon, 20 Jan 2025 13:46:39 +0000 (08:46 -0500)] 
detect/csum: rm interaction btw stream setting/csum

Issue: 7467

Stream checksum validation no longer has a side effect of setting
PKT_IGNORE_CHECKSUM and thus, no longer affects csum keyword checks.

6 months agodetect/iponly: use flow first flags
Victor Julien [Thu, 23 Jan 2025 15:07:08 +0000 (16:07 +0100)] 
detect/iponly: use flow first flags

Instead of ip-only specific flags, reuse the FLOW_PKT_TOSERVER_FIRST and
FLOW_PKT_TOCLIENT_FIRST flags.

Fixes false positives on one sided streams that trigger a opposing flow
timeout packet at the flow's end. That pseudo packet would trigger a
match even though it shouldn't.

Ticket: #7521.

6 months agoutil/debug: increase max length of message
Eric Leblond [Fri, 29 Nov 2024 17:46:11 +0000 (18:46 +0100)] 
util/debug: increase max length of message

When a signature is incorrect, its full content is logged in a
message with some other information such as rules file name. As
a result, the log message must be longer than a maximum signature
length which is 8192.

Ticket: 7419

6 months agouserguide: explain rule types and categorization 12492/head
Juliana Fajardini [Wed, 6 Nov 2024 01:54:50 +0000 (22:54 -0300)] 
userguide: explain rule types and categorization

Add documentation about the rule types introduced by commit
2696fda04168cb82.

Add doc tags around code definitions that are referenced in the docs.

Task #https://redmine.openinfosecfoundation.org/issues/7031

6 months agohttp: htp_headers_t alias for htp_table_t
Philippe Antoine [Fri, 24 Jan 2025 16:46:33 +0000 (17:46 +0100)] 
http: htp_headers_t alias for htp_table_t

In preparation of libhtp rust

6 months agohttp: minor cleanups for detect
Philippe Antoine [Fri, 24 Jan 2025 16:42:39 +0000 (17:42 +0100)] 
http: minor cleanups for detect

In preparation of libhtp rust

Mainly adding some const

6 months agohttp: minor cleanups for output-json-http
Philippe Antoine [Fri, 24 Jan 2025 16:37:29 +0000 (17:37 +0100)] 
http: minor cleanups for output-json-http

In preparation of libhtp rust

Mainly using htp_header_value_ptr and htp_header_value_len
when possible

6 months agohttp: minor cleanups for htp-xff.c
Philippe Antoine [Fri, 24 Jan 2025 16:32:22 +0000 (17:32 +0100)] 
http: minor cleanups for htp-xff.c

In preparation of libhtp rust

6 months agohttp: minor cleanups for htp-file.c
Philippe Antoine [Fri, 24 Jan 2025 16:31:07 +0000 (17:31 +0100)] 
http: minor cleanups for htp-file.c

In preparation of libhtp rust

6 months agohttp: aliases for htp opaque htp_headers_t
Philippe Antoine [Fri, 24 Jan 2025 16:16:07 +0000 (17:16 +0100)] 
http: aliases for htp opaque htp_headers_t

In preparation of libhtp rust

6 months agohttp: use const http_header_t in stub
Philippe Antoine [Fri, 24 Jan 2025 16:07:33 +0000 (17:07 +0100)] 
http: use const http_header_t in stub

In preparation of libhtp rust

6 months agohttp: constify some function arguments
Philippe Antoine [Fri, 24 Jan 2025 16:04:06 +0000 (17:04 +0100)] 
http: constify some function arguments

In preparation of libhtp rust

6 months agoflow: optionally use pkt recursion for hash
Cole Dishington [Tue, 8 Aug 2023 19:47:12 +0000 (07:47 +1200)] 
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

6 months agodoc: Add ftp.command sticky buffer 12480/head
Jeff Lucovsky [Mon, 20 Jan 2025 15:37:08 +0000 (10:37 -0500)] 
doc: Add ftp.command sticky buffer

Issue: 7502

This commit documents the new FTP sticky buffer "ftp.command".

6 months agodetect/ftp.command: Add sticky buffer
Jeff Lucovsky [Sun, 19 Jan 2025 15:38:42 +0000 (10:38 -0500)] 
detect/ftp.command: Add sticky buffer

Issue: 7502

Add a sticky buffer for "ftp.command" for matching on FTP command names.

6 months agodetect/smtp: smtp.rcpt_to keyword
Philippe Antoine [Fri, 24 Jan 2025 12:54:39 +0000 (13:54 +0100)] 
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

6 months agodetect/smtp: smtp.mail_from keyword
Philippe Antoine [Fri, 24 Jan 2025 12:30:47 +0000 (13:30 +0100)] 
detect/smtp: smtp.mail_from keyword

Ticket: 7517

It is a sticky buffer mapping to the smtp.mail_from log field

6 months agodetect/smtp: smtp.helo keyword
Philippe Antoine [Fri, 24 Jan 2025 12:17:38 +0000 (13:17 +0100)] 
detect/smtp: smtp.helo keyword

Ticket: 7515

It is a sticky buffer mapping to the smtp.helo log field

6 months agorust/logging: fix logging from plugins 12472/head
Jason Ish [Tue, 21 Jan 2025 15:40:34 +0000 (09:40 -0600)] 
rust/logging: fix logging from plugins

Commit 2bcc66da5826fa0e6e074a756754b295e5ac4da2 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

6 months agolua: add "builtins" file to consolidate registration 12462/head
Jason Ish [Wed, 22 Jan 2025 22:32:35 +0000 (16:32 -0600)] 
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.

6 months agodoc/userguide: document lua hashlib
Jason Ish [Tue, 21 Jan 2025 22:57:31 +0000 (16:57 -0600)] 
doc/userguide: document lua hashlib

6 months agolua: expose hashing functions to lua scripts
Jason Ish [Tue, 21 Jan 2025 21:23:15 +0000 (15:23 -0600)] 
lua: expose hashing functions to lua scripts

Expose md5, sha1, and sha256 to Lua scripts with
`require("suricata.hashing")`.

Ticket: 7073

6 months agorust/hashing: add more hex variants
Jason Ish [Tue, 21 Jan 2025 21:21:46 +0000 (15:21 -0600)] 
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

6 months agosource/pcap-file: remove unused macro warning
Philippe Antoine [Thu, 23 Jan 2025 12:54:22 +0000 (13:54 +0100)] 
source/pcap-file: remove unused macro warning

6 months agodetect/base64: remove unused macro warning
Philippe Antoine [Thu, 23 Jan 2025 12:31:05 +0000 (13:31 +0100)] 
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

6 months agorust: AppLayerRegisterParser out of SuricataContext
Philippe Antoine [Thu, 23 Jan 2025 09:12:59 +0000 (10:12 +0100)] 
rust: AppLayerRegisterParser out of SuricataContext

Just use a regular compile time rust export, instead of having
a runtime definition through the SuricataContext structure

6 months agorust: generated bindings depend on cbindgen.toml
Philippe Antoine [Thu, 23 Jan 2025 09:12:05 +0000 (10:12 +0100)] 
rust: generated bindings depend on cbindgen.toml

make should rerun cbindgen if cbindgen.toml is modified

6 months agodetect: add ldap.responses.count
Alice Akaki [Mon, 20 Jan 2025 18:16:26 +0000 (14:16 -0400)] 
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

6 months agodetect: add ldap.responses.operation
Alice Akaki [Mon, 20 Jan 2025 18:12:02 +0000 (14:12 -0400)] 
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

6 months agodetect: add ldap.request.operation
Alice Akaki [Mon, 20 Jan 2025 18:06:03 +0000 (14:06 -0400)] 
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

6 months agorustfmt: rust/src/ldap/types.rs
Alice Akaki [Mon, 20 Jan 2025 18:18:22 +0000 (14:18 -0400)] 
rustfmt: rust/src/ldap/types.rs

6 months agohttp: aliases for htp opaque htp_header_t
Philippe Antoine [Sun, 19 Jan 2025 20:45:54 +0000 (21:45 +0100)] 
http: aliases for htp opaque htp_header_t

In preparation of libhtp rust

6 months agohttp: use even more aliases for htp opaque htp_tx_t
Philippe Antoine [Sun, 19 Jan 2025 20:32:01 +0000 (21:32 +0100)] 
http: use even more aliases for htp opaque htp_tx_t

For request and response headers

In preparation of libhtp rust

6 months agohttp: use alias for htp opaque htp_tx_t
Philippe Antoine [Sun, 19 Jan 2025 20:23:36 +0000 (21:23 +0100)] 
http: use alias for htp opaque htp_tx_t

In preparation of libhtp rust

This occurence was missed in 23050d70ede31e842b316908c3428fabeb1de8f9

6 months agohttp: include htp-libhtp.h from header
Philippe Antoine [Sun, 19 Jan 2025 20:20:45 +0000 (21:20 +0100)] 
http: include htp-libhtp.h from header

Instead of C files requiring it.
In preparation of libhtp rust, to minimize the final commit.

6 months agodetect: set mpm/prefilter during signature parsing
Victor Julien [Wed, 5 Oct 2022 06:40:15 +0000 (08:40 +0200)] 
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.

6 months agorust/ssh: rustfmt 12445/head
Jason Ish [Mon, 20 Jan 2025 18:08:41 +0000 (12:08 -0600)] 
rust/ssh: rustfmt

6 months agossh: cleanup rust visibility and naming
Jason Ish [Mon, 20 Jan 2025 18:06:20 +0000 (12:06 -0600)] 
ssh: cleanup rust visibility and naming

Remove pub and no_mangle from non-exported functions and rename to
Rust as-needed.

Ticket: 7498

6 months agorust/ntp: rustfmt
Jason Ish [Mon, 20 Jan 2025 17:34:49 +0000 (11:34 -0600)] 
rust/ntp: rustfmt

6 months agontp: cleanup visibility and naming
Jason Ish [Mon, 20 Jan 2025 17:34:00 +0000 (11:34 -0600)] 
ntp: cleanup visibility and naming

Remove pub and no_mangle from non-exported functions and rename to
Rust as-needed.

Ticket: 7498

6 months agopgsql: cleanup visibility and naming
Jason Ish [Mon, 20 Jan 2025 17:29:42 +0000 (11:29 -0600)] 
pgsql: cleanup visibility and naming

Remove pub and no_mangle from non-exported functions and rename to
Rust style as needed.

Ticket: 7498

6 months agorust/dhcp: rustfmt
Jason Ish [Mon, 20 Jan 2025 16:02:17 +0000 (10:02 -0600)] 
rust/dhcp: rustfmt

6 months agodhcp: cleanup visibility and naming
Jason Ish [Mon, 20 Jan 2025 16:00:19 +0000 (10:00 -0600)] 
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

6 months agorust/applayer: clean visibility of export macros
Jason Ish [Mon, 20 Jan 2025 15:46:09 +0000 (09:46 -0600)] 
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

6 months agorust/transforms: remove no_mangle from non-pub functions
Jason Ish [Mon, 20 Jan 2025 15:11:48 +0000 (09:11 -0600)] 
rust/transforms: remove no_mangle from non-pub functions

Ticket: 7498

6 months agorust/ldap: cleanup no_mangle and extern C pub functions
Jason Ish [Mon, 20 Jan 2025 15:02:59 +0000 (09:02 -0600)] 
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