#include "output-json-http.h"
#include "output-json-tls.h"
#include "output-json-ssh.h"
+#include "output-json-smtp.h"
#include "util-byte.h"
#include "util-privs.h"
#define LOG_JSON_HTTP 8
#define LOG_JSON_TLS 16
#define LOG_JSON_SSH 32
+#define LOG_JSON_SMTP 64
#define JSON_STREAM_BUFFER_SIZE 4096
}
}
+ if (json_output_ctx->flags & LOG_JSON_SMTP) {
+ if (p->flow != NULL) {
+ FLOWLOCK_RDLOCK(p->flow);
+ uint16_t proto = FlowGetAppProtocol(p->flow);
+
+ /* http alert */
+ if (proto == ALPROTO_SMTP) {
+ hjs = JsonSMTPAddMetadata(p->flow);
+ if (hjs)
+ json_object_set_new(js, "smtp", hjs);
+ }
+
+ FLOWLOCK_UNLOCK(p->flow);
+ }
+ }
+
/* payload */
if (json_output_ctx->flags & (LOG_JSON_PAYLOAD | LOG_JSON_PAYLOAD_BASE64)) {
int stream = (p->proto == IPPROTO_TCP) ?
const char *http = ConfNodeLookupChildValue(conf, "http");
const char *tls = ConfNodeLookupChildValue(conf, "tls");
const char *ssh = ConfNodeLookupChildValue(conf, "ssh");
+ const char *smtp = ConfNodeLookupChildValue(conf, "smtp");
if (ssh != NULL) {
if (ConfValIsTrue(ssh)) {
json_output_ctx->flags |= LOG_JSON_HTTP;
}
}
+ if (smtp != NULL) {
+ if (ConfValIsTrue(smtp)) {
+ json_output_ctx->flags |= LOG_JSON_SMTP;
+ }
+ }
if (payload_printable != NULL) {
if (ConfValIsTrue(payload_printable)) {
json_output_ctx->flags |= LOG_JSON_PAYLOAD;
# http: yes # enable dumping of http fields
# tls: yes # enable dumping of tls fields
# ssh: yes # enable dumping of ssh fields
+ # smtp: yes # enable dumping of smtp fields
# HTTP X-Forwarded-For support by adding an extra field or overwriting
# the source or destination IP address (depending on flow direction)