]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
dns txt test: break into v1 and v2 tests
authorJason Ish <jason.ish@oisf.net>
Mon, 20 Apr 2020 17:39:54 +0000 (11:39 -0600)
committerJason Ish <jason.ish@oisf.net>
Wed, 29 Apr 2020 21:08:05 +0000 (15:08 -0600)
Eliminating the check.sh test at the same time.

tests/dns-udp-eve-log-txt/README.md [deleted file]
tests/dns-udp-eve-log-txt/check.sh [deleted file]
tests/dns-udp-eve-log-txt/test.yaml [deleted file]
tests/dns-udp-eve-v1-txt/suricata.yaml [moved from tests/dns-udp-eve-log-txt/suricata.yaml with 81% similarity]
tests/dns-udp-eve-v1-txt/test.yaml [new file with mode: 0644]
tests/dns-udp-eve-v2-txt/input.pcap [moved from tests/dns-udp-eve-log-txt/dns-txt-google.com.pcap with 100% similarity]
tests/dns-udp-eve-v2-txt/test.yaml [new file with mode: 0644]

diff --git a/tests/dns-udp-eve-log-txt/README.md b/tests/dns-udp-eve-log-txt/README.md
deleted file mode 100644 (file)
index 5a1c088..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-Test that a TXT record is extracted and logged correctly to Eve.
-
diff --git a/tests/dns-udp-eve-log-txt/check.sh b/tests/dns-udp-eve-log-txt/check.sh
deleted file mode 100755 (executable)
index e9ac4b7..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#! /bin/sh
-
-set -e
-
-txt=$(cat eve.json | \
-         jq -c 'select(.dns.type == "answer") | select(.dns.rrtype == "TXT") | .dns.rdata')
-test "${txt}" = '"v=spf1 include:_spf.google.com ~all"'
-
-
diff --git a/tests/dns-udp-eve-log-txt/test.yaml b/tests/dns-udp-eve-log-txt/test.yaml
deleted file mode 100644 (file)
index 56ea9b0..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-requires:
-  features:
-    - HAVE_LIBJANSSON
similarity index 81%
rename from tests/dns-udp-eve-log-txt/suricata.yaml
rename to tests/dns-udp-eve-v1-txt/suricata.yaml
index 5f7eded22dbe6f08572e51f398c349ce1949c786..beab613ba49234a98518f0bf0c287f9d938a497e 100644 (file)
@@ -4,7 +4,6 @@
 outputs:
   - eve-log:
       enabled: yes
-      filename: eve.json
       types:
         - dns:
             version: 1
