Skip to content
Open
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
Binary file added tests/geoip-enrichment-disabled/input.pcap
Binary file not shown.
14 changes: 14 additions & 0 deletions tests/geoip-enrichment-disabled/suricata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
%YAML 1.1
---

geoip-database: test.mmdb

outputs:
- eve-log:
enabled: yes
filetype: regular
filename: eve.json
geoip-enrichment: no
types:
- alert
- flow
Binary file added tests/geoip-enrichment-disabled/test.mmdb
Binary file not shown.
1 change: 1 addition & 0 deletions tests/geoip-enrichment-disabled/test.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert tcp any any -> 82.165.177.154 any (msg:"Test GeoIP enrichment disabled"; flow:established,to_server; sid:1; rev:1;)
34 changes: 34 additions & 0 deletions tests/geoip-enrichment-disabled/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
requires:
features:
- GeoIP2

pcap: input.pcap

checks:
# Verify NO alerts have geoip_dst when enrichment is disabled
- filter:
count: 0
match:
event_type: alert
has-key: geoip_dst
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use not-has-key, instead.


# Verify NO alerts have geoip_src when enrichment is disabled
- filter:
count: 0
match:
event_type: alert
has-key: geoip_src

# Verify NO flows have geoip_dst when enrichment is disabled
- filter:
count: 0
match:
event_type: flow
has-key: geoip_dst

# Verify NO flows have geoip_src when enrichment is disabled
- filter:
count: 0
match:
event_type: flow
has-key: geoip_src
Binary file added tests/geoip-enrichment/input.pcap
Binary file not shown.
14 changes: 14 additions & 0 deletions tests/geoip-enrichment/suricata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
%YAML 1.1
---

geoip-database: test.mmdb

outputs:
- eve-log:
enabled: yes
filetype: regular
filename: eve.json
geoip-enrichment: yes
types:
- alert
- flow
Binary file added tests/geoip-enrichment/test.mmdb
Binary file not shown.
1 change: 1 addition & 0 deletions tests/geoip-enrichment/test.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert tcp any any -> 82.165.177.154 any (msg:"Test GeoIP enrichment to Germany"; flow:established,to_server; sid:1; rev:1;)
25 changes: 25 additions & 0 deletions tests/geoip-enrichment/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
requires:
features:
- GeoIP2

pcap: input.pcap

checks:
# Check alert has geoip_dst with correct structure
- filter:
count: 1
match:
event_type: alert
alert.signature_id: 1
has-key: geoip_dst
has-key: geoip_dst.ip
has-key: geoip_dst.geo.country_iso_code
geoip_dst.geo.country_iso_code: DE

# Check flow has geoip_dst enrichment
- filter:
count: 1
match:
event_type: flow
has-key: geoip_dst
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: since we have the check below, this has-key isn't needed

Copy link
Contributor

Choose a reason for hiding this comment

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

(same for the previous check)

geoip_dst.geo.country_iso_code: DE