-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
add tcp flags to aws/vpcflow fileset #23157
Conversation
Pinging @elastic/security-external-integrations (Team:Security-External Integrations) |
f47df01
to
05a1429
Compare
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
💚 Flaky test reportTests succeeded. Expand to view the summary
Test stats 🧪
|
@leehinman AWS has a weird way of dealing ACK:
So maybe we should have a |
If bitmask is 18 you should get
Is that OK? The code will add to the array for every bit that is set. I think what Amazon is saying is that they don't bother to report when only 'ack' is set. |
sounds good |
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.
This should good after the syn-ack support. I looked this over and also consulted these AWS docs to see some examples.
if ((flags & 0x01) != 0) { | ||
ctx.aws.vpcflow.tcp_flags_array.add('fin'); | ||
} | ||
if ((flags & 0x02) != 0) { |
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 think that if you check for 0x12 first (syn-ack) and then subtract that value out this will be good.
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 think that if you check for 0x12 first (syn-ack) and then subtract that value out this will be good.
This could be grumpy old networking guy talking but there is no SYN-ACK flag, you just have the syn and the ack flags set. So the array that gets populated should contain 'syn' and 'ack'.
/g/k/h/t/n/n/
/r/c/s/s/y/i/
/u/a/p/r/s/f/
0 1 0 0 1 0 (0x12 or 18)
Which would give you:
"aws.vpcflow.tcp_flags_array": ["syn", "ack"]
Or we could go with a keyword instead of array where we cat the flags together separated by "-", that would give:
"aws.vpcflow.tcp_flags_array": "syn-ack"
But I have trouble mixing the two approaches. For example if all the fields were set would you expect:
"aws.vpcflow.tcp_flags_array": ["fin", "syn", "rst", "psh", "ack", "urg"]
or
"aws.vpcflow.tcp_flags_array": ["fin", "syn-ack", "rst", "psh", "urg"]
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 realize that there is no syn-ack flag and that this is a bitmask. 😄
The reason for the unique handling is that AWS treats ACK special. It only sets the ACK bit when it sees it as part of a SYN,ACK response. If, for example, it sees a plain ACK or PSH,ACK packet in a flow it won't report the ACK bit. So rather than having a plain ACK in the list I was thinking having the SYN-ACK in there to highlight the meaning, but we could just as well report ["SYN", "ACK"]
and have consumers understand the meaning of ACK in this case.
In my experience this is distinct from how Netflow reports tcp flags. It uses a simple OR based aggregation over the flow. This makes it nearly impossible to determine which side initiated a flow or terminated it. (BTW there's a issue #12858 to do this same thing for netflow.)
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.
From a query perspective I don't think it matters too much. You can query flags:SYN and not flags.ACK
or flags:SYN and flags:ACK
.
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.
Yeah, I see that AWS will never report a naked "ACK". 😃
Looks like AWS will also OR across the aggregation interval (19 for fin, syn & ack), added example of that.
I was also thinking the code could be useful for other data sets like liblogparser.js, which also makes me lean towards just turning the existing flags into names.
That being said, I can live with "syn-ack"
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 good with separate keywords for each bit given that there is no loss of functionality from a query perspective.
- new field aws.vpcflow.tcp_flags_array Closes elastic#22820
11e98ca
to
ae54f40
Compare
@leehinman Is this one ready to merge? When we get an ECS field declared we can come back and update separately (if that's what you're waiting on). run tests |
* add tcp flags to aws/vpcflow fileset - new field aws.vpcflow.tcp_flags_array Closes elastic#22820 Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co> (cherry picked from commit 8beb815)
What does this PR do?
Converts the existing aws.vpcflow.tcp_flags bit mask into an array of
tcp flags and stores them in aws.vpcflow.tcp_flags_array.
Why is it important?
makes it easier to query if a particular flag is set
Checklist
- [ ] I have made corresponding change to the default configuration filesCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.How to test this PR locally
Related issues