From: Juliana Fajardini Date: Mon, 20 Mar 2023 17:14:30 +0000 (-0300) Subject: tests: add test for flow.memcap exception policy X-Git-Tag: suricata-6.0.13~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07491caabea838f280ac8a5bf24162a3ad821c97;p=thirdparty%2Fsuricata-verify.git tests: add test for flow.memcap exception policy --- diff --git a/tests/exception-policy-simulated-flow-memcap/README.md b/tests/exception-policy-simulated-flow-memcap/README.md new file mode 100644 index 000000000..b23c22a0f --- /dev/null +++ b/tests/exception-policy-simulated-flow-memcap/README.md @@ -0,0 +1,19 @@ +Test +==== + +Test both the exception policy for when Suricata reaches a flow memcap, and the +command-line option to simulate said memcap hit. + +Expected Behavior +================= + +When Suricata tries to create a new flow reaching packet 6, it will simulate a +failure, therefore dropping said packet. As midstream pickup is said to true, +Suri will later on register a midstream flow for that. Other packets/flows will +be decoded and inspected normally. + +PCAP +==== + +Pcap from `tls` suricata-verify test. + diff --git a/tests/exception-policy-simulated-flow-memcap/suricata.yaml b/tests/exception-policy-simulated-flow-memcap/suricata.yaml new file mode 100644 index 000000000..20dcc8e0c --- /dev/null +++ b/tests/exception-policy-simulated-flow-memcap/suricata.yaml @@ -0,0 +1,24 @@ +%YAML 1.1 +--- + +outputs: + - eve-log: + enabled: yes + types: + - alert: + tagged-packets: yes + - anomaly: + enabled: yes + types: + decode: no + stream: yes + applayer: yes + - tls: + extended: yes # enable this for extended logging information + - drop: + alerts: yes # log alerts that caused drops + flows: all # start or all: 'start' logs only a single drop + - flow + - stats + +exception-policy: ignore diff --git a/tests/exception-policy-simulated-flow-memcap/test.rules b/tests/exception-policy-simulated-flow-memcap/test.rules new file mode 100644 index 000000000..b9d1df2fb --- /dev/null +++ b/tests/exception-policy-simulated-flow-memcap/test.rules @@ -0,0 +1 @@ +alert tls any any -> any any (msg:"tls app-proto"; sid:1000001; rev:1;) diff --git a/tests/exception-policy-simulated-flow-memcap/test.yaml b/tests/exception-policy-simulated-flow-memcap/test.yaml new file mode 100644 index 000000000..11632c687 --- /dev/null +++ b/tests/exception-policy-simulated-flow-memcap/test.yaml @@ -0,0 +1,32 @@ +requires: + features: + - DEBUG + +pcap: ../tls/tls-cert-issuer/tls.pcap + +args: +- --simulate-ips +- -k none +- --set stream.midstream=true +- --simulate-packet-flow-memcap=6 +- --set flow.memcap-policy=drop-flow + +checks: + - filter: + count: 97 + match: + event_type: alert + - filter: + count: 1 + match: + event_type: drop + drop.reason: "flow memcap" + - filter: + count: 5 + match: + event_type: tls + - filter: + count: 1 + match: + event_type: stats + stats.tcp.midstream_pickups: 1