suricata
log-tlslog.c
Go to the documentation of this file.
1 /* Copyright (C) 2007-2014 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 Roliers Jean-Paul <popof.fpn@gmail.co>
22  * \author Eric Leblond <eric@regit.org>
23  * \author Victor Julien <victor@inliniac.net>
24  * \author Paulo Pacheco <fooinha@gmail.com>
25  *
26  * Implements TLS logging portion of the engine.
27  */
28 
29 #include "suricata-common.h"
30 #include "conf.h"
31 
32 #include "threadvars.h"
33 
34 #include "util-print.h"
35 #include "util-debug.h"
36 
37 #include "output.h"
38 #include "log-tlslog.h"
39 #include "app-layer-ssl.h"
40 #include "app-layer-parser.h"
41 #include "util-buffer.h"
42 
43 #include "util-logopenfile.h"
44 #include "util-time.h"
45 #include "log-cf-common.h"
46 
47 #define DEFAULT_LOG_FILENAME "tls.log"
48 
49 #define MODULE_NAME "LogTlsLog"
50 
51 #define PRINT_BUF_LEN 46
52 
53 #define OUTPUT_BUFFER_SIZE 65535
54 
55 #define LOG_TLS_DEFAULT 0
56 #define LOG_TLS_EXTENDED 1
57 #define LOG_TLS_CUSTOM 2
58 
59 #define LOG_TLS_SESSION_RESUMPTION 4
60 
61 #define LOG_TLS_CF_VERSION 'v'
62 #define LOG_TLS_CF_DATE_NOT_BEFORE 'd'
63 #define LOG_TLS_CF_DATE_NOT_AFTER 'D'
64 #define LOG_TLS_CF_SHA1 'f'
65 #define LOG_TLS_CF_SNI 'n'
66 #define LOG_TLS_CF_SUBJECT 's'
67 #define LOG_TLS_CF_ISSUER 'i'
68 #define LOG_TLS_CF_EXTENDED 'E'
69 
70 typedef struct LogTlsFileCtx_ {
72  uint32_t flags; /** Store mode */
75 
76 typedef struct LogTlsLogThread_ {
80 
81 int TLSGetIPInformations(const Packet *p, char *srcip, socklen_t srcip_len, Port *sp, char *dstip,
82  socklen_t dstip_len, Port *dp, int ipproto)
83 {
84  if ((PKT_IS_TOSERVER(p))) {
85  switch (ipproto) {
86  case AF_INET:
87  PrintInet(AF_INET, (const void *) GET_IPV4_SRC_ADDR_PTR(p),
88  srcip, srcip_len);
89  PrintInet(AF_INET, (const void *) GET_IPV4_DST_ADDR_PTR(p),
90  dstip, dstip_len);
91  break;
92  case AF_INET6:
93  PrintInet(AF_INET6, (const void *) GET_IPV6_SRC_ADDR(p), srcip,
94  srcip_len);
95  PrintInet(AF_INET6, (const void *) GET_IPV6_DST_ADDR(p), dstip,
96  dstip_len);
97  break;
98  default:
99  return 0;
100  }
101  *sp = p->sp;
102  *dp = p->dp;
103  } else {
104  switch (ipproto) {
105  case AF_INET:
106  PrintInet(AF_INET, (const void *) GET_IPV4_DST_ADDR_PTR(p),
107  srcip, srcip_len);
108  PrintInet(AF_INET, (const void *) GET_IPV4_SRC_ADDR_PTR(p),
109  dstip, dstip_len);
110  break;
111  case AF_INET6:
112  PrintInet(AF_INET6, (const void *) GET_IPV6_DST_ADDR(p), srcip,
113  srcip_len);
114  PrintInet(AF_INET6, (const void *) GET_IPV6_SRC_ADDR(p), dstip,
115  dstip_len);
116  break;
117  default:
118  return 0;
119  }
120  *sp = p->dp;
121  *dp = p->sp;
122  }
123  return 1;
124 }
125 
126 static TmEcode LogTlsLogThreadInit(ThreadVars *t, const void *initdata,
127  void **data)
128 {
129  LogTlsLogThread *aft = SCCalloc(1, sizeof(LogTlsLogThread));
130  if (unlikely(aft == NULL))
131  return TM_ECODE_FAILED;
132 
133  if (initdata == NULL) {
134  SCLogDebug("Error getting context for TLSLog. \"initdata\" argument NULL");
135  SCFree(aft);
136  return TM_ECODE_FAILED;
137  }
138 
140  if (aft->buffer == NULL) {
141  SCFree(aft);
142  return TM_ECODE_FAILED;
143  }
144 
145  /* Use the Output Context (file pointer and mutex) */
146  aft->tlslog_ctx = ((OutputCtx *) initdata)->data;
147 
148  *data = (void *)aft;
149  return TM_ECODE_OK;
150 }
151 
152 static TmEcode LogTlsLogThreadDeinit(ThreadVars *t, void *data)
153 {
154  LogTlsLogThread *aft = (LogTlsLogThread *)data;
155  if (aft == NULL) {
156  return TM_ECODE_OK;
157  }
158 
159  MemBufferFree(aft->buffer);
160  memset(aft, 0, sizeof(LogTlsLogThread));
161 
162  SCFree(aft);
163  return TM_ECODE_OK;
164 }
165 
166 static void LogTlsLogDeInitCtx(OutputCtx *output_ctx)
167 {
168  LogTlsFileCtx *tlslog_ctx = (LogTlsFileCtx *) output_ctx->data;
169  LogFileFreeCtx(tlslog_ctx->file_ctx);
170  LogCustomFormatFree(tlslog_ctx->cf);
171  SCFree(tlslog_ctx);
172  SCFree(output_ctx);
173 }
174 
175 /** \brief Create a new tls log LogFileCtx.
176  * \param conf Pointer to ConfNode containing this loggers configuration.
177  * \return NULL if failure, LogFileCtx* to the file_ctx if succesful
178  * */
179 static OutputInitResult LogTlsLogInitCtx(ConfNode *conf)
180 {
181  SCLogWarning("The tls-log output has been deprecated and will be removed in Suricata 9.0.");
182 
183  OutputInitResult result = { NULL, false };
184  LogFileCtx* file_ctx = LogFileNewCtx();
185 
186  if (file_ctx == NULL) {
187  SCLogError("LogTlsLogInitCtx: Couldn't "
188  "create new file_ctx");
189  return result;
190  }
191 
192  if (SCConfLogOpenGeneric(conf, file_ctx, DEFAULT_LOG_FILENAME, 1) < 0) {
193  goto filectx_error;
194  }
195 
196  LogTlsFileCtx *tlslog_ctx = SCCalloc(1, sizeof(LogTlsFileCtx));
197  if (unlikely(tlslog_ctx == NULL)) {
198  goto filectx_error;
199  }
200  tlslog_ctx->file_ctx = file_ctx;
201 
202  const char *extended = ConfNodeLookupChildValue(conf, "extended");
203  const char *custom = ConfNodeLookupChildValue(conf, "custom");
204  const char *customformat = ConfNodeLookupChildValue(conf, "customformat");
205 
206  /* If custom logging format is selected, lets parse it */
207  if (custom != NULL && customformat != NULL && ConfValIsTrue(custom)) {
208  tlslog_ctx->cf = LogCustomFormatAlloc();
209  if (!tlslog_ctx->cf) {
210  goto tlslog_error;
211  }
212 
213  tlslog_ctx->flags |= LOG_TLS_CUSTOM;
214 
215  if (!LogCustomFormatParse(tlslog_ctx->cf, customformat)) {
216  goto parser_error;
217  }
218  } else {
219  if (extended == NULL) {
220  tlslog_ctx->flags |= LOG_TLS_DEFAULT;
221  } else {
222  if (ConfValIsTrue(extended)) {
223  tlslog_ctx->flags |= LOG_TLS_EXTENDED;
224  }
225  }
226  }
227 
228  const char *resumption = ConfNodeLookupChildValue(conf,
229  "session-resumption");
230  if (resumption == NULL || ConfValIsTrue(resumption)) {
231  tlslog_ctx->flags |= LOG_TLS_SESSION_RESUMPTION;
232  }
233 
234  OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
235  if (unlikely(output_ctx == NULL)) {
236  goto tlslog_error;
237  }
238  output_ctx->data = tlslog_ctx;
239  output_ctx->DeInit = LogTlsLogDeInitCtx;
240 
241  SCLogDebug("TLS log output initialized");
242 
243  /* Enable the logger for the app layer */
245 
246  result.ctx = output_ctx;
247  result.ok = true;
248  return result;
249 
250 parser_error:
251  SCLogError("Syntax error in custom tls log "
252  "format string.");
253 tlslog_error:
254  LogCustomFormatFree(tlslog_ctx->cf);
255  SCFree(tlslog_ctx);
256 filectx_error:
257  LogFileFreeCtx(file_ctx);
258  return result;
259 }
260 
261 static void LogTlsLogVersion(MemBuffer *buffer, uint16_t version)
262 {
263  char ssl_version[SSL_VERSION_MAX_STRLEN];
264  SSLVersionToString(version, ssl_version);
265  MemBufferWriteString(buffer, "VERSION='%s'", ssl_version);
266 }
267 
268 static void LogTlsLogDate(MemBuffer *buffer, const char *title, int64_t *date)
269 {
270  char timebuf[64] = {0};
271  if (sc_x509_format_timestamp(*date, timebuf, sizeof(timebuf))) {
272  MemBufferWriteString(buffer, "%s='%s'", title, timebuf);
273  }
274 }
275 
276 static void LogTlsLogString(MemBuffer *buffer, const char *title,
277  const char *value)
278 {
279  MemBufferWriteString(buffer, "%s='%s'", title, value);
280 }
281 
282 static void LogTlsLogBasic(LogTlsLogThread *aft, SSLState *ssl_state, const SCTime_t ts,
283  char *srcip, Port sp, char *dstip, Port dp)
284 {
285  char timebuf[64];
286  CreateTimeString(ts, timebuf, sizeof(timebuf));
288  "%s %s:%d -> %s:%d TLS:",
289  timebuf, srcip, sp, dstip, dp);
290 
291  if (ssl_state->server_connp.cert0_subject != NULL) {
292  MemBufferWriteString(aft->buffer, " Subject='%s'",
293  ssl_state->server_connp.cert0_subject);
294  }
295 
296  if (ssl_state->server_connp.cert0_issuerdn != NULL) {
297  MemBufferWriteString(aft->buffer, " Issuerdn='%s'",
298  ssl_state->server_connp.cert0_issuerdn);
299  }
300 
301  if (ssl_state->flags & SSL_AL_FLAG_SESSION_RESUMED) {
302  /* Only log a session as 'resumed' if a certificate has not
303  been seen. */
304  if ((ssl_state->server_connp.cert0_issuerdn == NULL) &&
305  (ssl_state->server_connp.cert0_subject == NULL) &&
306  (ssl_state->flags & SSL_AL_FLAG_STATE_SERVER_HELLO) &&
307  ((ssl_state->flags & SSL_AL_FLAG_LOG_WITHOUT_CERT) == 0)) {
308  MemBufferWriteString(aft->buffer, " Session='resumed'");
309  }
310  }
311 }
312 
313 static void LogTlsLogExtended(LogTlsLogThread *aft, SSLState *ssl_state, const SCTime_t ts,
314  char *srcip, Port sp, char *dstip, Port dp)
315 {
316  if (ssl_state->server_connp.cert0_fingerprint != NULL) {
318  LogTlsLogString(aft->buffer, "SHA1",
319  ssl_state->server_connp.cert0_fingerprint);
320  }
321  if (ssl_state->client_connp.sni != NULL) {
323  LogTlsLogString(aft->buffer, "SNI", ssl_state->client_connp.sni);
324  }
325  if (ssl_state->server_connp.cert0_serial != NULL) {
327  LogTlsLogString(aft->buffer, "SERIAL",
328  ssl_state->server_connp.cert0_serial);
329  }
330 
332  LogTlsLogVersion(aft->buffer, ssl_state->server_connp.version);
333 
334  if (ssl_state->server_connp.cert0_not_before != 0) {
336  LogTlsLogDate(aft->buffer, "NOTBEFORE",
337  &ssl_state->server_connp.cert0_not_before);
338  }
339  if (ssl_state->server_connp.cert0_not_after != 0) {
341  LogTlsLogDate(aft->buffer, "NOTAFTER",
342  &ssl_state->server_connp.cert0_not_after);
343  }
344 }
345 
346 /* Custom format logging */
347 static void LogTlsLogCustom(LogTlsLogThread *aft, SSLState *ssl_state, const SCTime_t ts,
348  char *srcip, Port sp, char *dstip, Port dp)
349 {
350  LogTlsFileCtx *tlslog_ctx = aft->tlslog_ctx;
351  uint32_t i;
352  char buf[64];
353 
354  for (i = 0; i < tlslog_ctx->cf->cf_n; i++)
355  {
356  LogCustomFormatNode *node = tlslog_ctx->cf->cf_nodes[i];
357  if (!node) /* Should never happen */
358  continue;
359 
360  switch (node->type) {
361  case LOG_CF_LITERAL:
362  /* LITERAL */
363  MemBufferWriteString(aft->buffer, "%s", node->data);
364  break;
365  case LOG_CF_TIMESTAMP:
366  /* TIMESTAMP */
368  break;
369  case LOG_CF_TIMESTAMP_U:
370  /* TIMESTAMP USECONDS */
371  snprintf(buf, sizeof(buf), "%06u", (unsigned int)SCTIME_USECS(ts));
372  PrintRawUriBuf((char *)aft->buffer->buffer, &aft->buffer->offset, aft->buffer->size,
373  (uint8_t *)buf, MIN(strlen(buf), 6));
374  break;
375  case LOG_CF_CLIENT_IP:
376  /* CLIENT IP ADDRESS */
377  PrintRawUriBuf((char *)aft->buffer->buffer,
378  &aft->buffer->offset, aft->buffer->size,
379  (uint8_t *)srcip,strlen(srcip));
380  break;
381  case LOG_CF_SERVER_IP:
382  /* SERVER IP ADDRESS */
383  PrintRawUriBuf((char *)aft->buffer->buffer,
384  &aft->buffer->offset, aft->buffer->size,
385  (uint8_t *)dstip, strlen(dstip));
386  break;
387  case LOG_CF_CLIENT_PORT:
388  /* CLIENT PORT */
389  MemBufferWriteString(aft->buffer, "%" PRIu16 "", sp);
390  break;
391  case LOG_CF_SERVER_PORT:
392  /* SERVER PORT */
393  MemBufferWriteString(aft->buffer, "%" PRIu16 "", dp);
394  break;
395  case LOG_TLS_CF_VERSION:
396  LogTlsLogVersion(aft->buffer, ssl_state->server_connp.version);
397  break;
399  LogTlsLogDate(aft->buffer, "NOTBEFORE",
400  &ssl_state->server_connp.cert0_not_before);
401  break;
403  LogTlsLogDate(aft->buffer, "NOTAFTER",
404  &ssl_state->server_connp.cert0_not_after);
405  break;
406  case LOG_TLS_CF_SHA1:
407  if (ssl_state->server_connp.cert0_fingerprint != NULL) {
408  MemBufferWriteString(aft->buffer, "%s",
409  ssl_state->server_connp.cert0_fingerprint);
410  } else {
412  }
413  break;
414  case LOG_TLS_CF_SNI:
415  if (ssl_state->client_connp.sni != NULL) {
416  MemBufferWriteString(aft->buffer, "%s",
417  ssl_state->client_connp.sni);
418  } else {
420  }
421  break;
422  case LOG_TLS_CF_SUBJECT:
423  if (ssl_state->server_connp.cert0_subject != NULL) {
424  MemBufferWriteString(aft->buffer, "%s",
425  ssl_state->server_connp.cert0_subject);
426  } else {
428  }
429  break;
430  case LOG_TLS_CF_ISSUER:
431  if (ssl_state->server_connp.cert0_issuerdn != NULL) {
432  MemBufferWriteString(aft->buffer, "%s",
433  ssl_state->server_connp.cert0_issuerdn);
434  } else {
436  }
437  break;
438  case LOG_TLS_CF_EXTENDED:
439  /* Extended format */
440  LogTlsLogExtended(aft, ssl_state, ts, srcip, sp, dstip, dp);
441  break;
442  default:
443  /* NO MATCH */
445  SCLogDebug("No matching parameter %%%c for custom tls log.",
446  node->type);
447  break;
448  }
449  }
450 }
451 
452 
453 static int LogTlsLogger(ThreadVars *tv, void *thread_data, const Packet *p,
454  Flow *f, void *state, void *tx, uint64_t tx_id)
455 {
456  LogTlsLogThread *aft = (LogTlsLogThread *)thread_data;
457  LogTlsFileCtx *hlog = aft->tlslog_ctx;
458  int ipproto = (PacketIsIPv4(p)) ? AF_INET : AF_INET6;
459 
460  SSLState *ssl_state = (SSLState *)state;
461  if (unlikely(ssl_state == NULL)) {
462  return 0;
463  }
464 
465  if (((hlog->flags & LOG_TLS_SESSION_RESUMPTION) == 0 ||
466  (ssl_state->flags & SSL_AL_FLAG_SESSION_RESUMED) == 0) &&
467  (ssl_state->server_connp.cert0_issuerdn == NULL ||
468  ssl_state->server_connp.cert0_subject == NULL) &&
469  ((ssl_state->flags & SSL_AL_FLAG_LOG_WITHOUT_CERT) == 0)) {
470  return 0;
471  }
472 
473  char srcip[PRINT_BUF_LEN], dstip[PRINT_BUF_LEN];
474 
475  Port sp, dp;
476  if (!TLSGetIPInformations(p, srcip, PRINT_BUF_LEN, &sp, dstip,
477  PRINT_BUF_LEN, &dp, ipproto)) {
478  return 0;
479  }
480 
481  MemBufferReset(aft->buffer);
482 
483  if (hlog->flags & LOG_TLS_CUSTOM) {
484  LogTlsLogCustom(aft, ssl_state, p->ts, srcip, sp, dstip, dp);
485  } else if (hlog->flags & LOG_TLS_EXTENDED) {
486  LogTlsLogBasic(aft, ssl_state, p->ts, srcip, sp, dstip, dp);
487  LogTlsLogExtended(aft, ssl_state, p->ts, srcip, sp, dstip, dp);
488  } else {
489  LogTlsLogBasic(aft, ssl_state, p->ts, srcip, sp, dstip, dp);
490  }
491 
492  MemBufferWriteString(aft->buffer, "\n");
493 
494  hlog->file_ctx->Write((const char *)MEMBUFFER_BUFFER(aft->buffer),
495  MEMBUFFER_OFFSET(aft->buffer), hlog->file_ctx);
496 
497  return 0;
498 }
499 
501 {
502  OutputRegisterTxModuleWithProgress(LOGGER_TLS, MODULE_NAME, "tls-log", LogTlsLogInitCtx,
503  ALPROTO_TLS, LogTlsLogger, TLS_HANDSHAKE_DONE, TLS_HANDSHAKE_DONE, LogTlsLogThreadInit,
504  LogTlsLogThreadDeinit);
505 }
LogCustomFormatFree
void LogCustomFormatFree(LogCustomFormat *cf)
Frees memory held by a custom format.
Definition: log-cf-common.c:80
SSLStateConnp_::cert0_subject
char * cert0_subject
Definition: app-layer-ssl.h:255
SSLState_
SSLv[2.0|3.[0|1|2|3]] state structure.
Definition: app-layer-ssl.h:296
ts
uint64_t ts
Definition: source-erf-file.c:55
MemBuffer_::buffer
uint8_t buffer[]
Definition: util-buffer.h:30
LOG_TLS_SESSION_RESUMPTION
#define LOG_TLS_SESSION_RESUMPTION
Definition: log-tlslog.c:59
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
SSLState_::client_connp
SSLStateConnp client_connp
Definition: app-layer-ssl.h:314
ALPROTO_TLS
@ ALPROTO_TLS
Definition: app-layer-protos.h:33
LogFileNewCtx
LogFileCtx * LogFileNewCtx(void)
LogFileNewCtx() Get a new LogFileCtx.
Definition: util-logopenfile.c:659
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:269
LogTlsFileCtx_::flags
uint32_t flags
Definition: log-tlslog.c:72
OUTPUT_BUFFER_SIZE
#define OUTPUT_BUFFER_SIZE
Definition: log-tlslog.c:53
DEFAULT_LOG_FILENAME
#define DEFAULT_LOG_FILENAME
Definition: log-tlslog.c:47
SSLState_::server_connp
SSLStateConnp server_connp
Definition: app-layer-ssl.h:315
SSLStateConnp_::cert0_not_before
int64_t cert0_not_before
Definition: app-layer-ssl.h:258
SSL_AL_FLAG_SESSION_RESUMED
#define SSL_AL_FLAG_SESSION_RESUMED
Definition: app-layer-ssl.h:116
Flow_
Flow data structure.
Definition: flow.h:356
LogTlsLogRegister
void LogTlsLogRegister(void)
Definition: log-tlslog.c:500
SSL_AL_FLAG_STATE_SERVER_HELLO
#define SSL_AL_FLAG_STATE_SERVER_HELLO
Definition: app-layer-ssl.h:99
LogTlsLogThread_::buffer
MemBuffer * buffer
Definition: log-tlslog.c:78
LogFileCtx_
Definition: util-logopenfile.h:72
LOG_CF_LITERAL
#define LOG_CF_LITERAL
Definition: log-cf-common.h:39
SSL_VERSION_MAX_STRLEN
#define SSL_VERSION_MAX_STRLEN
Definition: app-layer-ssl.h:154
LogTlsFileCtx_::file_ctx
LogFileCtx * file_ctx
Definition: log-tlslog.c:71
LOG_TLS_CUSTOM
#define LOG_TLS_CUSTOM
Definition: log-tlslog.c:57
MIN
#define MIN(x, y)
Definition: suricata-common.h:391
LogFileCtx_::Write
int(* Write)(const char *buffer, int buffer_len, struct LogFileCtx_ *fp)
Definition: util-logopenfile.h:87
SSLStateConnp_::sni
char * sni
Definition: app-layer-ssl.h:265
TM_ECODE_FAILED
@ TM_ECODE_FAILED
Definition: tm-threads-common.h:81
LogCustomFormatWriteTimestamp
void LogCustomFormatWriteTimestamp(MemBuffer *buffer, const char *fmt, const SCTime_t ts)
Writes a timestamp with given format into a MemBuffer.
Definition: log-cf-common.c:211
LOG_CF_CLIENT_PORT
#define LOG_CF_CLIENT_PORT
Definition: log-cf-common.h:44
GET_IPV6_DST_ADDR
#define GET_IPV6_DST_ADDR(p)
Definition: decode.h:202
MemBuffer_::offset
uint32_t offset
Definition: util-buffer.h:29
SSLStateConnp_::cert0_issuerdn
char * cert0_issuerdn
Definition: app-layer-ssl.h:256
ConfValIsTrue
int ConfValIsTrue(const char *val)
Check if a value is true.
Definition: conf.c:536
OutputCtx_::data
void * data
Definition: tm-modules.h:87
TM_ECODE_OK
@ TM_ECODE_OK
Definition: tm-threads-common.h:80
OutputCtx_
Definition: tm-modules.h:84
SCConfLogOpenGeneric
int SCConfLogOpenGeneric(ConfNode *conf, LogFileCtx *log_ctx, const char *default_filename, int rotate)
open a generic output "log file", which may be a regular file or a socket
Definition: util-logopenfile.c:452
SSLStateConnp_::cert0_not_after
int64_t cert0_not_after
Definition: app-layer-ssl.h:259
LogCustomFormat_::cf_n
uint32_t cf_n
Definition: log-cf-common.h:72
LogCustomFormatNode_
Definition: log-cf-common.h:64
PRINT_BUF_LEN
#define PRINT_BUF_LEN
Definition: log-tlslog.c:51
LOG_TLS_DEFAULT
#define LOG_TLS_DEFAULT
Definition: log-tlslog.c:55
LogCustomFormatNode_::type
uint32_t type
Definition: log-cf-common.h:65
LOG_TLS_CF_DATE_NOT_AFTER
#define LOG_TLS_CF_DATE_NOT_AFTER
Definition: log-tlslog.c:63
MODULE_NAME
#define MODULE_NAME
Definition: log-tlslog.c:49
LOG_TLS_CF_SUBJECT
#define LOG_TLS_CF_SUBJECT
Definition: log-tlslog.c:66
util-debug.h
GET_IPV4_DST_ADDR_PTR
#define GET_IPV4_DST_ADDR_PTR(p)
Definition: decode.h:197
PKT_IS_TOSERVER
#define PKT_IS_TOSERVER(p)
Definition: decode.h:236
OutputInitResult_::ctx
OutputCtx * ctx
Definition: output.h:47
Packet_::ts
SCTime_t ts
Definition: decode.h:523
LOG_CF_CLIENT_IP
#define LOG_CF_CLIENT_IP
Definition: log-cf-common.h:42
LOG_CF_TIMESTAMP
#define LOG_CF_TIMESTAMP
Definition: log-cf-common.h:40
OutputRegisterTxModuleWithProgress
void OutputRegisterTxModuleWithProgress(LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, AppProto alproto, TxLogger TxLogFunc, int tc_log_progress, int ts_log_progress, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
Register a tx output module with progress.
Definition: output.c:344
AppLayerParserRegisterLogger
void AppLayerParserRegisterLogger(uint8_t ipproto, AppProto alproto)
Definition: app-layer-parser.c:457
LogTlsLogThread
struct LogTlsLogThread_ LogTlsLogThread
util-print.h
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:57
PrintInet
const char * PrintInet(int af, const void *src, char *dst, socklen_t size)
Definition: util-print.c:230
Packet_::sp
Port sp
Definition: decode.h:482
LOG_CF_SERVER_PORT
#define LOG_CF_SERVER_PORT
Definition: log-cf-common.h:45
SSLVersionToString
void SSLVersionToString(uint16_t version, char *buffer)
Definition: app-layer-ssl.c:346
util-time.h
OutputInitResult_::ok
bool ok
Definition: output.h:48
log-tlslog.h
SCLogWarning
#define SCLogWarning(...)
Macro used to log WARNING messages.
Definition: util-debug.h:249
LOGGER_TLS
@ LOGGER_TLS
Definition: suricata-common.h:467
app-layer-parser.h
Packet_
Definition: decode.h:475
LOG_CF_TIMESTAMP_U
#define LOG_CF_TIMESTAMP_U
Definition: log-cf-common.h:41
conf.h
Port
uint16_t Port
Definition: decode.h:216
SCTime_t
Definition: util-time.h:40
TmEcode
TmEcode
Definition: tm-threads-common.h:79
LOG_CF_WRITE_UNKNOWN_VALUE
#define LOG_CF_WRITE_UNKNOWN_VALUE(buffer)
Definition: log-cf-common.h:57
MemBuffer_
Definition: util-buffer.h:27
LogCustomFormat_
Definition: log-cf-common.h:71
PrintRawUriBuf
void PrintRawUriBuf(char *retbuf, uint32_t *offset, uint32_t retbuflen, uint8_t *buf, size_t buflen)
Definition: util-print.c:93
LOG_TLS_CF_VERSION
#define LOG_TLS_CF_VERSION
Definition: log-tlslog.c:61
TLSGetIPInformations
int TLSGetIPInformations(const Packet *p, char *srcip, socklen_t srcip_len, Port *sp, char *dstip, socklen_t dstip_len, Port *dp, int ipproto)
Definition: log-tlslog.c:81
LogCustomFormatNode_::data
char data[LOG_NODE_STRLEN]
Definition: log-cf-common.h:67
OutputInitResult_
Definition: output.h:46
GET_IPV4_SRC_ADDR_PTR
#define GET_IPV4_SRC_ADDR_PTR(p)
Definition: decode.h:196
LogTlsFileCtx
struct LogTlsFileCtx_ LogTlsFileCtx
suricata-common.h
OutputCtx_::DeInit
void(* DeInit)(struct OutputCtx_ *)
Definition: tm-modules.h:90
MemBufferFree
void MemBufferFree(MemBuffer *buffer)
Definition: util-buffer.c:81
version
uint8_t version
Definition: decode-gre.h:1
LogFileFreeCtx
int LogFileFreeCtx(LogFileCtx *lf_ctx)
LogFileFreeCtx() Destroy a LogFileCtx (Close the file and free memory)
Definition: util-logopenfile.c:868
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:32
threadvars.h
log-cf-common.h
LogTlsLogThread_::tlslog_ctx
LogTlsFileCtx * tlslog_ctx
Definition: log-tlslog.c:77
LOG_TLS_CF_SNI
#define LOG_TLS_CF_SNI
Definition: log-tlslog.c:65
TLS_HANDSHAKE_DONE
@ TLS_HANDSHAKE_DONE
Definition: app-layer-ssl.h:79
SCLogError
#define SCLogError(...)
Macro used to log ERROR messages.
Definition: util-debug.h:261
GET_IPV6_SRC_ADDR
#define GET_IPV6_SRC_ADDR(p)
Definition: decode.h:201
SCFree
#define SCFree(p)
Definition: util-mem.h:61
ConfNode_
Definition: conf.h:32
util-logopenfile.h
LOG_TLS_CF_DATE_NOT_BEFORE
#define LOG_TLS_CF_DATE_NOT_BEFORE
Definition: log-tlslog.c:62
util-buffer.h
LogCustomFormat_::cf_nodes
LogCustomFormatNode * cf_nodes[LOG_MAXN_NODES]
Definition: log-cf-common.h:73
LOG_CF_SERVER_IP
#define LOG_CF_SERVER_IP
Definition: log-cf-common.h:43
LOG_TLS_CF_ISSUER
#define LOG_TLS_CF_ISSUER
Definition: log-tlslog.c:67
LOG_CF_NONE
#define LOG_CF_NONE
Definition: log-cf-common.h:38
LOG_TLS_EXTENDED
#define LOG_TLS_EXTENDED
Definition: log-tlslog.c:56
MemBufferWriteString
void MemBufferWriteString(MemBuffer *dst, const char *fmt,...)
Definition: util-buffer.c:125
MemBuffer_::size
uint32_t size
Definition: util-buffer.h:28
MEMBUFFER_BUFFER
#define MEMBUFFER_BUFFER(mem_buffer)
Get the MemBuffers underlying buffer.
Definition: util-buffer.h:51
SSLStateConnp_::cert0_fingerprint
char * cert0_fingerprint
Definition: app-layer-ssl.h:260
LogCustomFormatAlloc
LogCustomFormat * LogCustomFormatAlloc(void)
Creates a custom format.
Definition: log-cf-common.c:54
MEMBUFFER_OFFSET
#define MEMBUFFER_OFFSET(mem_buffer)
Get the MemBuffers current offset.
Definition: util-buffer.h:56
Packet_::dp
Port dp
Definition: decode.h:490
LOG_CF_WRITE_SPACE_SEPARATOR
#define LOG_CF_WRITE_SPACE_SEPARATOR(buffer)
Definition: log-cf-common.h:54
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53
LogTlsFileCtx_::cf
LogCustomFormat * cf
Definition: log-tlslog.c:73
SSLStateConnp_::cert0_serial
char * cert0_serial
Definition: app-layer-ssl.h:257
app-layer-ssl.h
LOG_TLS_CF_SHA1
#define LOG_TLS_CF_SHA1
Definition: log-tlslog.c:64
SSL_AL_FLAG_LOG_WITHOUT_CERT
#define SSL_AL_FLAG_LOG_WITHOUT_CERT
Definition: app-layer-ssl.h:123
CreateTimeString
void CreateTimeString(const SCTime_t ts, char *str, size_t size)
Definition: util-time.c:272
MemBufferCreateNew
MemBuffer * MemBufferCreateNew(uint32_t size)
Definition: util-buffer.c:32
LOG_TLS_CF_EXTENDED
#define LOG_TLS_CF_EXTENDED
Definition: log-tlslog.c:68
output.h
LogTlsFileCtx_
Definition: log-tlslog.c:70
LogCustomFormatParse
int LogCustomFormatParse(LogCustomFormat *cf, const char *format)
Parses and saves format nodes for custom format.
Definition: log-cf-common.c:96
SCTIME_USECS
#define SCTIME_USECS(t)
Definition: util-time.h:56
LogTlsLogThread_
Definition: log-tlslog.c:76
SSLState_::flags
uint32_t flags
Definition: app-layer-ssl.h:303
SSLStateConnp_::version
uint16_t version
Definition: app-layer-ssl.h:244
ConfNodeLookupChildValue
const char * ConfNodeLookupChildValue(const ConfNode *node, const char *name)
Lookup the value of a child configuration node by name.
Definition: conf.c:809