Skip to content

Commit

Permalink
tests: add multi-tenancy tests
Browse files Browse the repository at this point in the history
  • Loading branch information
victorjulien committed Nov 18, 2023
1 parent 25d1b08 commit 6637295
Show file tree
Hide file tree
Showing 33 changed files with 220 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/multi-tenant-01/a.rule
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert http any any -> any any (flowbits:set,a; http.method; content:"GET"; sid:1;)
5 changes: 5 additions & 0 deletions tests/multi-tenant-01/a.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
%YAML 1.1
---

rule-files:
- a.rule
1 change: 1 addition & 0 deletions tests/multi-tenant-01/b.rule
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert http any any -> any any (flowbits:set,a; http.method; content:"POST"; sid:2;)
5 changes: 5 additions & 0 deletions tests/multi-tenant-01/b.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
%YAML 1.1
---

rule-files:
- b.rule
Empty file.
1 change: 1 addition & 0 deletions tests/multi-tenant-01/c.rule
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert http any any -> any any (flowbits:set,c; http.method; content:"POST"; sid:3;)
5 changes: 5 additions & 0 deletions tests/multi-tenant-01/c.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
%YAML 1.1
---

rule-files:
- c.rule
1 change: 1 addition & 0 deletions tests/multi-tenant-01/d.rule
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert http any any -> any any (flowbits:set,d; http.method; content:"POST"; sid:4;)
5 changes: 5 additions & 0 deletions tests/multi-tenant-01/d.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
%YAML 1.1
---

rule-files:
- d.rule
39 changes: 39 additions & 0 deletions tests/multi-tenant-01/suricata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
%YAML 1.1
---

multi-detect:
enabled: yes
selector: vlan
loaders: 4

tenants:
- tenant:
id: 1
yaml: a.yaml
- tenant:
id: 2
yaml: b.yaml
- tenant:
id: 3
yaml: c.yaml
- tenant:
id: 4
yaml: d.yaml

mappings:
- vlan:
vlan-id: 1000
tenant-id: 1
- vlan:
vlan-id: 2000
tenant-id: 2
- vlan:
vlan-id: 1112
tenant-id: 3
- vlan:
vlan-id: 1111
tenant-id: 4

engine-analysis:
rules-fast-pattern: yes
rules: yes
11 changes: 11 additions & 0 deletions tests/multi-tenant-01/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
requires:
pcap: false

args:
- --set multi-detect.config-path=${TEST_DIR}
- --set multi-detect.1.default-rule-path=${TEST_DIR}
- --set multi-detect.2.default-rule-path=${TEST_DIR}
- --set multi-detect.3.default-rule-path=${TEST_DIR}
- --set multi-detect.4.default-rule-path=${TEST_DIR}
- --engine-analysis
- -vv
1 change: 1 addition & 0 deletions tests/multi-tenant-02-test/a.rule
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert http any any -> any any (flowbits:set,a; http.method; content:"GET"; sid:1;)
5 changes: 5 additions & 0 deletions tests/multi-tenant-02-test/a.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
%YAML 1.1
---

rule-files:
- a.rule
1 change: 1 addition & 0 deletions tests/multi-tenant-02-test/b.rule
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert http any any -> any any (flowbits:set,a; http.method; content:"POST"; sid:2;)
5 changes: 5 additions & 0 deletions tests/multi-tenant-02-test/b.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
%YAML 1.1
---

rule-files:
- b.rule
Empty file.
1 change: 1 addition & 0 deletions tests/multi-tenant-02-test/c.rule
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert http any any -> any any (flowbits:set,c; http.method; content:"POST"; sid:3;)
5 changes: 5 additions & 0 deletions tests/multi-tenant-02-test/c.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
%YAML 1.1
---

rule-files:
- c.rule
1 change: 1 addition & 0 deletions tests/multi-tenant-02-test/d.rule
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert http any any -> any any (flowbits:set,d; http.method; content:"POST"; sid:4;)
5 changes: 5 additions & 0 deletions tests/multi-tenant-02-test/d.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
%YAML 1.1
---

