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 vlan.id - v8 #2194

Closed
wants to merge 1 commit into from

Conversation

AkakiAlice
Copy link
Contributor

@AkakiAlice AkakiAlice commented Dec 17, 2024

Ticket: #1065

Description:

  • Add Suricata-Verify test for vlan.id keyword

test.rules changes:

  • Change vlan.id:!500; to vlan.id:!500,all; : line 6
  • Add rule to test count : line 11

test.yaml changes:

  • Add alert for new count rule : line 62

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

Previous PR: #2188
Suricata PR: OISF/suricata#12301

alert ip any any -> any any (msg:"VLAN ID at layer 1 is less than 400"; vlan.id:<400,1; sid:8;)
alert ip any any -> any any (msg:"One Vlan ID is greater than or equal to 200"; vlan.id:>=0xC8; sid:9;)
alert ip any any -> any any (msg:"All the Vlan IDs are greater than 100"; vlan.id:>100,all; sid:10;)
alert ip any any -> any any (msg:"Packet has 3 VLAN layers"; vlan.id:3,count; sid:11;)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This PR is really fine.

You could also add prefilter in some signatures, like vlan.id:>100,all; prefilter;

You could also add a signature with vlan.id:0,count; and a packet without vlan

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

@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.

Good for me even if we can always test more

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.

As Philippe mentioned, very good work 👏🏽

I do think we should take advantage of this moment to add the rule checks that we think would make the test more complete (the ones suggested by Philippe).

My comments are just to refine an already great job :)

Comment on lines +1 to +2
#! /usr/bin/env python3
from scapy.all import *
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also have the scapy version as a comment here in the script? Makes it easier to not lose the information :)

@@ -0,0 +1,3 @@
Test for checking the working of vlan.id keyword by creating rules and matching a crafted packet against them. The packet is an ICMP packet with 3 different VLAN ids [200,300,400].
Copy link
Contributor

Choose a reason for hiding this comment

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

As with the docs, these look better if we keep lines to a certain character count limit.
Let's try around 79 or 80?

@@ -0,0 +1,3 @@
Test for checking the working of vlan.id keyword by creating rules and matching a crafted packet against them. The packet is an ICMP packet with 3 different VLAN ids [200,300,400].

PCAP created with scapy 2.5.0.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add the redmine ticket link reference here?

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.

3 participants