]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
dns test: add check for dns object in alert
authorJason Ish <ish@unx.ca>
Thu, 24 Jan 2019 16:51:31 +0000 (10:51 -0600)
committerVictor Julien <victor@inliniac.net>
Fri, 8 Feb 2019 11:26:36 +0000 (12:26 +0100)
Extend an existing test to check that the DNS object exists
on a DNS alert.

tests/dns-eve-v2-udp-dig-a-www-suricata-ids-org/suricata.yaml
tests/dns-eve-v2-udp-dig-a-www-suricata-ids-org/test.rules [new file with mode: 0644]
tests/dns-eve-v2-udp-dig-a-www-suricata-ids-org/test.yaml

index 0bf62d28fe63cdb189341a18a5814125653b3d43..5196815b3a4b0cd519ccd1ccdb4e7e3bca53da48 100644 (file)
@@ -7,6 +7,7 @@ outputs:
   - eve-log:
       enabled: true
       types:
+        - alert:
         - dns:
             enabled: true
             version: 2
diff --git a/tests/dns-eve-v2-udp-dig-a-www-suricata-ids-org/test.rules b/tests/dns-eve-v2-udp-dig-a-www-suricata-ids-org/test.rules
new file mode 100644 (file)
index 0000000..6d7050a
--- /dev/null
@@ -0,0 +1 @@
+alert dns any any -> any any (msg:"TEST dns_query"; dns_query; content:"suricata-ids.org"; sid:1; rev:1;)
index e905bdef66f307358c7ae2adee18df056e009426..da4a87854162044112da4b067876eafbb0a71f33 100644 (file)
@@ -2,8 +2,6 @@ requires:
   features:
     - HAVE_LIBJANSSON
   min-version: 4.1.0
-  script:
-    - grep OutputAnswerV2 src/output-json-dns.c > /dev/null 2>&1
 
 checks:
 
@@ -24,3 +22,11 @@ checks:
         dns.answers[0].rrtype: CNAME
         dns.answers[1].rrtype: A
         dns.answers[2].rrtype: A
+
+  # Check that the alert contains a DNS object.
+  - filter:
+      count: 1
+      comment: alert with dns object
+      match:
+        event_type: alert
+        dns.query[0].type: query