rule-files:
- d.rule
39 changes: 39 additions & 0 deletions tests/multi-tenant-02-test/suricata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
%YAML 1.1
---

multi-detect:
enabled: yes
selector: vlan
loaders: 4

tenants:
- tenant:
id: 1
yaml: a.yaml
- tenant:
id: 2
yaml: b.yaml
- tenant:
id: 3
yaml: c.yaml
- tenant:
id: 4
yaml: d.yaml

mappings:
- vlan:
vlan-id: 1000
tenant-id: 1
- vlan:
vlan-id: 2000
tenant-id: 2
- vlan:
vlan-id: 1112
tenant-id: 3
- vlan:
vlan-id: 1111
tenant-id: 4

engine-analysis:
rules-fast-pattern: yes
rules: yes
11 changes: 11 additions & 0 deletions tests/multi-tenant-02-test/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
requires:
pcap: false

args:
- --set multi-detect.config-path=${TEST_DIR}
- --set multi-detect.1.default-rule-path=${TEST_DIR}
- --set multi-detect.2.default-rule-path=${TEST_DIR}
- --set multi-detect.3.default-rule-path=${TEST_DIR}
- --set multi-detect.4.default-rule-path=${TEST_DIR}
- -T
- -vv
1 change: 1 addition & 0 deletions tests/multi-tenant-03-pcap/a.rule
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert http any any -> any any (flowbits:set,a; http.method; content:"GET"; sid:1;)
5 changes: 5 additions & 0 deletions tests/multi-tenant-03-pcap/a.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
%YAML 1.1
---

rule-files:
- a.rule
1 change: 1 addition & 0 deletions tests/multi-tenant-03-pcap/b.rule
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert http any any -> any any (flowbits:set,a; http.method; content:"POST"; sid:2;)
5 changes: 5 additions & 0 deletions tests/multi-tenant-03-pcap/b.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
%YAML 1.1
---

rule-files:
- b.rule
Empty file.
1 change: 1 addition & 0 deletions tests/multi-tenant-03-pcap/c.rule
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert http any any -> any any (flowbits:set,c; http.method; content:"POST"; sid:3;)
5 changes: 5 additions & 0 deletions tests/multi-tenant-03-pcap/c.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
%YAML 1.1
---

rule-files:
- c.rule
1 change: 1 addition & 0 deletions tests/multi-tenant-03-pcap/d.rule
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert http any any -> any any (flowbits:set,d; http.method; content:"POST"; sid:4;)
5 changes: 5 additions & 0 deletions tests/multi-tenant-03-pcap/d.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
%YAML 1.1
---

rule-files:
- d.rule
39 changes: 39 additions & 0 deletions tests/multi-tenant-03-pcap/suricata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
%YAML 1.1
---

multi-detect:
enabled: yes
selector: vlan
loaders: 4

tenants:
- tenant:
id: 1
yaml: a.yaml
- tenant:
id: 2
yaml: b.yaml
- tenant:
id: 3
yaml: c.yaml
- tenant:
id: 4
yaml: d.yaml

mappings:
- vlan:
vlan-id: 1000
tenant-id: 1
- vlan:
vlan-id: 2000
tenant-id: 2
- vlan:
vlan-id: 1112
tenant-id: 3
- vlan:
vlan-id: 1111
tenant-id: 4

engine-analysis:
rules-fast-pattern: yes
rules: yes
9 changes: 9 additions & 0 deletions tests/multi-tenant-03-pcap/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pcap: ../filestore-filecontainer-http/filecontainer-http.pcap

args:
- --set multi-detect.config-path=${TEST_DIR}
- --set multi-detect.1.default-rule-path=${TEST_DIR}
- --set multi-detect.2.default-rule-path=${TEST_DIR}
- --set multi-detect.3.default-rule-path=${TEST_DIR}
- --set multi-detect.4.default-rule-path=${TEST_DIR}
- -vv

0 comments on commit 6637295

Please sign in to comment.