Skip to content

Commit

Permalink
Merge remote-tracking branch 'oisf/master' into luasandbox/v1
Browse files Browse the repository at this point in the history
  • Loading branch information
J0eJ0h committed Dec 20, 2023
2 parents 1469455 + 5cc872f commit 1b2c2a4
Show file tree
Hide file tree
Showing 21 changed files with 1,133 additions and 45 deletions.
47 changes: 47 additions & 0 deletions doc/userguide/rules/meta.rst
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,50 @@ The format is::
If the value is src_ip then the source IP in the generated event (src_ip
field in JSON) is the target of the attack. If target is set to dest_ip
then the target is the destination IP in the generated event.

requires
--------

The ``requires`` keyword allows a rule to require specific Suricata
features to be enabled, or the Suricata version to match an
expression. Rules that do not meet the requirements will by ignored,
and Suricata will not treat them as errors.

When parsing rules, the parser attempts to process the ``requires``
keywords before others. This allows it to occur after keywords that
may only be present in specific versions of Suricata, as specified by
the ``requires`` statement. However, the keywords preceding it must
still adhere to the basic known formats of Suricata rules.

The format is::

requires: feature geoip, version >= 7.0.0

To require multiple features, the feature sub-keyword must be
specified multiple times::

requires: feature geoip, feature lua

Alternatively, *and* expressions may be expressed like::

requires: version >= 7.0.4 < 8

and *or* expressions may expressed with ``|`` like::

requires: version >= 7.0.4 < 8 | >= 8.0.3

to express that a rules requires version 7.0.4 or greater, but less
than 8, **OR** greater than or equal to 8.0.3. Which could be useful
if a keyword wasn't added until 7.0.4 and the 8.0.3 patch releases, as
it would not exist in 8.0.1.

This can be extended to multiple release branches::

requires: version >= 7.0.10 < 8 | >= 8.0.5 < 9 | >= 9.0.3

If no *minor* or *patch* version component is provided, it will
default to 0.

The ``version`` may only be specified once, if specified more than
once the rule will log an error and not be loaded.

3 changes: 3 additions & 0 deletions etc/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3783,6 +3783,9 @@
"krb5_udp": {
"$ref": "#/$defs/stats_applayer_error"
},
"modbus": {
"$ref": "#/$defs/stats_applayer_error"
},
"mqtt": {
"$ref": "#/$defs/stats_applayer_error"
},
Expand Down
1 change: 1 addition & 0 deletions rust/src/detect/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ pub mod parser;
pub mod stream_size;
pub mod uint;
pub mod uri;
pub mod requires;
Loading

0 comments on commit 1b2c2a4

Please sign in to comment.