-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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: more keywords; plus some eve/keyword parity tooling - v6 #12652
base: master
Are you sure you want to change the base?
Conversation
scripts/eve-parity.py
Outdated
def load_known_keywords(): | ||
keywords = set() | ||
result = subprocess.check_output(["./src/suricata", "--list-keywords=csv"]) | ||
lines = result.decode().split("\n") | ||
# Skip first line, as its a header line. | ||
for line in lines[1:]: | ||
parts = line.split(";") | ||
if parts: | ||
keywords.add(parts[0]) | ||
return keywords |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should skip fields that are transform
in the 4th column.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #12652 +/- ##
==========================================
- Coverage 80.77% 80.77% -0.01%
==========================================
Files 932 932
Lines 259517 259758 +241
==========================================
+ Hits 209629 209820 +191
- Misses 49888 49938 +50
Flags with carried forward coverage won't be shown. Click here to find out more. |
if !name.value.is_empty() { | ||
*buf = name.value.as_ptr(); | ||
*len = name.value.len() as u32; | ||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S-V coverage missing.
if !name.value.is_empty() { | ||
*buf = name.value.as_ptr(); | ||
*len = name.value.len() as u32; | ||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S-V coverage missing.
DNSRData::CNAME(name) | ||
| DNSRData::PTR(name) | ||
| DNSRData::MX(name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S-V coverage missing.
Feature: 7012 Add dns.response sticky buffer to match on dns response fields. Add rust functions to return dns response packet data. Unit tests verifying signature matching.
Feature: 7012
This is a better name as the keyword is looking at all rrname type fields in the response.
These arrays are manually formatted for readability.
Make the function safe by returning a reference to the DNSName object, the unsafe C wrapper can do the conversion to pointers.
Split DetectHelperKeywordRegister into 2 functions, one for acquiring a new keyword ID, and another to perform the registration. This makes it easier to do the traditional C keyword initialization with a dynamic ID.
Add keywords dns.additionals.rrname and dns.authorities.rrname. Along the way, consolidate dns.query.name and dns.answer.name into a single file and register them altogether since there is a lot of common code.
Should have coverage by S-V now.
b2b35ed
to
762e73e
Compare
Information: QA ran without warnings. Pipeline 24853 |
Information: QA ran without warnings. Pipeline 24856 |
"type": "integer" | ||
"type": "integer", | ||
"suricata": { | ||
"keywords": false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it good to have this suricata.keyword
that can either be a boolean or an array ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with it, unless its going into something the hardcodes a schema based on whats first seen., so not in eve. Prevents conflict with another field as well..
"keywords": ["one", "two"],
"no-keywords": "true",
SCFree(ptr); | ||
} | ||
|
||
static int DetectDnsResponsePrefilterMpmRegister(DetectEngineCtx *de_ctx, SigGroupHead *sgh, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need a specific stuff here ?
Do not we get prefilter for all sticky buffers from the generic engine ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not we get prefilter for all sticky buffers from the generic engine ?
Are you asking? If so, I'm not sure.
InspectionBuffer *buffer = | ||
GetBuffer(det_ctx, flags, transforms, txv, &cbdata, engine->sm_list, false); | ||
if (buffer == NULL || buffer->inspect == NULL) { | ||
local_id++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need local_id++
if we break right after ?
This PR builds on #12500 and also adds the following keywords:
dns.additionals.rrname
dns.authorities.rrname
It builds on dns: add keyword for dns.response.rrname (feat 7012) - v2 #12500 and it uses functions introduced as part of the work for
dns.response.rrname
.To provide consistency and better eve parity the following keywords were renamed:
dns.query.rrname
->dns.queries.rrname
dns.answer.rrname
->dns.answers.rrname
And finally, as using DNS as a test protocol for parity, try some tooling for eve parity.
For example,
./scripts/eve-parity.py mapped-keywords
:and
./scripts/eve-parity.py unmapped-fields | grep dns
:and new in this version:
unmapped-keywords
to show known keywords that arenot mapped in the eve.json.
Other changes:
SV_BRANCH=OISF/suricata-verify#2311