diff --git a/tests/dns-udp-eve-v1-txt/test.yaml b/tests/dns-udp-eve-v1-txt/test.yaml
new file mode 100644 (file)
index 0000000..bca7278
--- /dev/null
@@ -0,0 +1,79 @@
+pcap: ../dns-udp-eve-v2-txt/input.pcap
+
+checks:
+- filter:
+    count: 4
+    match:
+      event_type: dns
+- filter:
+    count: 1
+    match:
+      dest_ip: 10.16.1.1
+      dest_port: 53
+      dns.id: 28243
+      dns.rrname: google.com
+      dns.rrtype: TXT
+      dns.tx_id: 0
+      dns.type: query
+      event_type: dns
+      pcap_cnt: 1
+      proto: UDP
+      src_ip: 10.16.1.11
+      src_port: 52345
+- filter:
+    count: 1
+    match:
+      dest_ip: 10.16.1.1
+      dest_port: 53
+      dns.id: 39372
+      dns.rrname: textsecure-service-ca.whispersystems.org
+      dns.rrtype: A
+      dns.tx_id: 0
+      dns.type: query
+      event_type: dns
+      pcap_cnt: 3
+      proto: UDP
+      src_ip: 10.16.1.11
+      src_port: 60922
+- filter:
+    count: 1
+    match:
+      dest_ip: 10.16.1.1
+      dest_port: 53
+      dns.flags: '8180'
+      dns.id: 28243
+      dns.qr: true
+      dns.ra: true
+      dns.rcode: NOERROR
+      dns.rd: true
+      dns.rdata: v=spf1 include:_spf.google.com ~all
+      dns.rrname: google.com
+      dns.rrtype: TXT
+      dns.ttl: 3217
+      dns.type: answer
+      event_type: dns
+      pcap_cnt: 2
+      proto: UDP
+      src_ip: 10.16.1.11
+      src_port: 52345
+- filter:
+    count: 1
+    match:
+      dest_ip: 10.16.1.1
+      dest_port: 53
+      dns.flags: '8180'
+      dns.id: 39372
+      dns.qr: true
+      dns.ra: true
+      dns.rcode: NOERROR
+      dns.rd: true
+      dns.rdata: 34.197.178.240
+      dns.rrname: textsecure-service-ca.whispersystems.org
+      dns.rrtype: A
+      dns.ttl: 5
+      dns.type: answer
+      event_type: dns
+      pcap_cnt: 4
+      proto: UDP
+      src_ip: 10.16.1.11
+      src_port: 60922
diff --git a/tests/dns-udp-eve-v2-txt/test.yaml b/tests/dns-udp-eve-v2-txt/test.yaml
new file mode 100644 (file)
index 0000000..5f7461f
--- /dev/null
@@ -0,0 +1,123 @@
+# *** Add configuration here ***
+
+checks:
+- filter:
+    count: 1
+    match:
+      dest_ip: 10.16.1.1
+      dest_port: 53
+      dns.id: 39372
+      dns.rrname: textsecure-service-ca.whispersystems.org
+      dns.rrtype: A
+      dns.tx_id: 0
+      dns.type: query
+      event_type: dns
+      pcap_cnt: 3
+      proto: UDP
+      src_ip: 10.16.1.11
+      src_port: 60922
+- filter:
+    count: 1
+    match:
+      dest_ip: 10.16.1.1
+      dest_port: 53
+      dns.id: 28243
+      dns.rrname: google.com
+      dns.rrtype: TXT
+      dns.tx_id: 0
+      dns.type: query
+      event_type: dns
+      pcap_cnt: 1
+      proto: UDP
+      src_ip: 10.16.1.11
+      src_port: 52345
+- filter:
+    count: 1
+    match:
+      dest_ip: 10.16.1.1
+      dest_port: 53
+      dns.answers[0].rdata: 34.197.178.240
+      dns.answers[0].rrname: textsecure-service-ca.whispersystems.org
+      dns.answers[0].rrtype: A
+      dns.answers[0].ttl: 5
+      dns.flags: '8180'
+      dns.grouped.A[0]: 34.197.178.240
+      dns.id: 39372
+      dns.qr: true
+      dns.ra: true
+      dns.rcode: NOERROR
+      dns.rd: true
+      dns.rrname: textsecure-service-ca.whispersystems.org
+      dns.rrtype: A
+      dns.type: answer
+      dns.version: 2
+      event_type: dns
+      pcap_cnt: 4
+      proto: UDP
+      src_ip: 10.16.1.11
+      src_port: 60922
+- filter:
+    count: 1
+    match:
+      dest_ip: 10.16.1.1
+      dest_port: 53
+      dns.answers[0].rdata: v=spf1 include:_spf.google.com ~all
+      dns.answers[0].rrname: google.com
+      dns.answers[0].rrtype: TXT
+      dns.answers[0].ttl: 3217
+      dns.flags: '8180'
+      dns.grouped.TXT[0]: v=spf1 include:_spf.google.com ~all
+      dns.id: 28243
+      dns.qr: true
+      dns.ra: true
+      dns.rcode: NOERROR
+      dns.rd: true
+      dns.rrname: google.com
+      dns.rrtype: TXT
+      dns.type: answer
+      dns.version: 2
+      event_type: dns
+      pcap_cnt: 2
+      proto: UDP
+      src_ip: 10.16.1.11
+      src_port: 52345
+- filter:
+    count: 1
+    match:
+      app_proto: dns
+      dest_ip: 10.16.1.1
+      dest_port: 53
+      event_type: flow
+      flow.age: 0
+      flow.alerted: false
+      flow.bytes_toclient: 116
+      flow.bytes_toserver: 100
+      flow.end: 2017-06-08T15:45:58.525601+0000
+      flow.pkts_toclient: 1
+      flow.pkts_toserver: 1
+      flow.reason: shutdown
+      flow.start: 2017-06-08T15:45:58.520996+0000
+      flow.state: established
+      proto: UDP
+      src_ip: 10.16.1.11
+      src_port: 60922
+- filter:
+    count: 1
+    match:
+      app_proto: dns
+      dest_ip: 10.16.1.1
+      dest_port: 53
+      event_type: flow
+      flow.age: 0
+      flow.alerted: false
+      flow.bytes_toclient: 129
+      flow.bytes_toserver: 81
+      flow.end: 2017-06-08T15:45:57.833020+0000
+      flow.pkts_toclient: 1
+      flow.pkts_toserver: 1
+      flow.reason: shutdown
+      flow.start: 2017-06-08T15:45:57.828730+0000
+      flow.state: established
+      proto: UDP
+      src_ip: 10.16.1.11
+      src_port: 52345