Skip to content

Commit

Permalink
tests: showcase verdict & no action field in test
Browse files Browse the repository at this point in the history
With the addition of the 'verdict' field, have at least one test that
illustrates this, and adjust tests that were affected by that change.

Bug #5464
  • Loading branch information
jufajardini committed Jul 6, 2023
1 parent 0a8596b commit 8c7ced8
Show file tree
Hide file tree
Showing 9 changed files with 156 additions and 2 deletions.
6 changes: 5 additions & 1 deletion tests/bug-4394-pdonly-drop/suricata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ outputs:
filetype: regular #regular|syslog|unix_dgram|unix_stream|redis
filename: eve.json
types:
- alert
- alert:
verdict: yes
- drop:
flows: all
alerts: true
verdict: yes
- http
- anomaly
- verdict

77 changes: 77 additions & 0 deletions tests/bug-4394-pdonly-drop/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,109 @@ args:

checks:
- filter:
lt-version: 7
count: 1
match:
event_type: alert
alert.action: blocked
alert.signature_id: 1
pcap_cnt: 4
- filter:
lt-version: 7
count: 1
match:
event_type: alert
alert.action: blocked
alert.signature_id: 2
pcap_cnt: 4
- filter:
min-version: 7
count: 1
match:
event_type: alert
alert.signature_id: 1
pcap_cnt: 4
verdict.action: drop
- filter:
min-version: 7
count: 1
match:
event_type: alert
alert.signature_id: 2
pcap_cnt: 4
verdict.action: drop
- filter:
min-version: 7
count: 1
match:
event_type: drop
pcap_cnt: 4
verdict.action: drop
- filter:
min-version: 7
count: 1
match:
event_type: drop
pcap_cnt: 5
verdict.action: drop
- filter:
min-version: 7
count: 1
match:
event_type: drop
pcap_cnt: 6
verdict.action: drop
- filter:
min-version: 7
count: 1
match:
event_type: drop
pcap_cnt: 7
verdict.action: drop
- filter:
min-version: 7
count: 1
match:
event_type: drop
pcap_cnt: 8
verdict.action: drop
- filter:
min-version: 7
count: 1
match:
event_type: drop
pcap_cnt: 9
verdict.action: drop
- filter:
min-version: 7
count: 1
match:
event_type: drop
pcap_cnt: 10
verdict.action: drop
- filter:
min-version: 7
count: 0
match:
event_type: alert
alert.signature_id: 3
verdict.action: alert

- filter:
lt-version: 7
count: 1
match:
event_type: drop
alert.action: blocked
alert.signature_id: 1
pcap_cnt: 4
- filter:
lt-version: 7
count: 1
match:
event_type: drop
alert.signature_id: 1
pcap_cnt: 4
- filter:
count: 1
match:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ outputs:
flows: all # start or all: 'start' logs only a single drop
# per flow direction. All logs each dropped pkt.
- flow
- anomaly
4 changes: 3 additions & 1 deletion tests/stream-depth-reached-event/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ requires:
min-version: 7

args:
- --set stream.reassembly.depth=50 --set outputs.1.eve-log.types.2.anomaly.types.stream=yes
# 'outputs' command-line option might need to be adjusted if a new output type
# is added to eve log.
- --set stream.reassembly.depth=50 --set outputs.1.eve-log.types.3.anomaly.types.stream=yes

checks:
- filter:
Expand Down
13 changes: 13 additions & 0 deletions tests/verdict-reject-ids/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Test and Showcase the Verdict Field in IDS mode

In IDS mode, the verdict field only makes sense with the `reject`
rule action.

# Behavior

As with the `rate_filter` the rule action will change from `alert` to
`reject`, we shall see alerts starting without, then with the `verdict` field.

# Pcap

Comes from the test `threshold-config-rate-filter-reject-hostdst`.
1 change: 1 addition & 0 deletions tests/verdict-reject-ids/input.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert http any any -> any any (sid: 1000001;)
18 changes: 18 additions & 0 deletions tests/verdict-reject-ids/suricata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
%YAML 1.1
---

outputs:
- eve-log:
enabled: yes
filetype: regular
filename: eve.json
types:
- alert:
verdict: yes
- drop:
flows: all
alerts: true
verdict: yes
- http
- anomaly
- verdict
37 changes: 37 additions & 0 deletions tests/verdict-reject-ids/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
requires:
min-version: 7

pcap: ../threshold/threshold-config-rate-filter-reject-hostdst/input.pcap

args:
- --set threshold-file=${TEST_DIR}/threshold.config

checks:
- filter:
count: 1
match:
event_type: alert
alert.signature_id: 1000001
alert.action: allowed
verdict.action: alert
- filter:
count: 1
match:
event_type: alert
alert.signature_id: 1000001
alert.action: blocked
verdict.action: alert
verdict.reject-target: source
- filter:
count: 1
match:
pcap_cnt: 5
event_type: verdict
verdict.action: alert
- filter:
count: 1
match:
pcap_cnt: 6
event_type: verdict
verdict.action: alert
verdict.reject-target: source
1 change: 1 addition & 0 deletions tests/verdict-reject-ids/threshold.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rate_filter gen_id 1, sig_id 1000001, track by_dst, count 1, seconds 60, new_action reject, timeout 1000

0 comments on commit 8c7ced8

Please sign in to comment.