]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
tls: add test for tls.subject keyword
authorHaleema Khan <hsadia538@gmail.com>
Tue, 24 Jan 2023 19:50:09 +0000 (00:50 +0500)
committerShivani Bhardwaj <shivanib134@gmail.com>
Wed, 22 Mar 2023 06:28:15 +0000 (11:58 +0530)
Adds tests for `tls.subject` legacy keyword and `tls.cert_subject` new keyword.
Ticket #5544

tests/tls/tls-subject/README [new file with mode: 0644]
tests/tls/tls-subject/test.yaml [new file with mode: 0644]
tests/tls/tls-subject/tls.rules [new file with mode: 0644]

diff --git a/tests/tls/tls-subject/README b/tests/tls/tls-subject/README
new file mode 100644 (file)
index 0000000..7708219
--- /dev/null
@@ -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 (file)
index 0000000..e865dfa
--- /dev/null
@@ -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 (file)
index 0000000..cbb227c
--- /dev/null
@@ -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