suricata
output-json-tls.c
Go to the documentation of this file.
1 /* Copyright (C) 2007-2021 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /**
19  * \file
20  *
21  * \author Tom DeCanio <td@npulsetech.com>
22  *
23  * Implements TLS JSON logging portion of the engine.
24  */
25 
26 #include "suricata-common.h"
27 #include "debug.h"
28 #include "detect.h"
29 #include "pkt-var.h"
30 #include "conf.h"
31 
32 #include "threads.h"
33 #include "threadvars.h"
34 #include "tm-threads.h"
35 
36 #include "util-print.h"
37 #include "util-unittest.h"
38 
39 #include "util-debug.h"
40 #include "app-layer-parser.h"
41 #include "output.h"
42 #include "app-layer-ssl.h"
43 #include "app-layer.h"
44 #include "util-privs.h"
45 #include "util-buffer.h"
46 
47 #include "util-logopenfile.h"
48 #include "util-crypt.h"
49 #include "util-ja3.h"
50 
51 #include "output-json.h"
52 #include "output-json-tls.h"
53 
54 SC_ATOMIC_EXTERN(unsigned int, cert_id);
55 
56 #define MODULE_NAME "LogTlsLog"
57 #define DEFAULT_LOG_FILENAME "tls.json"
58 
59 #define LOG_TLS_DEFAULT 0
60 #define LOG_TLS_EXTENDED (1 << 0)
61 #define LOG_TLS_CUSTOM (1 << 1)
62 #define LOG_TLS_SESSION_RESUMPTION (1 << 2)
63 
64 #define LOG_TLS_FIELD_VERSION (1 << 0)
65 #define LOG_TLS_FIELD_SUBJECT (1 << 1)
66 #define LOG_TLS_FIELD_ISSUER (1 << 2)
67 #define LOG_TLS_FIELD_SERIAL (1 << 3)
68 #define LOG_TLS_FIELD_FINGERPRINT (1 << 4)
69 #define LOG_TLS_FIELD_NOTBEFORE (1 << 5)
70 #define LOG_TLS_FIELD_NOTAFTER (1 << 6)
71 #define LOG_TLS_FIELD_SNI (1 << 7)
72 #define LOG_TLS_FIELD_CERTIFICATE (1 << 8)
73 #define LOG_TLS_FIELD_CHAIN (1 << 9)
74 #define LOG_TLS_FIELD_SESSION_RESUMED (1 << 10)
75 #define LOG_TLS_FIELD_JA3 (1 << 11)
76 #define LOG_TLS_FIELD_JA3S (1 << 12)
77 
78 typedef struct {
79  const char *name;
80  uint64_t flag;
81 } TlsFields;
82 
84  { "version", LOG_TLS_FIELD_VERSION },
85  { "subject", LOG_TLS_FIELD_SUBJECT },
86  { "issuer", LOG_TLS_FIELD_ISSUER },
87  { "serial", LOG_TLS_FIELD_SERIAL },
88  { "fingerprint", LOG_TLS_FIELD_FINGERPRINT },
89  { "not_before", LOG_TLS_FIELD_NOTBEFORE },
90  { "not_after", LOG_TLS_FIELD_NOTAFTER },
91  { "sni", LOG_TLS_FIELD_SNI },
92  { "certificate", LOG_TLS_FIELD_CERTIFICATE },
93  { "chain", LOG_TLS_FIELD_CHAIN },
94  { "session_resumed", LOG_TLS_FIELD_SESSION_RESUMED },
95  { "ja3", LOG_TLS_FIELD_JA3 },
96  { "ja3s", LOG_TLS_FIELD_JA3S },
97  { NULL, -1 }
98 };
99 
100 typedef struct OutputTlsCtx_ {
101  uint32_t flags; /** Store mode */
102  uint64_t fields; /** Store fields */
105 
106 
107 typedef struct JsonTlsLogThread_ {
111 
112 static void JsonTlsLogSubject(JsonBuilder *js, SSLState *ssl_state)
113 {
114  if (ssl_state->server_connp.cert0_subject) {
115  jb_set_string(js, "subject",
116  ssl_state->server_connp.cert0_subject);
117  }
118 }
119 
120 static void JsonTlsLogIssuer(JsonBuilder *js, SSLState *ssl_state)
121 {
122  if (ssl_state->server_connp.cert0_issuerdn) {
123  jb_set_string(js, "issuerdn",
124  ssl_state->server_connp.cert0_issuerdn);
125  }
126 }
127 
128 static void JsonTlsLogSessionResumed(JsonBuilder *js, SSLState *ssl_state)
129 {
130  if (ssl_state->flags & SSL_AL_FLAG_SESSION_RESUMED) {
131  /* Only log a session as 'resumed' if a certificate has not
132  been seen, and the session is not TLSv1.3 or later. */
133  if ((ssl_state->server_connp.cert0_issuerdn == NULL &&
134  ssl_state->server_connp.cert0_subject == NULL) &&
135  (ssl_state->flags & SSL_AL_FLAG_STATE_SERVER_HELLO) &&
136  ((ssl_state->flags & SSL_AL_FLAG_LOG_WITHOUT_CERT) == 0)) {
137  jb_set_bool(js, "session_resumed", true);
138  }
139  }
140 }
141 
142 static void JsonTlsLogFingerprint(JsonBuilder *js, SSLState *ssl_state)
143 {
144  if (ssl_state->server_connp.cert0_fingerprint) {
145  jb_set_string(js, "fingerprint",
146  ssl_state->server_connp.cert0_fingerprint);
147  }
148 }
149 
150 static void JsonTlsLogSni(JsonBuilder *js, SSLState *ssl_state)
151 {
152  if (ssl_state->client_connp.sni) {
153  jb_set_string(js, "sni",
154  ssl_state->client_connp.sni);
155  }
156 }
157 
158 static void JsonTlsLogSerial(JsonBuilder *js, SSLState *ssl_state)
159 {
160  if (ssl_state->server_connp.cert0_serial) {
161  jb_set_string(js, "serial",
162  ssl_state->server_connp.cert0_serial);
163  }
164 }
165 
166 static void JsonTlsLogVersion(JsonBuilder *js, SSLState *ssl_state)
167 {
168  char ssl_version[SSL_VERSION_MAX_STRLEN];
169  SSLVersionToString(ssl_state->server_connp.version, ssl_version);
170  jb_set_string(js, "version", ssl_version);
171 }
172 
173 static void JsonTlsLogNotBefore(JsonBuilder *js, SSLState *ssl_state)
174 {
175  if (ssl_state->server_connp.cert0_not_before != 0) {
176  char timebuf[64];
177  struct timeval tv;
178  tv.tv_sec = ssl_state->server_connp.cert0_not_before;
179  tv.tv_usec = 0;
180  CreateUtcIsoTimeString(&tv, timebuf, sizeof(timebuf));
181  jb_set_string(js, "notbefore", timebuf);
182  }
183 }
184 
185 static void JsonTlsLogNotAfter(JsonBuilder *js, SSLState *ssl_state)
186 {
187  if (ssl_state->server_connp.cert0_not_after != 0) {
188  char timebuf[64];
189  struct timeval tv;
190  tv.tv_sec = ssl_state->server_connp.cert0_not_after;
191  tv.tv_usec = 0;
192  CreateUtcIsoTimeString(&tv, timebuf, sizeof(timebuf));
193  jb_set_string(js, "notafter", timebuf);
194  }
195 }
196 
197 static void JsonTlsLogJa3Hash(JsonBuilder *js, SSLState *ssl_state)
198 {
199  if (ssl_state->client_connp.ja3_hash != NULL) {
200  jb_set_string(js, "hash",
201  ssl_state->client_connp.ja3_hash);
202  }
203 }
204 
205 static void JsonTlsLogJa3String(JsonBuilder *js, SSLState *ssl_state)
206 {
207  if ((ssl_state->client_connp.ja3_str != NULL) &&
208  ssl_state->client_connp.ja3_str->data != NULL) {
209  jb_set_string(js, "string",
210  ssl_state->client_connp.ja3_str->data);
211  }
212 }
213 
214 static void JsonTlsLogJa3(JsonBuilder *js, SSLState *ssl_state)
215 {
216  if ((ssl_state->client_connp.ja3_hash != NULL) ||
217  ((ssl_state->client_connp.ja3_str != NULL) &&
218  ssl_state->client_connp.ja3_str->data != NULL)) {
219  jb_open_object(js, "ja3");
220 
221  JsonTlsLogJa3Hash(js, ssl_state);
222  JsonTlsLogJa3String(js, ssl_state);
223 
224  jb_close(js);
225  }
226 }
227 
228 static void JsonTlsLogJa3SHash(JsonBuilder *js, SSLState *ssl_state)
229 {
230  if (ssl_state->server_connp.ja3_hash != NULL) {
231  jb_set_string(js, "hash",
232  ssl_state->server_connp.ja3_hash);
233  }
234 }
235 
236 static void JsonTlsLogJa3SString(JsonBuilder *js, SSLState *ssl_state)
237 {
238  if ((ssl_state->server_connp.ja3_str != NULL) &&
239  ssl_state->server_connp.ja3_str->data != NULL) {
240  jb_set_string(js, "string",
241  ssl_state->server_connp.ja3_str->data);
242  }
243 }
244 
245 static void JsonTlsLogJa3S(JsonBuilder *js, SSLState *ssl_state)
246 {
247  if ((ssl_state->server_connp.ja3_hash != NULL) ||
248  ((ssl_state->server_connp.ja3_str != NULL) &&
249  ssl_state->server_connp.ja3_str->data != NULL)) {
250  jb_open_object(js, "ja3s");
251 
252  JsonTlsLogJa3SHash(js, ssl_state);
253  JsonTlsLogJa3SString(js, ssl_state);
254 
255  jb_close(js);
256  }
257 }
258 
259 static void JsonTlsLogCertificate(JsonBuilder *js, SSLState *ssl_state)
260 {
261  if (TAILQ_EMPTY(&ssl_state->server_connp.certs)) {
262  return;
263  }
264 
265  SSLCertsChain *cert = TAILQ_FIRST(&ssl_state->server_connp.certs);
266  if (cert == NULL) {
267  return;
268  }
269 
270  unsigned long len = BASE64_BUFFER_SIZE(cert->cert_len);
271  uint8_t encoded[len];
272  if (Base64Encode(cert->cert_data, cert->cert_len, encoded, &len) ==
273  SC_BASE64_OK) {
274  jb_set_string(js, "certificate", (char *)encoded);
275  }
276 }
277 
278 static void JsonTlsLogChain(JsonBuilder *js, SSLState *ssl_state)
279 {
280  if (TAILQ_EMPTY(&ssl_state->server_connp.certs)) {
281  return;
282  }
283 
284  jb_open_array(js, "chain");
285 
286  SSLCertsChain *cert;
287  TAILQ_FOREACH(cert, &ssl_state->server_connp.certs, next) {
288  unsigned long len = BASE64_BUFFER_SIZE(cert->cert_len);
289  uint8_t encoded[len];
290  if (Base64Encode(cert->cert_data, cert->cert_len, encoded, &len) ==
291  SC_BASE64_OK) {
292  jb_append_string(js, (char *)encoded);
293  }
294  }
295 
296  jb_close(js);
297 }
298 
299 void JsonTlsLogJSONBasic(JsonBuilder *js, SSLState *ssl_state)
300 {
301  /* tls subject */
302  JsonTlsLogSubject(js, ssl_state);
303 
304  /* tls issuerdn */
305  JsonTlsLogIssuer(js, ssl_state);
306 
307  /* tls session resumption */
308  JsonTlsLogSessionResumed(js, ssl_state);
309 }
310 
311 static void JsonTlsLogJSONCustom(OutputTlsCtx *tls_ctx, JsonBuilder *js,
312  SSLState *ssl_state)
313 {
314  /* tls subject */
315  if (tls_ctx->fields & LOG_TLS_FIELD_SUBJECT)
316  JsonTlsLogSubject(js, ssl_state);
317 
318  /* tls issuerdn */
319  if (tls_ctx->fields & LOG_TLS_FIELD_ISSUER)
320  JsonTlsLogIssuer(js, ssl_state);
321 
322  /* tls session resumption */
323  if (tls_ctx->fields & LOG_TLS_FIELD_SESSION_RESUMED)
324  JsonTlsLogSessionResumed(js, ssl_state);
325 
326  /* tls serial */
327  if (tls_ctx->fields & LOG_TLS_FIELD_SERIAL)
328  JsonTlsLogSerial(js, ssl_state);
329 
330  /* tls fingerprint */
331  if (tls_ctx->fields & LOG_TLS_FIELD_FINGERPRINT)
332  JsonTlsLogFingerprint(js, ssl_state);
333 
334  /* tls sni */
335  if (tls_ctx->fields & LOG_TLS_FIELD_SNI)
336  JsonTlsLogSni(js, ssl_state);
337 
338  /* tls version */
339  if (tls_ctx->fields & LOG_TLS_FIELD_VERSION)
340  JsonTlsLogVersion(js, ssl_state);
341 
342  /* tls notbefore */
343  if (tls_ctx->fields & LOG_TLS_FIELD_NOTBEFORE)
344  JsonTlsLogNotBefore(js, ssl_state);
345 
346  /* tls notafter */
347  if (tls_ctx->fields & LOG_TLS_FIELD_NOTAFTER)
348  JsonTlsLogNotAfter(js, ssl_state);
349 
350  /* tls certificate */
351  if (tls_ctx->fields & LOG_TLS_FIELD_CERTIFICATE)
352  JsonTlsLogCertificate(js, ssl_state);
353 
354  /* tls chain */
355  if (tls_ctx->fields & LOG_TLS_FIELD_CHAIN)
356  JsonTlsLogChain(js, ssl_state);
357 
358  /* tls ja3_hash */
359  if (tls_ctx->fields & LOG_TLS_FIELD_JA3)
360  JsonTlsLogJa3(js, ssl_state);
361 
362  /* tls ja3s */
363  if (tls_ctx->fields & LOG_TLS_FIELD_JA3S)
364  JsonTlsLogJa3S(js, ssl_state);
365 }
366 
367 void JsonTlsLogJSONExtended(JsonBuilder *tjs, SSLState * state)
368 {
369  JsonTlsLogJSONBasic(tjs, state);
370 
371  /* tls serial */
372  JsonTlsLogSerial(tjs, state);
373 
374  /* tls fingerprint */
375  JsonTlsLogFingerprint(tjs, state);
376 
377  /* tls sni */
378  JsonTlsLogSni(tjs, state);
379 
380  /* tls version */
381  JsonTlsLogVersion(tjs, state);
382 
383  /* tls notbefore */
384  JsonTlsLogNotBefore(tjs, state);
385 
386  /* tls notafter */
387  JsonTlsLogNotAfter(tjs, state);
388 
389  /* tls ja3 */
390  JsonTlsLogJa3(tjs, state);
391 
392  /* tls ja3s */
393  JsonTlsLogJa3S(tjs, state);
394 }
395 
396 static int JsonTlsLogger(ThreadVars *tv, void *thread_data, const Packet *p,
397  Flow *f, void *state, void *txptr, uint64_t tx_id)
398 {
399  JsonTlsLogThread *aft = (JsonTlsLogThread *)thread_data;
400  OutputTlsCtx *tls_ctx = aft->tlslog_ctx;
401 
402  SSLState *ssl_state = (SSLState *)state;
403  if (unlikely(ssl_state == NULL)) {
404  return 0;
405  }
406 
407  if ((ssl_state->server_connp.cert0_issuerdn == NULL ||
408  ssl_state->server_connp.cert0_subject == NULL) &&
409  ((ssl_state->flags & SSL_AL_FLAG_SESSION_RESUMED) == 0 ||
410  (tls_ctx->flags & LOG_TLS_SESSION_RESUMPTION) == 0) &&
411  ((ssl_state->flags & SSL_AL_FLAG_LOG_WITHOUT_CERT) == 0)) {
412  return 0;
413  }
414 
415  JsonBuilder *js = CreateEveHeader(p, LOG_DIR_FLOW, "tls", NULL, aft->tlslog_ctx->eve_ctx);
416  if (unlikely(js == NULL)) {
417  return 0;
418  }
419 
420  jb_open_object(js, "tls");
421 
422  /* log custom fields */
423  if (tls_ctx->flags & LOG_TLS_CUSTOM) {
424  JsonTlsLogJSONCustom(tls_ctx, js, ssl_state);
425  }
426  /* log extended */
427  else if (tls_ctx->flags & LOG_TLS_EXTENDED) {
428  JsonTlsLogJSONExtended(js, ssl_state);
429  }
430  /* log basic */
431  else {
432  JsonTlsLogJSONBasic(js, ssl_state);
433  }
434 
435  /* print original application level protocol when it have been changed
436  because of STARTTLS, HTTP CONNECT, or similar. */
437  if (f->alproto_orig != ALPROTO_UNKNOWN) {
438  jb_set_string(js, "from_proto",
440  }
441 
442  /* Close the tls object. */
443  jb_close(js);
444 
445  OutputJsonBuilderBuffer(js, aft->ctx);
446  jb_free(js);
447 
448  return 0;
449 }
450 
451 static TmEcode JsonTlsLogThreadInit(ThreadVars *t, const void *initdata, void **data)
452 {
453  JsonTlsLogThread *aft = SCCalloc(1, sizeof(JsonTlsLogThread));
454  if (unlikely(aft == NULL)) {
455  return TM_ECODE_FAILED;
456  }
457 
458  if (initdata == NULL) {
459  SCLogDebug("Error getting context for eve-log tls 'initdata' argument NULL");
460  goto error_exit;
461  }
462 
463  /* use the Output Context (file pointer and mutex) */
464  aft->tlslog_ctx = ((OutputCtx *)initdata)->data;
465 
466  aft->ctx = CreateEveThreadCtx(t, aft->tlslog_ctx->eve_ctx);
467  if (!aft->ctx) {
468  goto error_exit;
469  }
470  *data = (void *)aft;
471  return TM_ECODE_OK;
472 
473 error_exit:
474  SCFree(aft);
475  return TM_ECODE_FAILED;
476 }
477 
478 static TmEcode JsonTlsLogThreadDeinit(ThreadVars *t, void *data)
479 {
480  JsonTlsLogThread *aft = (JsonTlsLogThread *)data;
481  if (aft == NULL) {
482  return TM_ECODE_OK;
483  }
484 
485  FreeEveThreadCtx(aft->ctx);
486 
487  /* clear memory */
488  memset(aft, 0, sizeof(JsonTlsLogThread));
489 
490  SCFree(aft);
491  return TM_ECODE_OK;
492 }
493 
494 static OutputTlsCtx *OutputTlsInitCtx(ConfNode *conf)
495 {
496  OutputTlsCtx *tls_ctx = SCMalloc(sizeof(OutputTlsCtx));
497  if (unlikely(tls_ctx == NULL))
498  return NULL;
499 
500  tls_ctx->flags = LOG_TLS_DEFAULT;
501  tls_ctx->fields = 0;
502 
503  if (conf == NULL)
504  return tls_ctx;
505 
506  const char *extended = ConfNodeLookupChildValue(conf, "extended");
507  if (extended) {
508  if (ConfValIsTrue(extended)) {
509  tls_ctx->flags = LOG_TLS_EXTENDED;
510  }
511  }
512 
513  ConfNode *custom = ConfNodeLookupChild(conf, "custom");
514  if (custom) {
515  tls_ctx->flags = LOG_TLS_CUSTOM;
516  ConfNode *field;
517  TAILQ_FOREACH(field, &custom->head, next)
518  {
519  TlsFields *valid_fields = tls_fields;
520  for ( ; valid_fields->name != NULL; valid_fields++) {
521  if (strcasecmp(field->val, valid_fields->name) == 0) {
522  tls_ctx->fields |= valid_fields->flag;
523  break;
524  }
525  }
526  }
527  }
528 
529  const char *session_resumption = ConfNodeLookupChildValue(conf, "session-resumption");
530  if (session_resumption == NULL || ConfValIsTrue(session_resumption)) {
531  tls_ctx->flags |= LOG_TLS_SESSION_RESUMPTION;
532  }
533 
534  if ((tls_ctx->fields & LOG_TLS_FIELD_JA3) &&
535  Ja3IsDisabled("fields")) {
536  /* JA3 is disabled, so don't log any JA3 fields */
537  tls_ctx->fields &= ~LOG_TLS_FIELD_JA3;
538  tls_ctx->fields &= ~LOG_TLS_FIELD_JA3S;
539  }
540 
541  if ((tls_ctx->fields & LOG_TLS_FIELD_CERTIFICATE) &&
542  (tls_ctx->fields & LOG_TLS_FIELD_CHAIN)) {
544  "Both 'certificate' and 'chain' contains the top "
545  "certificate, so only one of them should be enabled "
546  "at a time");
547  }
548 
549  return tls_ctx;
550 }
551 
552 static void OutputTlsLogDeinitSub(OutputCtx *output_ctx)
553 {
554  OutputTlsCtx *tls_ctx = output_ctx->data;
555  SCFree(tls_ctx);
556  SCFree(output_ctx);
557 }
558 
559 static OutputInitResult OutputTlsLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
560 {
561  OutputInitResult result = { NULL, false };
562  OutputJsonCtx *ojc = parent_ctx->data;
563 
564  OutputTlsCtx *tls_ctx = OutputTlsInitCtx(conf);
565  if (unlikely(tls_ctx == NULL))
566  return result;
567 
568  OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
569  if (unlikely(output_ctx == NULL)) {
570  SCFree(tls_ctx);
571  return result;
572  }
573 
574  tls_ctx->eve_ctx = ojc;
575 
576  if ((tls_ctx->fields & LOG_TLS_FIELD_CERTIFICATE) &&
577  (tls_ctx->fields & LOG_TLS_FIELD_CHAIN)) {
579  "Both 'certificate' and 'chain' contains the top "
580  "certificate, so only one of them should be enabled "
581  "at a time");
582  }
583 
584  output_ctx->data = tls_ctx;
585  output_ctx->DeInit = OutputTlsLogDeinitSub;
586 
588 
589  result.ctx = output_ctx;
590  result.ok = true;
591  return result;
592 }
593 
595 {
596  /* register as child of eve-log */
598  "JsonTlsLog", "eve-log.tls", OutputTlsLogInitSub, ALPROTO_TLS,
599  JsonTlsLogger, TLS_HANDSHAKE_DONE, TLS_HANDSHAKE_DONE,
600  JsonTlsLogThreadInit, JsonTlsLogThreadDeinit, NULL);
601 }
SSLStateConnp_::cert0_not_before
time_t cert0_not_before
Definition: app-layer-ssl.h:205
tm-threads.h
SSLStateConnp_::cert0_subject
char * cert0_subject
Definition: app-layer-ssl.h:202
SSLState_
SSLv[2.0|3.[0|1|2|3]] state structure.
Definition: app-layer-ssl.h:233
len
uint8_t len
Definition: app-layer-dnp3.h:2
LOG_TLS_FIELD_NOTBEFORE
#define LOG_TLS_FIELD_NOTBEFORE
Definition: output-json-tls.c:69
SSLCertsChain_::cert_len
uint32_t cert_len
Definition: app-layer-ssl.h:174
JsonTlsLogJSONBasic
void JsonTlsLogJSONBasic(JsonBuilder *js, SSLState *ssl_state)
Definition: output-json-tls.c:299
LOG_TLS_DEFAULT
#define LOG_TLS_DEFAULT
Definition: output-json-tls.c:59
ConfNode_::val
char * val
Definition: conf.h:34
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
LOG_TLS_FIELD_JA3
#define LOG_TLS_FIELD_JA3
Definition: output-json-tls.c:75
SSLState_::client_connp
SSLStateConnp client_connp
Definition: app-layer-ssl.h:250
ALPROTO_TLS
@ ALPROTO_TLS
Definition: app-layer-protos.h:33
SC_WARN_DUPLICATE_OUTPUT
@ SC_WARN_DUPLICATE_OUTPUT
Definition: util-error.h:329
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:298
next
struct HtpBodyChunk_ * next
Definition: app-layer-htp.h:0
SSLState_::server_connp
SSLStateConnp server_connp
Definition: app-layer-ssl.h:251
SSL_AL_FLAG_SESSION_RESUMED
#define SSL_AL_FLAG_SESSION_RESUMED
Definition: app-layer-ssl.h:111
FreeEveThreadCtx
void FreeEveThreadCtx(OutputJsonThreadCtx *ctx)
Definition: output-json-common.c:73
SSLStateConnp_::ja3_hash
char * ja3_hash
Definition: app-layer-ssl.h:219
threads.h
OutputJsonCtx_
Definition: output-json.h:81
Flow_
Flow data structure.
Definition: flow.h:353
SSL_AL_FLAG_STATE_SERVER_HELLO
#define SSL_AL_FLAG_STATE_SERVER_HELLO
Definition: app-layer-ssl.h:91
TlsFields
Definition: output-json-tls.c:78
OutputJsonBuilderBuffer
int OutputJsonBuilderBuffer(JsonBuilder *js, OutputJsonThreadCtx *ctx)
Definition: output-json.c:975
SSL_VERSION_MAX_STRLEN
#define SSL_VERSION_MAX_STRLEN
Definition: app-layer-ssl.h:139
LOG_TLS_FIELD_NOTAFTER
#define LOG_TLS_FIELD_NOTAFTER
Definition: output-json-tls.c:70
TAILQ_EMPTY
#define TAILQ_EMPTY(head)
Definition: queue.h:347
TAILQ_FOREACH
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:350
Flow_::alproto_orig
AppProto alproto_orig
Definition: flow.h:466
output-json-tls.h
CreateEveThreadCtx
OutputJsonThreadCtx * CreateEveThreadCtx(ThreadVars *t, OutputJsonCtx *ctx)
Definition: output-json-common.c:44
JA3Buffer_::data
char * data
Definition: util-ja3.h:30
util-ja3.h
util-privs.h
SSLStateConnp_::sni
char * sni
Definition: app-layer-ssl.h:210
LOG_TLS_FIELD_SUBJECT
#define LOG_TLS_FIELD_SUBJECT
Definition: output-json-tls.c:65
TM_ECODE_FAILED
@ TM_ECODE_FAILED
Definition: tm-threads-common.h:81
LOGGER_JSON_TLS
@ LOGGER_JSON_TLS
Definition: suricata-common.h:446
JsonTlsLogThread
struct JsonTlsLogThread_ JsonTlsLogThread
LOG_TLS_FIELD_FINGERPRINT
#define LOG_TLS_FIELD_FINGERPRINT
Definition: output-json-tls.c:68
JsonTlsLogRegister
void JsonTlsLogRegister(void)
Definition: output-json-tls.c:594
TlsFields::flag
uint64_t flag
Definition: output-json-tls.c:80
SC_BASE64_OK
@ SC_BASE64_OK
Definition: util-crypt.h:39
util-unittest.h
SSLStateConnp_::cert0_issuerdn
char * cert0_issuerdn
Definition: app-layer-ssl.h:203
ConfValIsTrue
int ConfValIsTrue(const char *val)
Check if a value is true.
Definition: conf.c:565
JsonTlsLogThread_::ctx
OutputJsonThreadCtx * ctx
Definition: output-json-tls.c:109
OutputCtx_::data
void * data
Definition: tm-modules.h:81
TM_ECODE_OK
@ TM_ECODE_OK
Definition: tm-threads-common.h:80
OutputCtx_
Definition: tm-modules.h:78
OutputJsonThreadCtx_
Definition: output-json.h:89
Ja3IsDisabled
int Ja3IsDisabled(const char *type)
Check if JA3 is disabled.
Definition: util-ja3.c:251
SSLStateConnp_::cert0_not_after
time_t cert0_not_after
Definition: app-layer-ssl.h:206
Base64Encode
int Base64Encode(const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen)
Definition: util-crypt.c:35
OutputTlsCtx_::eve_ctx
OutputJsonCtx * eve_ctx
Definition: output-json-tls.c:103
util-debug.h
TlsFields::name
const char * name
Definition: output-json-tls.c:79
TAILQ_FIRST
#define TAILQ_FIRST(head)
Definition: queue.h:339
LOG_TLS_FIELD_JA3S
#define LOG_TLS_FIELD_JA3S
Definition: output-json-tls.c:76
OutputInitResult_::ctx
OutputCtx * ctx
Definition: output.h:44
output-json.h
OutputRegisterTxSubModuleWithProgress
void OutputRegisterTxSubModuleWithProgress(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, AppProto alproto, TxLogger TxLogFunc, int tc_log_progress, int ts_log_progress, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Definition: output.c:378
TLS_HANDSHAKE_DONE
@ TLS_HANDSHAKE_DONE
Definition: app-layer-ssl.h:71
LOG_TLS_CUSTOM
#define LOG_TLS_CUSTOM
Definition: output-json-tls.c:61
AppLayerParserRegisterLogger
void AppLayerParserRegisterLogger(uint8_t ipproto, AppProto alproto)
Definition: app-layer-parser.c:455
CreateEveHeader
JsonBuilder * CreateEveHeader(const Packet *p, enum OutputJsonLogDirection dir, const char *event_type, JsonAddrInfo *addr, OutputJsonCtx *eve_ctx)
Definition: output-json.c:839
SSLCertsChain_
Definition: app-layer-ssl.h:172
util-print.h
util-crypt.h
detect.h
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:58
pkt-var.h
OutputTlsCtx_::flags
uint32_t flags
Definition: output-json-tls.c:101
SSLVersionToString
void SSLVersionToString(uint16_t version, char *buffer)
Definition: app-layer-ssl.c:311
OutputInitResult_::ok
bool ok
Definition: output.h:45
app-layer-parser.h
LOG_TLS_FIELD_SERIAL
#define LOG_TLS_FIELD_SERIAL
Definition: output-json-tls.c:67
Packet_
Definition: decode.h:414
conf.h
OutputTlsCtx
struct OutputTlsCtx_ OutputTlsCtx
TmEcode
TmEcode
Definition: tm-threads-common.h:79
SSLCertsChain_::cert_data
uint8_t * cert_data
Definition: app-layer-ssl.h:173
LOG_TLS_FIELD_ISSUER
#define LOG_TLS_FIELD_ISSUER
Definition: output-json-tls.c:66
ConfNodeLookupChild
ConfNode * ConfNodeLookupChild(const ConfNode *node, const char *name)
Lookup a child configuration node by name.
Definition: conf.c:814
OutputInitResult_
Definition: output.h:43
suricata-common.h
OutputCtx_::DeInit
void(* DeInit)(struct OutputCtx_ *)
Definition: tm-modules.h:84
tls_fields
TlsFields tls_fields[]
Definition: output-json-tls.c:83
LOG_TLS_FIELD_CERTIFICATE
#define LOG_TLS_FIELD_CERTIFICATE
Definition: output-json-tls.c:72
OutputTlsCtx_
Definition: output-json-tls.c:100
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:29
threadvars.h
LOG_DIR_FLOW
@ LOG_DIR_FLOW
Definition: output-json.h:40
SCMalloc
#define SCMalloc(sz)
Definition: util-mem.h:47
SCLogWarning
#define SCLogWarning(err_code,...)
Macro used to log WARNING messages.
Definition: util-debug.h:244
SCFree
#define SCFree(p)
Definition: util-mem.h:61
ConfNode_
Definition: conf.h:32
util-logopenfile.h
util-buffer.h
AppLayerGetProtoName
const char * AppLayerGetProtoName(AppProto alproto)
Given the internal protocol id, returns a string representation of the protocol.
Definition: app-layer.c:805
ALPROTO_UNKNOWN
@ ALPROTO_UNKNOWN
Definition: app-layer-protos.h:29
BASE64_BUFFER_SIZE
#define BASE64_BUFFER_SIZE(x)
Definition: util-crypt.h:36
OutputTlsCtx_::fields
uint64_t fields
Definition: output-json-tls.c:102
LOG_TLS_FIELD_SNI
#define LOG_TLS_FIELD_SNI
Definition: output-json-tls.c:71
SSLStateConnp_::cert0_fingerprint
char * cert0_fingerprint
Definition: app-layer-ssl.h:207
LOG_TLS_EXTENDED
#define LOG_TLS_EXTENDED
Definition: output-json-tls.c:60
SSLStateConnp_::ja3_str
JA3Buffer * ja3_str
Definition: app-layer-ssl.h:218
JsonTlsLogThread_::tlslog_ctx
OutputTlsCtx * tlslog_ctx
Definition: output-json-tls.c:108
LOG_TLS_FIELD_SESSION_RESUMED
#define LOG_TLS_FIELD_SESSION_RESUMED
Definition: output-json-tls.c:74
LOG_TLS_SESSION_RESUMPTION
#define LOG_TLS_SESSION_RESUMPTION
Definition: output-json-tls.c:62
JsonTlsLogJSONExtended
void JsonTlsLogJSONExtended(JsonBuilder *tjs, SSLState *state)
Definition: output-json-tls.c:367
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53
LOG_TLS_FIELD_CHAIN
#define LOG_TLS_FIELD_CHAIN
Definition: output-json-tls.c:73
CreateUtcIsoTimeString
void CreateUtcIsoTimeString(const struct timeval *ts, char *str, size_t size)
Definition: util-time.c:233
SSLStateConnp_::cert0_serial
char * cert0_serial
Definition: app-layer-ssl.h:204
LOG_TLS_FIELD_VERSION
#define LOG_TLS_FIELD_VERSION
Definition: output-json-tls.c:64
JsonTlsLogThread_
Definition: output-json-tls.c:107
app-layer-ssl.h
SSL_AL_FLAG_LOG_WITHOUT_CERT
#define SSL_AL_FLAG_LOG_WITHOUT_CERT
Definition: app-layer-ssl.h:118
debug.h
output.h
SC_ATOMIC_EXTERN
SC_ATOMIC_EXTERN(unsigned int, cert_id)
app-layer.h
SSLState_::flags
uint32_t flags
Definition: app-layer-ssl.h:239
SSLStateConnp_::version
uint16_t version
Definition: app-layer-ssl.h:189
ConfNodeLookupChildValue
const char * ConfNodeLookupChildValue(const ConfNode *node, const char *name)
Lookup the value of a child configuration node by name.
Definition: conf.c:842