]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
tests: add rules for flow drops
authorVictor Julien <victor@inliniac.net>
Thu, 22 Dec 2022 18:17:47 +0000 (19:17 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 19 Jan 2023 16:45:02 +0000 (17:45 +0100)
tests/detect-udp-flow-rule-01/test.rules [new file with mode: 0644]
tests/detect-udp-flow-rule-01/test.yaml [new file with mode: 0644]
tests/detect-udp-flow-rule-02-ips/suricata.yaml [new file with mode: 0644]
tests/detect-udp-flow-rule-02-ips/test.rules [new file with mode: 0644]
tests/detect-udp-flow-rule-02-ips/test.yaml [new file with mode: 0644]

diff --git a/tests/detect-udp-flow-rule-01/test.rules b/tests/detect-udp-flow-rule-01/test.rules
new file mode 100644 (file)
index 0000000..031f1be
--- /dev/null
@@ -0,0 +1,2 @@
+alert tcp any any -> any any (flow:to_server; sid:1;)
+alert udp any any -> any any (flow:to_server; sid:2;)
diff --git a/tests/detect-udp-flow-rule-01/test.yaml b/tests/detect-udp-flow-rule-01/test.yaml
new file mode 100644 (file)
index 0000000..7e1747d
--- /dev/null
@@ -0,0 +1,16 @@
+pcap: ../sip-body-frames/public-cloudshark-sip-s0.pcap
+args:
+- --set app-layer.error-policy=ignore
+- --simulate-ips
+- -k none
+checks:
+  - filter:
+      count: 0
+      match:
+        event_type: alert
+        alert.signature_id: 1
+  - filter:
+      count: 4
+      match:
+        event_type: alert
+        alert.signature_id: 2
diff --git a/tests/detect-udp-flow-rule-02-ips/suricata.yaml b/tests/detect-udp-flow-rule-02-ips/suricata.yaml
new file mode 100644 (file)
index 0000000..dfccb8a
--- /dev/null
@@ -0,0 +1,27 @@
+%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
+                             # per flow direction. All logs each dropped pkt.
+        - flow
+action-order:
+  - pass
+  - drop
+  - reject
+  - alert
diff --git a/tests/detect-udp-flow-rule-02-ips/test.rules b/tests/detect-udp-flow-rule-02-ips/test.rules
new file mode 100644 (file)
index 0000000..e665e6d
--- /dev/null
@@ -0,0 +1,2 @@
+drop tcp any any -> any any (flow:to_server; sid:1;)
+drop udp any any -> any any (flow:to_server; sid:2;)
diff --git a/tests/detect-udp-flow-rule-02-ips/test.yaml b/tests/detect-udp-flow-rule-02-ips/test.yaml
new file mode 100644 (file)
index 0000000..de477b7
--- /dev/null
@@ -0,0 +1,19 @@
+pcap: ../sip-body-frames/public-cloudshark-sip-s0.pcap
+args:
+- --simulate-ips
+- -k none
+checks:
+  - filter:
+      count: 0
+      match:
+        event_type: alert
+        alert.signature_id: 1
+  - filter:
+      count: 4
+      match:
+        event_type: alert
+        alert.signature_id: 2
+  - filter:
+      count: 4
+      match:
+        event_type: drop