1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

MDEV-12182 Add Client TCP Port Number to MySQL Audit Plugin Logs

In environments with load balancers or proxies, the audit plugin logs
only the IP address, making it difficult to differentiate individual client
connections from the same IP.

Add a new 'port' field to the appropriate event objects to capture the
client's TCP port number. Populate the port field with thd->port  in the
appropriate functions. The audit plugin receives and logs this port field
along  with  other connection information, enabling better identification
of individual client connections.

All new code of the whole pull request, including one or several files that
are either new files or modified ones, are contributed under the BSD-new license.
I am contributing on behalf of my employer Amazon Web Services, Inc.
This commit is contained in:
Hashim Syed
2024-06-04 23:58:37 +00:00
committed by Sergei Golubchik
parent c1f2b5a141
commit 1aba30b8f9
7 changed files with 455 additions and 422 deletions

View File

@@ -66,6 +66,7 @@ struct mysql_event_general
unsigned long long general_rows;
/* Added in version 0x302 */
unsigned long long query_id;
unsigned int port;
MYSQL_CONST_LEX_STRING database;
};
@@ -101,6 +102,7 @@ struct mysql_event_connection
unsigned int host_length;
const char *ip;
unsigned int ip_length;
unsigned int port;
MYSQL_CONST_LEX_STRING database;
/* Added in version 0x303 */
const char *tls_version;
@@ -139,6 +141,7 @@ struct mysql_event_table
const char *proxy_user;
const char *host;
const char *ip;
unsigned int port;
MYSQL_CONST_LEX_STRING database;
MYSQL_CONST_LEX_STRING table;
/* for MYSQL_AUDIT_TABLE_RENAME */