-
Notifications
You must be signed in to change notification settings - Fork 90
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
next/sv/508/20240628/v1 #1947
Merged
victorjulien
merged 4 commits into
OISF:master
from
victorjulien:next/sv/508/20240628/v1
Jul 2, 2024
Merged
next/sv/508/20240628/v1 #1947
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
522966d
tests: add threshold by_flow test
victorjulien ce00974
tests: add global by_flow thresholding tests
victorjulien 969708a
tests: add detection_filter tests for by_flow and by_src
victorjulien de4ab1a
tests: add threshold backoff tests
victorjulien File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
tests/threshold/threshold-config-rate-filter-alert-flow/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Threshold.config with by_flow | ||
|
||
This test checks threshold.config file using by_flow tracking | ||
|
||
The pcap file is from http-all-headers test |
1 change: 1 addition & 0 deletions
1
tests/threshold/threshold-config-rate-filter-alert-flow/input.rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
drop tcp any any -> any any (dsize:0; sid: 1000001;) |
15 changes: 15 additions & 0 deletions
15
tests/threshold/threshold-config-rate-filter-alert-flow/suricata.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
%YAML 1.1 | ||
--- | ||
|
||
outputs: | ||
- eve-log: | ||
enabled: yes | ||
filetype: regular | ||
filename: eve.json | ||
types: | ||
- alert | ||
- drop: | ||
flows: all | ||
alerts: true | ||
- http | ||
- anomaly |
30 changes: 30 additions & 0 deletions
30
tests/threshold/threshold-config-rate-filter-alert-flow/test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
pcap: ../../http-all-headers/input.pcap | ||
|
||
requires: | ||
min-version: 8 | ||
|
||
args: | ||
- --set threshold-file=${TEST_DIR}/threshold.config | ||
- --simulate-ips | ||
|
||
checks: | ||
- filter: | ||
count: 3 | ||
match: | ||
event_type: alert | ||
alert.signature_id: 1000001 | ||
alert.action: blocked | ||
- filter: | ||
count: 16 | ||
match: | ||
event_type: alert | ||
alert.signature_id: 1000001 | ||
alert.action: allowed | ||
- filter: | ||
count: 3 | ||
match: | ||
event_type: drop | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: http |
1 change: 1 addition & 0 deletions
1
tests/threshold/threshold-config-rate-filter-alert-flow/threshold.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rate_filter gen_id 1, sig_id 1000001, track by_flow, count 3, seconds 60, new_action alert, timeout 1000 | ||
5 changes: 5 additions & 0 deletions
5
tests/threshold/threshold-config-threshold-both-flow/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Threshold.config with by_flow | ||
|
||
This test checks threshold.config file using by_flow keyword | ||
|
||
The pcap file is from http-all-headers test |
1 change: 1 addition & 0 deletions
1
tests/threshold/threshold-config-threshold-both-flow/input.rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
alert tcp any any -> any any (dsize:0; sid: 1000001;) |
15 changes: 15 additions & 0 deletions
15
tests/threshold/threshold-config-threshold-both-flow/suricata.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
%YAML 1.1 | ||
--- | ||
|
||
outputs: | ||
- eve-log: | ||
enabled: yes | ||
filetype: regular | ||
filename: eve.json | ||
types: | ||
- alert | ||
- drop: | ||
flows: all | ||
alerts: true | ||
- http | ||
- anomaly |
19 changes: 19 additions & 0 deletions
19
tests/threshold/threshold-config-threshold-both-flow/test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
pcap: ../../http-all-headers/input.pcap | ||
|
||
requires: | ||
min-version: 8 | ||
|
||
args: | ||
- --set threshold-file=${TEST_DIR}/threshold.config | ||
- --simulate-ips | ||
|
||
checks: | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: alert | ||
alert.signature_id: 1000001 | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: http |
1 change: 1 addition & 0 deletions
1
tests/threshold/threshold-config-threshold-both-flow/threshold.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
threshold gen_id 1, sig_id 1000001, type both, track by_flow, count 5, seconds 60 |
5 changes: 5 additions & 0 deletions
5
tests/threshold/threshold-config-threshold-limit-flow/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Threshold.config with by_flow | ||
|
||
This test checks threshold.config file using by_flow keyword | ||
|
||
The pcap file is from http-all-headers test |
1 change: 1 addition & 0 deletions
1
tests/threshold/threshold-config-threshold-limit-flow/input.rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
alert tcp any any -> any any (dsize:0; sid: 1000001;) |
15 changes: 15 additions & 0 deletions
15
tests/threshold/threshold-config-threshold-limit-flow/suricata.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
%YAML 1.1 | ||
--- | ||
|
||
outputs: | ||
- eve-log: | ||
enabled: yes | ||
filetype: regular | ||
filename: eve.json | ||
types: | ||
- alert | ||
- drop: | ||
flows: all | ||
alerts: true | ||
- http | ||
- anomaly |
19 changes: 19 additions & 0 deletions
19
tests/threshold/threshold-config-threshold-limit-flow/test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
pcap: ../../http-all-headers/input.pcap | ||
|
||
requires: | ||
min-version: 8 | ||
|
||
args: | ||
- --set threshold-file=${TEST_DIR}/threshold.config | ||
- --simulate-ips | ||
|
||
checks: | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: alert | ||
alert.signature_id: 1000001 | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: http |
1 change: 1 addition & 0 deletions
1
tests/threshold/threshold-config-threshold-limit-flow/threshold.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
threshold gen_id 1, sig_id 1000001, type limit, track by_flow, count 1, seconds 60 |
5 changes: 5 additions & 0 deletions
5
tests/threshold/threshold-config-threshold-threshold-flow/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Threshold.config with by_flow | ||
|
||
This test checks threshold.config file using by_flow keyword | ||
|
||
The pcap file is from http-all-headers test |
1 change: 1 addition & 0 deletions
1
tests/threshold/threshold-config-threshold-threshold-flow/input.rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
alert tcp any any -> any any (dsize:0; sid: 1000001;) |
15 changes: 15 additions & 0 deletions
15
tests/threshold/threshold-config-threshold-threshold-flow/suricata.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
%YAML 1.1 | ||
--- | ||
|
||
outputs: | ||
- eve-log: | ||
enabled: yes | ||
filetype: regular | ||
filename: eve.json | ||
types: | ||
- alert | ||
- drop: | ||
flows: all | ||
alerts: true | ||
- http | ||
- anomaly |
19 changes: 19 additions & 0 deletions
19
tests/threshold/threshold-config-threshold-threshold-flow/test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
pcap: ../../http-all-headers/input.pcap | ||
|
||
requires: | ||
min-version: 8 | ||
|
||
args: | ||
- --set threshold-file=${TEST_DIR}/threshold.config | ||
- --simulate-ips | ||
|
||
checks: | ||
- filter: | ||
count: 3 | ||
match: | ||
event_type: alert | ||
alert.signature_id: 1000001 | ||
- filter: | ||
count: 1 | ||
match: | ||
event_type: http |
1 change: 1 addition & 0 deletions
1
tests/threshold/threshold-config-threshold-threshold-flow/threshold.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
threshold gen_id 1, sig_id 1000001, type threshold, track by_flow, count 5, seconds 60 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Again confused a bit, why should a drop rule be allowed to change action?
Related to #1893 (review), perhaps for later discussion, what a terminating action for packet should be.
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 don't know of a good use case for it, but I think the rate_filter does support it. It's coming from the Snort language, so not sure if this case was considered at the time.