]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
add tests for MQTT events
authorSascha Steinbiss <satta@debian.org>
Fri, 11 Mar 2022 18:46:32 +0000 (19:46 +0100)
committerJason Ish <jason.ish@oisf.net>
Fri, 29 Apr 2022 19:13:46 +0000 (13:13 -0600)
tests/mqtt5-excessiveproplen/input.pcap [new file with mode: 0644]
tests/mqtt5-excessiveproplen/suricata.yaml [new file with mode: 0644]
tests/mqtt5-excessiveproplen/test.rules [new file with mode: 0644]
tests/mqtt5-excessiveproplen/test.yaml [new file with mode: 0644]

diff --git a/tests/mqtt5-excessiveproplen/input.pcap b/tests/mqtt5-excessiveproplen/input.pcap
new file mode 100644 (file)
index 0000000..2dc68d8
Binary files /dev/null and b/tests/mqtt5-excessiveproplen/input.pcap differ
diff --git a/tests/mqtt5-excessiveproplen/suricata.yaml b/tests/mqtt5-excessiveproplen/suricata.yaml
new file mode 100644 (file)
index 0000000..f6afe76
--- /dev/null
@@ -0,0 +1,17 @@
+%YAML 1.1
+---
+
+outputs:
+  - eve-log:
+      enabled: yes
+      filetype: regular
+      filename: eve.json
+      types:
+        - mqtt
+        - alert
+        - anomaly
+
+app-layer:
+  protocols:
+    mqtt:
+      enabled: yes
diff --git a/tests/mqtt5-excessiveproplen/test.rules b/tests/mqtt5-excessiveproplen/test.rules
new file mode 100644 (file)
index 0000000..a1c2454
--- /dev/null
@@ -0,0 +1 @@
+alert mqtt any any -> any any (msg:"SURICATA MQTT Malformed Traffic"; app-layer-event:mqtt.malformed_traffic; classtype:protocol-command-decode; sid:1234; rev:1;)
diff --git a/tests/mqtt5-excessiveproplen/test.yaml b/tests/mqtt5-excessiveproplen/test.yaml
new file mode 100644 (file)
index 0000000..aa1c9bb
--- /dev/null
@@ -0,0 +1,25 @@
+requires:
+  features:
+    - HAVE_LIBJANSSON
+  files:
+    - rust/src/mqtt/parser.rs
+
+args:
+  - -k none
+
+checks:
+
+  - filter:
+      count: 1
+      match:
+        event_type: anomaly
+        anomaly.app_proto: mqtt
+        anomaly.type: applayer
+        anomaly.event: malformed_traffic
+        anomaly.layer: proto_parser
+
+  - filter:
+      count: 1
+      match:
+        event_type: alert
+        alert.signature_id: 1234