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

dns: unify dns eve object; add additionals section - v5 #11305

Closed
wants to merge 9 commits into from

Conversation

jasonish
Copy link
Member

@jasonish jasonish commented Jun 13, 2024

Previous PR: #11283

https://redmine.openinfosecfoundation.org/issues/7011
https://redmine.openinfosecfoundation.org/issues/7017
https://redmine.openinfosecfoundation.org/issues/6281

Changes from last PR:

  • address comments
  • log all sections, not just queries in requests
  • merge in additionals: Dns feature 7011 v3 #11263
  • remove unused schema elements

SV_BRANCH=OISF/suricata-verify#1916

scrivs86 and others added 9 commits June 13, 2024 08:45
Feature: 7011
Add additionals to DNSMessage struct.
Add parsing logic to populate additional section data.
Patch dns tests to account for additional section parsing.
Feature: 7011
dns_log_json_answer: log additional section records.
update schema.json with new "additionals" section.
Feature: 7017
Add DNSRDataOPT struct and DNSRData enum type OPT.
Add OPT parsing function and test function.
Add DNSRData OPT type to lua.rs match.
Log OPT rdata.
If multiple queries exist in a DNS request, Suricata would log a
discrete DNS event for each request. However, in an alert on a DNS
request, the DNS object would contain an array of query objects.

This brings the "dns" object into alignment with respect to DNS
requests in alerts and "dns" records.

This introduces a new function for logging DNS messages that is common
for requests and responses which should reduce code, but for this
commit is only used for requests, so doesn't cover responses yet.

As this is a breaking change, rename the "query" array in alerts to
"queries" to be more in alignment with how we log "answers" and
"authorities".

Note that this is a breaking change.

Bug: OISF#6281
By using the same function for logging DNS requests and responses we
can better ensure that the format stays consistent between.

Bug: OISF#6281
- answer object
- top level rrname and rrtype
- header level details in answers

Bug: OISF#6281
While not normally in seen in a DNS query, there is nothing preventing
a query from containing other data sections.  And it is normal in some
types of requests like a zone update, and very common in mDNS.

So log all sections even for requests.
@jasonish jasonish requested review from jufajardini, victorjulien and a team as code owners June 13, 2024 22:16
Copy link

NOTE: This PR may contain new authors.

Comment on lines +53 to +54
"flags": "100",
"rd": true,
Copy link
Member Author

Choose a reason for hiding this comment

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

I decided to not change the flags within the scope of this PR.

I'd like to further review "default" and "extended" mode for DNS as a separate task, but before 8.

Copy link

codecov bot commented Jun 13, 2024

Codecov Report

Attention: Patch coverage is 96.17021% with 9 lines in your changes missing coverage. Please review.

Project coverage is 82.48%. Comparing base (f0dbfe8) to head (a7934d3).
Report is 36 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11305      +/-   ##
==========================================
+ Coverage   82.45%   82.48%   +0.02%     
==========================================
  Files         961      961              
  Lines      251710   251798      +88     
==========================================
+ Hits       207552   207683     +131     
+ Misses      44158    44115      -43     
Flag Coverage Δ
fuzzcorpus 60.32% <92.61%> (+0.01%) ⬆️
livemode 18.69% <0.00%> (+<0.01%) ⬆️
pcap 43.84% <92.61%> (+0.04%) ⬆️
suricata-verify 61.19% <93.28%> (+0.01%) ⬆️
unittests 59.97% <50.21%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline 21085

@catenacyber catenacyber added the needs rebase Needs rebase to master label Jun 20, 2024
@catenacyber
Copy link
Contributor

I think it needs a rebase to get green CI

Copy link
Contributor

@catenacyber catenacyber left a comment

Choose a reason for hiding this comment

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

Thanks for the work :-)

@victorjulien
Copy link
Member

New format makes sense to me. I do think we need to keep supporting v:2 for 8, then remove it in 9.

In alerts: use v:3
in default config use v:3 for dns type
if no version specification, default to v:3 for dns events
upgrade guide should mention version option in yaml
if v2 is specified for dns event type, use v2

@jasonish
Copy link
Member Author

Commit messages : dns parsing: add additional section -> dns: parse add additional section ?

Fixed.

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.

Documentation-wise, I really like the log output comparison that goes along with the upgrading note.
Should we also update https://docs.suricata.io/en/latest/output/eve/eve-json-format.html#event-type-dns ?

Suricata 8.0 modifies the DNS logging in ``dns`` and ``alert`` records
to a version ``3`` logging format. These changes address a lack of
fidelity in alerts for DNS responses, as well as unify the format of
the ``dns`` object accross ``dns`` and ``alert`` objects.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: across

@jasonish
Copy link
Member Author

jasonish commented Jul 5, 2024

#11433 allows a user to keep v2 for dns records.

@jasonish jasonish closed this Jul 5, 2024
@jasonish
Copy link
Member Author

jasonish commented Jul 5, 2024

Documentation-wise, I really like the log output comparison that goes along with the upgrading note. Should we also update https://docs.suricata.io/en/latest/output/eve/eve-json-format.html#event-type-dns ?

Fixed in the new PR: #11439

@jasonish jasonish deleted the dns-request-array/v5 branch August 7, 2024 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs rebase Needs rebase to master
Development

Successfully merging this pull request may close these issues.

6 participants