From ad38f1e8e6b26a0ef9081ce62051e17d24c1f15c Mon Sep 17 00:00:00 2001 From: jason taylor Date: Mon, 20 May 2019 21:32:55 -0400 Subject: [PATCH] tests: add invalid relative negate fast_pattern Signed-off-by: jason taylor --- .../suricata.yaml | 10 ++++++++ .../test.rules | 1 + .../test.yaml | 23 +++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 tests/test-bad-negate-fast-pattern-rule-1/suricata.yaml create mode 100644 tests/test-bad-negate-fast-pattern-rule-1/test.rules create mode 100644 tests/test-bad-negate-fast-pattern-rule-1/test.yaml diff --git a/tests/test-bad-negate-fast-pattern-rule-1/suricata.yaml b/tests/test-bad-negate-fast-pattern-rule-1/suricata.yaml new file mode 100644 index 000000000..dcaae57fe --- /dev/null +++ b/tests/test-bad-negate-fast-pattern-rule-1/suricata.yaml @@ -0,0 +1,10 @@ +%YAML 1.1 +--- + +logging: + default-log-level: info + outputs: + - file: + enabled: yes + filename: eve.json + type: json diff --git a/tests/test-bad-negate-fast-pattern-rule-1/test.rules b/tests/test-bad-negate-fast-pattern-rule-1/test.rules new file mode 100644 index 000000000..ebb3b7523 --- /dev/null +++ b/tests/test-bad-negate-fast-pattern-rule-1/test.rules @@ -0,0 +1 @@ +alert tcp any any -> any any (msg:"bad relative negated keyword with fast_pattern"; content:"first"; content:!"second"; fast_pattern; offset:6; sid:5542341; rev:1;) diff --git a/tests/test-bad-negate-fast-pattern-rule-1/test.yaml b/tests/test-bad-negate-fast-pattern-rule-1/test.yaml new file mode 100644 index 000000000..26fa28b3a --- /dev/null +++ b/tests/test-bad-negate-fast-pattern-rule-1/test.yaml @@ -0,0 +1,23 @@ +requires: + min-version: 5.0.0 + + features: + - HAVE_LIBJANSSON + +command: | + ${SRCDIR}/src/suricata --set classification-file="${SRCDIR}/classification.config" --set reference-config-file="${SRCDIR}/reference.config" -l ${OUTPUT_DIR} -c ${TEST_DIR}/suricata.yaml -r ${TEST_DIR}/ -S ${TEST_DIR}/test.rules + +checks: + # check that we have the following entres in eve.json + # match 1 specific rule load failure reason + - filter: + count: 1 + match: + event_type: engine + engine.message: "can't have a relative negated keyword set along with 'fast_pattern'." + + - filter: + count: 1 + match: + event_type: engine + engine.error: "SC_ERR_NO_RULES_LOADED" -- 2.47.2