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

tests: add rule to check for tcp/ack - v1 #1423

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/rules/tcp-ack-keyword/test.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert tcp any any -> any any (msg:"Testing ack";ack:273;sid:1;)
14 changes: 14 additions & 0 deletions tests/rules/tcp-ack-keyword/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
requires:
min-version: 7.0.0
pcap: false

args:
- --engine-analysis

checks:
- filter:
filename: rules.json
count: 1
match:
id: 1
lists.packet.matches[0].name: "tcp.ack"
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be good to have another line check here with the actual value that ack has in the line, (cf https://github.com/OISF/suricata-verify/tree/master/tests/rules/ipopts or other tests there, many of them check not only for the keyword itself, but also any value assigned to it.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! I wanted to do that, but looking at the codes, I didn't see any parameter that would be used for it.

So I assumed it didn't exist.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think this test tests what you have done in your Suricata PR. That should have made this test fail. tcp.ack already exists in Suricata's matches which is why the rules as you have written work.
You should have checked for (alongwith what you already have) lists.packet....ack.ack: 273.

I didn't see any parameter that would be used for it.

Because you just added it in your Suricata PR ;)