From: Hadiqa Alamdar Bukhari Date: Tue, 26 Dec 2023 10:00:08 +0000 (+0500) Subject: test: add test for dns.rcode X-Git-Tag: suricata-6.0.17~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1687%2Fhead;p=thirdparty%2Fsuricata-verify.git test: add test for dns.rcode Feature #6621 --- diff --git a/tests/dns/dns-rcode/README.md b/tests/dns/dns-rcode/README.md new file mode 100644 index 000000000..d4722474f --- /dev/null +++ b/tests/dns/dns-rcode/README.md @@ -0,0 +1,7 @@ +Test the `dns.rcode` header value. + +The PCAP here used the pcap from test dns-eve-v2-udp-nxdomain-soa with +hex editing header flags to have the DNS query have something in the `rcode` +section. + +Redmine ticket: https://redmine.openinfosecfoundation.org/issues/6621 diff --git a/tests/dns/dns-rcode/input.pcap b/tests/dns/dns-rcode/input.pcap new file mode 100644 index 000000000..8396d3ee6 Binary files /dev/null and b/tests/dns/dns-rcode/input.pcap differ diff --git a/tests/dns/dns-rcode/test.rules b/tests/dns/dns-rcode/test.rules new file mode 100644 index 000000000..1ec3f3905 --- /dev/null +++ b/tests/dns/dns-rcode/test.rules @@ -0,0 +1,8 @@ +# Should alert in client direction. +alert dns any any -> any any (dns.rcode:3; flow:to_client; sid:1; rev:1;) + +# Should only alert in client direction. +alert dns any any -> any any (dns.rcode:!2; flow:to_client; sid:2; rev:1;) + +# Should only alert in server direction. +alert dns any any -> any any (dns.rcode:3; flow:to_server; sid:3; rev:1;) diff --git a/tests/dns/dns-rcode/test.yaml b/tests/dns/dns-rcode/test.yaml new file mode 100644 index 000000000..412f042e3 --- /dev/null +++ b/tests/dns/dns-rcode/test.yaml @@ -0,0 +1,35 @@ +requires: + min-version: 8 + +checks: + - filter: + count: 1 + match: + alert.signature_id: 1 + dest_ip: 10.16.1.11 + dest_port: 59465 + direction: to_client + app_proto: dns + event_type: alert + dns.answer.rcode: NXDOMAIN + src_ip: 8.8.4.4 + src_port: 53 + - filter: + count: 1 + match: + alert.signature_id: 2 + dest_ip: 10.16.1.11 + dest_port: 59465 + direction: to_client + app_proto: dns + event_type: alert + dns.answer.rcode: NXDOMAIN + src_ip: 8.8.4.4 + src_port: 53 + - filter: + count: 1 + match: + alert.signature_id: 3 + direction: to_server + app_proto: dns + event_type: alert