Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datasets memcap tests/v4 #1944

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ requires:
# release, but 4.0.3 would only match 4.0.3.
version: 4.0

# Test is only for the listed OS. For example, the following would make
# a test run only on Linux.
os: linux

# Test is only for the liste architecture. For example, following would
# make a test run only on x86_64. Other values can be amd64, i386, etc.
arch: x86_64

# Require the presence of specific features.
features:
# Restrict the test to builds with HAVE_LUA.
Expand Down
9 changes: 9 additions & 0 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import subprocess
import yaml
import traceback
import platform

VALIDATE_EVE = False
WIN32 = sys.platform == "win32"
Expand Down Expand Up @@ -368,6 +369,14 @@ def check_requires(requires, suricata_config: SuricataConfig):
elif key == "lambda":
if not eval(requires["lambda"]):
raise UnsatisfiedRequirementError(requires["lambda"])
elif key == "os":
cur_platform = platform.system().lower()
if not cur_platform.startswith(requires["os"].lower()):
raise UnsatisfiedRequirementError(requires["os"])
elif key == "arch":
cur_arch = platform.machine().lower()
if not cur_arch.startswith(requires["arch"].lower()):
raise UnsatisfiedRequirementError(requires["arch"])
else:
raise Exception("unknown requires types: %s" % (key))

Expand Down
14 changes: 14 additions & 0 deletions tests/datasets-memcap-01/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Test Description
================

This test demonstrates that the memcap settings DO NOT take the string length into account in 7.0.x or below.

PCAP
====

Comes from existing test `flowbit-oring`.

Related tickets
===============

https://redmine.openinfosecfoundation.org/issues/3910
1 change: 1 addition & 0 deletions tests/datasets-memcap-01/datasets.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Y3VybC83LjQzLjA=
1 change: 1 addition & 0 deletions tests/datasets-memcap-01/test.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert http any any -> any any (http.user_agent; dataset:isset,ua-seen,type string,load datasets.csv,memcap 88074,hashsize 1; sid:1;)
18 changes: 18 additions & 0 deletions tests/datasets-memcap-01/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
pcap: ../flowbit-oring/input.pcap

requires:
lt-version: 8

args:
- -k none

checks:
- filter:
count: 1
match:
event_type: alert
- filter:
count: 1
match:
event_type: alert
alert.signature_id: 1
14 changes: 14 additions & 0 deletions tests/datasets-memcap-02/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Test Description
================

This test demonstrates that the memcap settings take the string length into account in 8.0.x.

PCAP
====

Comes from existing test `flowbit-oring`.

Related tickets
===============

https://redmine.openinfosecfoundation.org/issues/3910
1 change: 1 addition & 0 deletions tests/datasets-memcap-02/datasets.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Y3VybC83LjQzLjA=
1 change: 1 addition & 0 deletions tests/datasets-memcap-02/test.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert http any any -> any any (http.user_agent; dataset:isset,ua-seen,type string,load datasets.csv,memcap 88074,hashsize 1; sid:1;)
16 changes: 16 additions & 0 deletions tests/datasets-memcap-02/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
pcap: ../flowbit-oring/input.pcap

requires:
min-version: 8
os: linux
arch: x86_64

exit-code: 1

args:
- -k none

checks:
- shell:
args: grep "dataset too large for set memcap" suricata.log | wc -l
expect: 1
Loading