From: Jason Ish Date: Wed, 15 Nov 2023 17:21:24 +0000 (-0600) Subject: test: new test for dns.query.name X-Git-Tag: suricata-6.0.16~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1544%2Fhead;p=thirdparty%2Fsuricata-verify.git test: new test for dns.query.name --- diff --git a/tests/dns/dns-query-name/README.md b/tests/dns/dns-query-name/README.md new file mode 100644 index 000000000..59e9c46be --- /dev/null +++ b/tests/dns/dns-query-name/README.md @@ -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 index 000000000..3657ec7ee --- /dev/null +++ b/tests/dns/dns-query-name/test.rules @@ -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 index 000000000..5b8f9e4e3 --- /dev/null +++ b/tests/dns/dns-query-name/test.yaml @@ -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