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

diff --git a/tests/dns/dns-query-name/README.md b/tests/dns/dns-query-name/README.md
new file mode 100644 (file)
index 0000000..59e9c46
--- /dev/null
@@ -0,0 +1 @@
+Test the `dns.query.name` sticky buffer.
diff --git a/tests/dns/dns-query-name/test.rules b/tests/dns/dns-query-name/test.rules
new file mode 100644 (file)
index 0000000..3657ec7
--- /dev/null
@@ -0,0 +1,8 @@
+# Will alert in both directions as no direction is specified.
+alert dns any any -> any any (dns.query.name; content:"suricata"; sid:1; rev:1;)
+
+# Only alert on requests.
+alert dns any any -> any any (dns.query.name; content:"suricata"; flow:to_server; sid:2; rev:1;)
+
+# Only alert on responses.
+alert dns any any -> any any (dns.query.name; content:"suricata"; flow:to_client; sid:3; rev:1;)
diff --git a/tests/dns/dns-query-name/test.yaml b/tests/dns/dns-query-name/test.yaml
new file mode 100644 (file)
index 0000000..5b8f9e4
--- /dev/null
@@ -0,0 +1,28 @@
+requires:
+  min-version: 8
+
+pcap: ../../cond-log-dns-dig/input.pcap
+
+checks:
+  - 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
+        direction: to_server
+  - filter:
+      count: 1
+      match:
+        alert.signature_id: 3
+        direction: to_client