]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
eve/alert: add missing pgsql metadata
authorJuliana Fajardini <jufajardini@oisf.net>
Sat, 13 Apr 2024 02:10:48 +0000 (23:10 -0300)
committerVictor Julien <victor@inliniac.net>
Tue, 16 Apr 2024 06:00:40 +0000 (08:00 +0200)
Bug #6092

src/output-json-pgsql.c
src/output-json-pgsql.h
src/output.c

index 43eb95709844f09adbab444449a0d0cfb6144d24..623077e8ad44a8cb2ed989fbb92176f130d18d69 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2022 Open Information Security Foundation
+/* Copyright (C) 2022-2024 Open Information Security Foundation
  *
  * You can copy, redistribute or modify this Program under the terms of
  * the GNU General Public License version 2 as published by the Free
@@ -47,6 +47,7 @@
 #include "rust.h"
 
 #define PGSQL_LOG_PASSWORDS BIT_U32(0)
+#define PGSQL_DEFAULTS      (PGSQL_LOG_PASSWORDS)
 
 typedef struct OutputPgsqlCtx_ {
     uint32_t flags;
@@ -58,6 +59,11 @@ typedef struct LogPgsqlLogThread_ {
     OutputJsonThreadCtx *ctx;
 } LogPgsqlLogThread;
 
+bool JsonPgsqlAddMetadata(void *vtx, JsonBuilder *jb)
+{
+    return rs_pgsql_logger(vtx, PGSQL_DEFAULTS, jb);
+}
+
 static int JsonPgsqlLogger(ThreadVars *tv, void *thread_data, const Packet *p, Flow *f, void *state,
         void *txptr, uint64_t tx_id)
 {
index 78eca152d6fe3617321e8ff9c3c75bd17c6de8ce..617f256165390bca274af89667f20b779c1371d2 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2022 Open Information Security Foundation
+/* Copyright (C) 2022-2024 Open Information Security Foundation
  *
  * You can copy, redistribute or modify this Program under the terms of
  * the GNU General Public License version 2 as published by the Free
@@ -25,5 +25,6 @@
 #define SURICATA_OUTPUT_JSON_PGSQL_H
 
 void JsonPgsqlLogRegister(void);
+bool JsonPgsqlAddMetadata(void *vtx, JsonBuilder *jb);
 
 #endif /* SURICATA_OUTPUT_JSON_PGSQL_H */
index a1594926943f383664e39cd6e096f5538ce03f6f..7441557f84353488cd69759ef0844e667deba3d9 100644 (file)
@@ -1133,7 +1133,7 @@ static EveJsonSimpleAppLayerLogger simple_json_applayer_loggers[ALPROTO_MAX] = {
     { ALPROTO_SIP, (EveJsonSimpleTxLogFunc)rs_sip_log_json },
     { ALPROTO_RFB, rs_rfb_logger_log },
     { ALPROTO_MQTT, JsonMQTTAddMetadata },
-    { ALPROTO_PGSQL, NULL },  // TODO missing
+    { ALPROTO_PGSQL, JsonPgsqlAddMetadata },
     { ALPROTO_TELNET, NULL }, // no logging
     { ALPROTO_TEMPLATE, rs_template_logger_log },
     { ALPROTO_RDP, (EveJsonSimpleTxLogFunc)rs_rdp_to_json },