From: Haleema Khan Date: Tue, 24 Jan 2023 19:50:09 +0000 (+0500) Subject: tls: add test for tls.subject keyword X-Git-Tag: suricata-6.0.12~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf95a4266099d241258583bff70d5c2be60c7239;p=thirdparty%2Fsuricata-verify.git tls: add test for tls.subject keyword Adds tests for `tls.subject` legacy keyword and `tls.cert_subject` new keyword. Ticket #5544 --- diff --git a/tests/tls/tls-subject/README b/tests/tls/tls-subject/README new file mode 100644 index 000000000..770821944 --- /dev/null +++ b/tests/tls/tls-subject/README @@ -0,0 +1,13 @@ +Description +=========== +Tests the `tls.subject` legacy keyword. +Tests the `tls.cert_subject` new keyword. +Both represent TLS/SSL certificate Subject field. + +PCAP +==== +PCAP comes from an [existing TLS test](https://github.com/OISF/suricata-verify/blob/master/tests/tls/tls-cert-issuer/tls.pcap) + +Redmine ticket +============== +https://redmine.openinfosecfoundation.org/issues/5544 diff --git a/tests/tls/tls-subject/test.yaml b/tests/tls/tls-subject/test.yaml new file mode 100644 index 000000000..e865dfac4 --- /dev/null +++ b/tests/tls/tls-subject/test.yaml @@ -0,0 +1,20 @@ +pcap: ../tls-cert-issuer/tls.pcap + +checks: + - filter: + count: 4 + match: + event_type: tls + tls.subject: C=FR, ST=IDF, L=Paris, O=Stamus, CN=SELKS + + - filter: + count: 4 + match: + event_type: alert + alert.signature_id: 1 + + - filter: + count: 4 + match: + event_type: alert + alert.signature_id: 2 \ No newline at end of file diff --git a/tests/tls/tls-subject/tls.rules b/tests/tls/tls-subject/tls.rules new file mode 100644 index 000000000..cbb227c09 --- /dev/null +++ b/tests/tls/tls-subject/tls.rules @@ -0,0 +1,5 @@ +# tests tls legacy keyword tls.subject +alert tls any any -> any any (msg:"TLS subject keyword"; tls.subject:"C=FR, ST=IDF, L=Paris, O=Stamus, CN=SELKS"; sid:1; rev:1;) + +# tests tls new keyword tls.cert_subject +alert tls any any -> any any (msg:"TLS cert_subject keyword"; tls.cert_subject; content:"C=FR, ST=IDF, L=Paris, O=Stamus, CN=SELKS"; sid:2; rev:1;) \ No newline at end of file