]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
test: new test for dns.answer.name
authorJason Ish <jason.ish@oisf.net>
Wed, 15 Nov 2023 17:21:12 +0000 (11:21 -0600)
committerVictor Julien <victor@inliniac.net>
Wed, 13 Dec 2023 18:17:16 +0000 (19:17 +0100)
tests/dns/dns-answer-name/README.md [new file with mode: 0644]
tests/dns/dns-answer-name/dns-udp-request-with-answer.pcap [new file with mode: 0644]
tests/dns/dns-answer-name/test.rules [new file with mode: 0644]
tests/dns/dns-answer-name/test.yaml [new file with mode: 0644]

diff --git a/tests/dns/dns-answer-name/README.md b/tests/dns/dns-answer-name/README.md
new file mode 100644 (file)
index 0000000..bf5513f
--- /dev/null
@@ -0,0 +1,5 @@
+Test the `dns.answer.name` sticky buffer.
+
+The PCAP here was a request created with Scapy to include answers in
+the request. However the response is from a real DNS server with the
+provided request.
diff --git a/tests/dns/dns-answer-name/dns-udp-request-with-answer.pcap b/tests/dns/dns-answer-name/dns-udp-request-with-answer.pcap
new file mode 100644 (file)
index 0000000..102e5aa
Binary files /dev/null and b/tests/dns/dns-answer-name/dns-udp-request-with-answer.pcap differ
diff --git a/tests/dns/dns-answer-name/test.rules b/tests/dns/dns-answer-name/test.rules
new file mode 100644 (file)
index 0000000..0544ae1
--- /dev/null
@@ -0,0 +1,8 @@
+# Should alert in both directions as no flow is provided.
+alert dns any any -> any any (dns.answer.name; content:"oisf"; sid:1; rev:1;)
+
+# Should only alert in the request direction.
+alert dns any any -> any any (dns.answer.name; content:"oisf"; flow:to_server; sid:2; rev:1;)
+
+# Should only alert in the response direction.
+alert dns any any -> any any (dns.answer.name; content:"oisf"; flow:to_client; sid:3; rev:1;)
diff --git a/tests/dns/dns-answer-name/test.yaml b/tests/dns/dns-answer-name/test.yaml
new file mode 100644 (file)
index 0000000..4bc24a9
--- /dev/null
@@ -0,0 +1,43 @@
+requires:
+  min-version: 8
+
+checks:
+  - filter:
+      count: 2
+      match:
+        alert.signature_id: 1
+        app_proto: dns
+  - filter:
+      count: 1
+      match:
+        alert.signature_id: 1
+        direction: to_client
+        app_proto: dns
+  - filter:
+      count: 1
+      match:
+        alert.signature_id: 1
+        direction: to_server
+        app_proto: dns
+
+  - filter:
+      count: 1
+      match:
+        alert.signature_id: 2
+  - filter:
+      count: 1
+      match:
+        alert.signature_id: 2
+        direction: to_server
+        app_proto: dns
+
+  - filter:
+      count: 1
+      match:
+        alert.signature_id: 3
+  - filter:
+      count: 1
+      match:
+        alert.signature_id: 3
+        direction: to_client
+        app_proto: dns