Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app-layer-ssl: Validity dates from TLS certificates (v17) #2280

Closed
wants to merge 12 commits into from

Conversation

thus
Copy link
Contributor

@thus thus commented Sep 25, 2016

Get validity dates (notBefore and notAfter) from TLS certificates.

New detection keywords (tls_cert_notbefore and tls_cert_notafter), added validity dates to extended JSON log and extended TLS log output, and new lua functions TlsGetCertNotBefore() and TlsGetCertNotAfter().

Updates:

  • Try to omit OpenBSD 5.4 bug that is causing trouble
  • Don't use strptime when timestamp is epoch, since OpenBSD and Cygwin strptime don't support %s.

This PR fixes the following issue:

Prscript:

Decode ASN.1 element type GeneralizedTime in DER-encoded
structures.
Add function SCMkTimeUtc to convert broken-down time to Unix epoch in UTC.
Parsing of certificate validity dates to get notBefore and notAfter
fields.
Add function SCStringPatternToTime to parse a date string based on an
array of pattern strings.
Detection plugin for TLS certificate fields notBefore and notAfter.

Supports equal to, less than, greater than, and range operations
for both keywords. Dates can be represented as either ISO 8601 or
epoch (Unix time).

Examples:
alert tls [...] tls_cert_notafter:1445852105; [...]
alert tls [...] tls_cert_notbefore:<2015-10-22T23:59:59; [...]
alert tls [...] tls_cert_notbefore:>2015-10-22; [...]
alert tls [...] tls_cert_notafter:2000-10-22<>2020-05-15; [...]
Add function CreateUtcIsoTimeString to create a UTC time string.
Add notBefore and notAfter fields from TLS certificate to extended JSON
output.
Add notBefore and NotAfter fields from TLS certificate to extended tls
log output.
Add functions TlsGetCertNotBefore and TLSGetCertNotAfter to get notBefore
and notAfter fields from TLS certificate in lua scripts.
Move DetectEngineInspectGenericList from detect-engine-dns.c to
detect-engine.c to enable it to be used other places as well.
Add detect engine for tls validity keywords (tls_cert_notbefore and
tls_cert_notafter).
@inliniac
Copy link
Contributor

Merged through #2284, thanks Mats! Thanks for your patience with the portable time handling :)

@inliniac inliniac closed this Sep 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants