Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add test for dns.rcode #1563

Closed

Conversation

hadiqaalamdar
Copy link
Contributor

Feature #6621

Redmine ticket: https://redmine.openinfosecfoundation.org/issues/6621

Suricata PR: OISF/suricata#10087

Output from stdout file:

Notice: suricata: This is Suricata version 8.0.0-dev (5cc872fa1 2023-12-19) running in USER mode [LogVersion:suricata.c:1147]
Warning: detect: 1 rule files specified, but no rules were loaded! [SigLoadSignatures:detect-engine-loader.c:359]

@jasonish
Copy link
Member

This test is missing a pcap. Most of our existing DNS pcaps will have rcode values of 0 so are not that interesting. But ./tests/dns-eve-v2-udp-nxdomain-soa/dns-udp-nxdomain-soa.pcap does have a DNS response with a non-zero error code.

@catenacyber catenacyber added the requires suricata pr Depends on a PR in Suricata label Dec 21, 2023
@catenacyber
Copy link
Collaborator

This test is missing a pcap. Most of our existing DNS pcaps will have rcode values of 0 so are not that interesting. But ./tests/dns-eve-v2-udp-nxdomain-soa/dns-udp-nxdomain-soa.pcap does have a DNS response with a non-zero error code.

You should use pcap: in test.yaml to tell which pcap you want to reuse

@@ -0,0 +1,8 @@
# Should alert in both directions as no flow is provided.
alert dns any any -> any any (dns.rcode; content:"oisf"; sid:1; rev:1;)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it not be something like dns.rcode:12 ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and no content

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's an integer keyword ;)

- filter:
count: 1
match:
alert.signature_id: 3
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can have only one filter per signature id, right ?

@jufajardini
Copy link
Contributor

This test is missing a pcap. Most of our existing DNS pcaps will have rcode values of 0 so are not that interesting. But ./tests/dns-eve-v2-udp-nxdomain-soa/dns-udp-nxdomain-soa.pcap does have a DNS response with a non-zero error code.

On the other hand, maybe we could have two tests, and use one of the pcaps withrcode of zero to test the negated content option? 🤔

Copy link
Contributor

@jufajardini jufajardini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few more comments to help you keep moving! :)


The PCAP here was a request created with Scapy to include answers in
the request. However the response is from a real DNS server with the
provided request.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a reference to the redmine ticket :)

If you do re-use a pcap from a different test, you can indicate that here, too.

@@ -0,0 +1,8 @@
# Should alert in both directions as no flow is provided.
alert dns any any -> any any (dns.rcode; content:"oisf"; sid:1; rev:1;)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's an integer keyword ;)

Comment on lines +8 to +9
alert.signature_id: 1
app_proto: dns
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's important to add a check for the rcode field on the checks, too :)

@hadiqaalamdar
Copy link
Contributor Author

New PR: #1567

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
requires suricata pr Depends on a PR in Suricata
Development

Successfully merging this pull request may close these issues.

4 participants