-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
multi-tenant: Basic multi-tenant selector tests
This commit adds basic tests for vlan-selector configurations (including vlan-inner, added in 6237) Issue: 6237
- Loading branch information
Showing
15 changed files
with
264 additions
and
0 deletions.
There are no files selected for viewing
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,4 @@ | ||
%YAML 1.1 | ||
--- | ||
|
||
include: tenant.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,52 @@ | ||
%YAML 1.1 | ||
--- | ||
|
||
# Suricata configuration file. In addition to the comments describing all | ||
# options in this file, full documentation can be found at: | ||
# https://suricata.readthedocs.io/en/latest/configuration/suricata-yaml.html | ||
|
||
## | ||
## Step 1: Inform Suricata about your network | ||
## | ||
|
||
vars: | ||
# more specific is better for alert accuracy and performance | ||
address-groups: | ||
HOME_NET: "[192.168.0.0/16,10.0.0.0/8,172.16.0.0/12]" | ||
#HOME_NET: "[192.168.0.0/16]" | ||
#HOME_NET: "[10.0.0.0/8]" | ||
#HOME_NET: "[172.16.0.0/12]" | ||
#HOME_NET: "any" | ||
|
||
EXTERNAL_NET: "!$HOME_NET" | ||
#EXTERNAL_NET: "any" | ||
|
||
HTTP_SERVERS: "$HOME_NET" | ||
SMTP_SERVERS: "$HOME_NET" | ||
SQL_SERVERS: "$HOME_NET" | ||
DNS_SERVERS: "$HOME_NET" | ||
TELNET_SERVERS: "$HOME_NET" | ||
AIM_SERVERS: "$EXTERNAL_NET" | ||
DC_SERVERS: "$HOME_NET" | ||
DNP3_SERVER: "$HOME_NET" | ||
DNP3_CLIENT: "$HOME_NET" | ||
MODBUS_CLIENT: "$HOME_NET" | ||
MODBUS_SERVER: "$HOME_NET" | ||
ENIP_CLIENT: "$HOME_NET" | ||
ENIP_SERVER: "$HOME_NET" | ||
|
||
port-groups: | ||
HTTP_PORTS: "80" | ||
SHELLCODE_PORTS: "!80" | ||
ORACLE_PORTS: 1521 | ||
SSH_PORTS: 22 | ||
DNP3_PORTS: 20000 | ||
MODBUS_PORTS: 502 | ||
FILE_DATA_PORTS: "[$HTTP_PORTS,110,143]" | ||
FTP_PORTS: 21 | ||
GENEVE_PORTS: 6081 | ||
VXLAN_PORTS: 4789 | ||
TEREDO_PORTS: 3544 | ||
|
||
rule-files: | ||
- tenant.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,10 @@ | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 1"; byte_extract:2,0,two1,string,dec; content:"|33 34|"; offset:0; depth:two1; sid:1; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 2"; byte_extract:1,2,two2,string,dec; content:"|33 34|"; offset:8; depth:two2; sid:2; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 3"; byte_extract:1,2,two3,string,dec; byte_extract:1,5,eight,string,dec; content:"|33 34|"; offset:eight; depth:two3; sid:3; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 4"; byte_extract:1,3,sixd1,string,dec; content:"|31 30|"; content:"|33 34|"; distance:sixd1; sid:4; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 5"; byte_extract:1,2,twow,string,dec; byte_extract:1,3,sixd2,string,dec; content:"|31 30|"; content:"|33 34|"; distance:sixd2; within:twow; sid: 5; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 6"; content:"|31 30|"; byte_extract:1,6,three1,relative,string,dec; content:"|36 10|"; offset:three1; depth:2; sid:6; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 7"; byte_extract:1,2,dectwo1,string,dec; content:"|32|"; offset:dectwo1; depth:1; sid:7; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 8"; byte_extract:1,2,dectwo2,string,dec; content:"|32|"; offset:dectwo2; sid:8; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 9"; byte_extract:1,4,hexten; byte_extract:1,0,decone,string,dec; content:"|66|"; offset:hexten; depth:decone; sid:9; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 10"; byte_extract:1,4,two4; content:"|31|"; depth:1; content:"|2e|"; distance:two4; within:1; sid:10; rev:1;) |
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 | ||
--- | ||
|
||
multi-detect: | ||
enabled: on | ||
default: on | ||
selector: vlan-innner | ||
|
||
tenants: | ||
- id: 1 | ||
yaml: tenant-1.yaml | ||
|
||
mappings: | ||
- vlan-id: 1011 | ||
tenant-id: 1 |
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,7 @@ | ||
requires: | ||
min-version: 7 | ||
|
||
command: | | ||
${SRCDIR}/src/suricata -l ${OUTPUT_DIR} -c ${TEST_DIR}/suricata.yaml -T | ||
exit-code: 1 |
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,4 @@ | ||
%YAML 1.1 | ||
--- | ||
|
||
include: tenant.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,52 @@ | ||
%YAML 1.1 | ||
--- | ||
|
||
# Suricata configuration file. In addition to the comments describing all | ||
# options in this file, full documentation can be found at: | ||
# https://suricata.readthedocs.io/en/latest/configuration/suricata-yaml.html | ||
|
||
## | ||
## Step 1: Inform Suricata about your network | ||
## | ||
|
||
vars: | ||
# more specific is better for alert accuracy and performance | ||
address-groups: | ||
HOME_NET: "[192.168.0.0/16,10.0.0.0/8,172.16.0.0/12]" | ||
#HOME_NET: "[192.168.0.0/16]" | ||
#HOME_NET: "[10.0.0.0/8]" | ||
#HOME_NET: "[172.16.0.0/12]" | ||
#HOME_NET: "any" | ||
|
||
EXTERNAL_NET: "!$HOME_NET" | ||
#EXTERNAL_NET: "any" | ||
|
||
HTTP_SERVERS: "$HOME_NET" | ||
SMTP_SERVERS: "$HOME_NET" | ||
SQL_SERVERS: "$HOME_NET" | ||
DNS_SERVERS: "$HOME_NET" | ||
TELNET_SERVERS: "$HOME_NET" | ||
AIM_SERVERS: "$EXTERNAL_NET" | ||
DC_SERVERS: "$HOME_NET" | ||
DNP3_SERVER: "$HOME_NET" | ||
DNP3_CLIENT: "$HOME_NET" | ||
MODBUS_CLIENT: "$HOME_NET" | ||
MODBUS_SERVER: "$HOME_NET" | ||
ENIP_CLIENT: "$HOME_NET" | ||
ENIP_SERVER: "$HOME_NET" | ||
|
||
port-groups: | ||
HTTP_PORTS: "80" | ||
SHELLCODE_PORTS: "!80" | ||
ORACLE_PORTS: 1521 | ||
SSH_PORTS: 22 | ||
DNP3_PORTS: 20000 | ||
MODBUS_PORTS: 502 | ||
FILE_DATA_PORTS: "[$HTTP_PORTS,110,143]" | ||
FTP_PORTS: 21 | ||
GENEVE_PORTS: 6081 | ||
VXLAN_PORTS: 4789 | ||
TEREDO_PORTS: 3544 | ||
|
||
rule-files: | ||
- tenant.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,10 @@ | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 1"; byte_extract:2,0,two1,string,dec; content:"|33 34|"; offset:0; depth:two1; sid:1; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 2"; byte_extract:1,2,two2,string,dec; content:"|33 34|"; offset:8; depth:two2; sid:2; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 3"; byte_extract:1,2,two3,string,dec; byte_extract:1,5,eight,string,dec; content:"|33 34|"; offset:eight; depth:two3; sid:3; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 4"; byte_extract:1,3,sixd1,string,dec; content:"|31 30|"; content:"|33 34|"; distance:sixd1; sid:4; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 5"; byte_extract:1,2,twow,string,dec; byte_extract:1,3,sixd2,string,dec; content:"|31 30|"; content:"|33 34|"; distance:sixd2; within:twow; sid: 5; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 6"; content:"|31 30|"; byte_extract:1,6,three1,relative,string,dec; content:"|36 10|"; offset:three1; depth:2; sid:6; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 7"; byte_extract:1,2,dectwo1,string,dec; content:"|32|"; offset:dectwo1; depth:1; sid:7; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 8"; byte_extract:1,2,dectwo2,string,dec; content:"|32|"; offset:dectwo2; sid:8; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 9"; byte_extract:1,4,hexten; byte_extract:1,0,decone,string,dec; content:"|66|"; offset:hexten; depth:decone; sid:9; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 10"; byte_extract:1,4,two4; content:"|31|"; depth:1; content:"|2e|"; distance:two4; within:1; sid:10; rev:1;) |
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 | ||
--- | ||
|
||
multi-detect: | ||
enabled: on | ||
default: on | ||
selector: vlan-inner | ||
|
||
tenants: | ||
- id: 1 | ||
yaml: tenant-1.yaml | ||
|
||
mappings: | ||
- vlan-id: 1011 | ||
tenant-id: 1 |
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,7 @@ | ||
requires: | ||
min-version: 7 | ||
|
||
command: | | ||
${SRCDIR}/src/suricata -l ${OUTPUT_DIR} -c ${TEST_DIR}/suricata.yaml -T | ||
exit-code: 0 |
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,4 @@ | ||
%YAML 1.1 | ||
--- | ||
|
||
include: tenant.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,52 @@ | ||
%YAML 1.1 | ||
--- | ||
|
||
# Suricata configuration file. In addition to the comments describing all | ||
# options in this file, full documentation can be found at: | ||
# https://suricata.readthedocs.io/en/latest/configuration/suricata-yaml.html | ||
|
||
## | ||
## Step 1: Inform Suricata about your network | ||
## | ||
|
||
vars: | ||
# more specific is better for alert accuracy and performance | ||
address-groups: | ||
HOME_NET: "[192.168.0.0/16,10.0.0.0/8,172.16.0.0/12]" | ||
#HOME_NET: "[192.168.0.0/16]" | ||
#HOME_NET: "[10.0.0.0/8]" | ||
#HOME_NET: "[172.16.0.0/12]" | ||
#HOME_NET: "any" | ||
|
||
EXTERNAL_NET: "!$HOME_NET" | ||
#EXTERNAL_NET: "any" | ||
|
||
HTTP_SERVERS: "$HOME_NET" | ||
SMTP_SERVERS: "$HOME_NET" | ||
SQL_SERVERS: "$HOME_NET" | ||
DNS_SERVERS: "$HOME_NET" | ||
TELNET_SERVERS: "$HOME_NET" | ||
AIM_SERVERS: "$EXTERNAL_NET" | ||
DC_SERVERS: "$HOME_NET" | ||
DNP3_SERVER: "$HOME_NET" | ||
DNP3_CLIENT: "$HOME_NET" | ||
MODBUS_CLIENT: "$HOME_NET" | ||
MODBUS_SERVER: "$HOME_NET" | ||
ENIP_CLIENT: "$HOME_NET" | ||
ENIP_SERVER: "$HOME_NET" | ||
|
||
port-groups: | ||
HTTP_PORTS: "80" | ||
SHELLCODE_PORTS: "!80" | ||
ORACLE_PORTS: 1521 | ||
SSH_PORTS: 22 | ||
DNP3_PORTS: 20000 | ||
MODBUS_PORTS: 502 | ||
FILE_DATA_PORTS: "[$HTTP_PORTS,110,143]" | ||
FTP_PORTS: 21 | ||
GENEVE_PORTS: 6081 | ||
VXLAN_PORTS: 4789 | ||
TEREDO_PORTS: 3544 | ||
|
||
rule-files: | ||
- tenant.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,10 @@ | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 1"; byte_extract:2,0,two1,string,dec; content:"|33 34|"; offset:0; depth:two1; sid:1; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 2"; byte_extract:1,2,two2,string,dec; content:"|33 34|"; offset:8; depth:two2; sid:2; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 3"; byte_extract:1,2,two3,string,dec; byte_extract:1,5,eight,string,dec; content:"|33 34|"; offset:eight; depth:two3; sid:3; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 4"; byte_extract:1,3,sixd1,string,dec; content:"|31 30|"; content:"|33 34|"; distance:sixd1; sid:4; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 5"; byte_extract:1,2,twow,string,dec; byte_extract:1,3,sixd2,string,dec; content:"|31 30|"; content:"|33 34|"; distance:sixd2; within:twow; sid: 5; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 6"; content:"|31 30|"; byte_extract:1,6,three1,relative,string,dec; content:"|36 10|"; offset:three1; depth:2; sid:6; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 7"; byte_extract:1,2,dectwo1,string,dec; content:"|32|"; offset:dectwo1; depth:1; sid:7; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 8"; byte_extract:1,2,dectwo2,string,dec; content:"|32|"; offset:dectwo2; sid:8; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 9"; byte_extract:1,4,hexten; byte_extract:1,0,decone,string,dec; content:"|66|"; offset:hexten; depth:decone; sid:9; rev:1;) | ||
alert tcp-pkt any any -> any any (msg:"byte extract test 10"; byte_extract:1,4,two4; content:"|31|"; depth:1; content:"|2e|"; distance:two4; within:1; sid:10; rev:1;) |
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 | ||
--- | ||
|
||
multi-detect: | ||
enabled: on | ||
default: on | ||
selector: vlan | ||
|
||
tenants: | ||
- id: 1 | ||
yaml: tenant-1.yaml | ||
|
||
mappings: | ||
- vlan-id: 1011 | ||
tenant-id: 1 |
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,7 @@ | ||
requires: | ||
min-version: 7 | ||
|
||
command: | | ||
${SRCDIR}/src/suricata -l ${OUTPUT_DIR} -c ${TEST_DIR}/suricata.yaml -T | ||
exit-code: 0 |