]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
tests: add test for flow.memcap exception policy
authorJuliana Fajardini <jufajardini@oisf.net>
Mon, 20 Mar 2023 17:14:30 +0000 (14:14 -0300)
committerJason Ish <ish@unx.ca>
Thu, 18 May 2023 07:42:02 +0000 (09:42 +0200)
tests/exception-policy-simulated-flow-memcap/README.md [new file with mode: 0644]
tests/exception-policy-simulated-flow-memcap/suricata.yaml [new file with mode: 0644]
tests/exception-policy-simulated-flow-memcap/test.rules [new file with mode: 0644]
tests/exception-policy-simulated-flow-memcap/test.yaml [new file with mode: 0644]

diff --git a/tests/exception-policy-simulated-flow-memcap/README.md b/tests/exception-policy-simulated-flow-memcap/README.md
new file mode 100644 (file)
index 0000000..b23c22a
--- /dev/null
@@ -0,0 +1,19 @@
+Test
+====
+
+Test both the exception policy for when Suricata reaches a flow memcap, and the
+command-line option to simulate said memcap hit.
+
+Expected Behavior
+=================
+
+When Suricata tries to create a new flow reaching packet 6, it will simulate a
+failure, therefore dropping said packet. As midstream pickup is said to true,
+Suri will later on register a midstream flow for that. Other packets/flows will
+be decoded and inspected normally.
+
+PCAP
+====
+
+Pcap from `tls` suricata-verify test.
+
diff --git a/tests/exception-policy-simulated-flow-memcap/suricata.yaml b/tests/exception-policy-simulated-flow-memcap/suricata.yaml
new file mode 100644 (file)
index 0000000..20dcc8e
--- /dev/null
@@ -0,0 +1,24 @@
+%YAML 1.1
+---
+
+outputs:
+  - eve-log:
+      enabled: yes
+      types:
+        - alert:
+            tagged-packets: yes
+        - anomaly:
+            enabled: yes
+            types:
+              decode: no
+              stream: yes
+              applayer: yes
+        - tls:
+            extended: yes     # enable this for extended logging information
+        - drop:
+            alerts: yes      # log alerts that caused drops
+            flows: all       # start or all: 'start' logs only a single drop
+        - flow
+        - stats
+
+exception-policy: ignore
diff --git a/tests/exception-policy-simulated-flow-memcap/test.rules b/tests/exception-policy-simulated-flow-memcap/test.rules
new file mode 100644 (file)
index 0000000..b9d1df2
--- /dev/null
@@ -0,0 +1 @@
+alert tls any any -> any any (msg:"tls app-proto"; sid:1000001; rev:1;)
diff --git a/tests/exception-policy-simulated-flow-memcap/test.yaml b/tests/exception-policy-simulated-flow-memcap/test.yaml
new file mode 100644 (file)
index 0000000..11632c6
--- /dev/null
@@ -0,0 +1,32 @@
+requires:
+  features:
+    - DEBUG
+
+pcap: ../tls/tls-cert-issuer/tls.pcap
+
+args:
+- --simulate-ips
+- -k none
+- --set stream.midstream=true
+- --simulate-packet-flow-memcap=6
+- --set flow.memcap-policy=drop-flow
+
+checks:
+  - filter:
+      count: 97
+      match:
+        event_type: alert
+  - filter:
+      count: 1
+      match:
+        event_type: drop
+        drop.reason: "flow memcap"
+  - filter:
+      count: 5
+      match:
+        event_type: tls
+  - filter:
+      count: 1
+      match:
+        event_type: stats
+        stats.tcp.midstream_pickups: 1