From: Mats Klepsland Date: Wed, 15 May 2019 12:57:09 +0000 (+0200) Subject: tests/tls: add testcases for tls.certs keyword X-Git-Tag: suricata-6.0.4~454 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F60%2Fhead;p=thirdparty%2Fsuricata-verify.git tests/tls: add testcases for tls.certs keyword --- diff --git a/tests/tls-certs-alert/input.pcap b/tests/tls-certs-alert/input.pcap new file mode 100644 index 000000000..f50866f1e Binary files /dev/null and b/tests/tls-certs-alert/input.pcap differ diff --git a/tests/tls-certs-alert/suricata.yaml b/tests/tls-certs-alert/suricata.yaml new file mode 100644 index 000000000..0211a9fc1 --- /dev/null +++ b/tests/tls-certs-alert/suricata.yaml @@ -0,0 +1,16 @@ +%YAML 1.1 +--- + +outputs: + - eve-log: + enabled: yes + filetype: regular #regular|syslog|unix_dgram|unix_stream|redis + filename: eve.json + types: + - alert: + payload: no + payload-buffer-size: 4kb + payload-printable: no + packet: no + metadata: no + - tls diff --git a/tests/tls-certs-alert/test.rules b/tests/tls-certs-alert/test.rules new file mode 100644 index 000000000..98913adc9 --- /dev/null +++ b/tests/tls-certs-alert/test.rules @@ -0,0 +1,3 @@ +alert tls any any -> any any (msg:"Match first certificate"; flow:established,to_client; tls.certs; content:"|30160603550403130f|"; sid:1;) +alert tls any any -> any any (msg:"Match second certificate"; flow:established,to_client; tls.certs; content:"|30250603550403131e|"; sid:2;) +alert tls any any -> any any (msg:"Match third certificate"; flow:established,to_client; tls.certs; content:"|301e06035504031317|"; sid:3;) diff --git a/tests/tls-certs-alert/test.yaml b/tests/tls-certs-alert/test.yaml new file mode 100644 index 000000000..c97d62b40 --- /dev/null +++ b/tests/tls-certs-alert/test.yaml @@ -0,0 +1,28 @@ +requires: + min-version: 5.0.0 + features: + - HAVE_LIBJANSSON + +args: + - -k none + +checks: + # Check that we can alert on all three certs in the certificate chain + - filter: + count: 1 + match: + event_type: alert + app_proto: tls + alert.signature_id: 1 + - filter: + count: 1 + match: + event_type: alert + app_proto: tls + alert.signature_id: 2 + - filter: + count: 1 + match: + event_type: alert + app_proto: tls + alert.signature_id: 3