Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FB8-54, FB8-55, FB8-70, FB8-101: Expose more information to audit plugin #934

Closed
wants to merge 1 commit into from

Conversation

dutow
Copy link
Contributor

@dutow dutow commented Jan 22, 2019

Summary:
This commit adds the following fields to the generic event in audit log:

  • query_id
  • database
  • affected_rows
  • connection_certificate

Reference Patch: 1def6b7
Reference Patch: ce95a09
Reference Patch: 588be34
Reference Patch: ba03c70
Reference Patch: be8c587
Reference Patch: 22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the query_id and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through mysql_event_general
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.

Test Plan:
This commit also introduces changes to the audit_null plugin, which makes
the fields, and further similar changes testable.
The audit_null plugin now has the "extended_log" variable, which can be
turned on. When it's ON, the plugin logs the last generic event log
into the Audit_null_generic_event_response system variable.
This can be easily verified in MTR tests, which is done in the new
audit_null.event_params testcase.

@@ -455,6 +501,9 @@ static int audit_null_notify(MYSQL_THD thd, mysql_event_class_t event_class,
number_of_calls_general_result++;
break;
case MYSQL_AUDIT_GENERAL_STATUS:
if (extended_info) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move extended_info declaration here (inside the case block).

@@ -175,6 +183,10 @@ static MYSQL_THDVAR_INT(event_order_check_exact, PLUGIN_VAR_RQCMDARG,
"Plugin checks exact event order.", NULL, NULL, 1, 0, 1,
0);

static MYSQL_THDVAR_INT(extended_log, PLUGIN_VAR_RQCMDARG,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to declare this var as GLOBAL-only (MYSQL_SYSVAR_INT) since we are using a single global buffer for the output anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But doesn't that make thread level control useful? If it's a threadvar, you can turn it on for only one thread, and other threads won't accidentally modify the status variables, breaking tests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such change is too visible for user to be discussed only here (unless FB chimes in)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be debug only since it's mainly used for testing? Are there security issues with non-privileged users getting access to see the last logged query.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And is audit_null used outside MTR testing, in production? This is only present in that plugin, that's why I didn't see it as an issue. I can make it debug only, but that will also make all related tests debug only.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not used in production, but if it's used as a template for other audit plugins, it might run the risk of it getting out. Let's make it debug-only and having the tests be debug-only would be fine.

@@ -431,6 +476,7 @@ static int audit_null_notify(MYSQL_THD thd, mysql_event_class_t event_class,
const char *order_str = (const char *)THDVAR(thd, event_order_check);
int event_order_started = (int)THDVAR(thd, event_order_started);
int exact_check = (int)THDVAR(thd, event_order_check_exact);
int extended_info = (int)THDVAR(thd, extended_log);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const auto extended_info = static_cast<int>(THDVAR(thd, extended_log));

#undef EVENT_PARAM
#undef EVENT_PARAM_STR

std::string str = event_str.str();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const auto str = ...

@@ -455,6 +501,9 @@ static int audit_null_notify(MYSQL_THD thd, mysql_event_class_t event_class,
number_of_calls_general_result++;
break;
case MYSQL_AUDIT_GENERAL_STATUS:
if (extended_info) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (extended_info !=0)


INSERT INTO foo VALUES (1), (2);
--replace_regex /.*(affected_rows:[^;]*).*/\1/
SHOW STATUS LIKE "Audit_null_generic_event_response";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise


SELECT * FROM foo;
--replace_regex /.*(affected_rows:[^;]*).*/\1/
SHOW STATUS LIKE "Audit_null_generic_event_response";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise


DELETE FROM foo;
--replace_regex /.*(affected_rows:[^;]*).*/\1/
SHOW STATUS LIKE "Audit_null_generic_event_response";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise

let $MYSQLD_PORT= `SELECT @@port`;
--replace_result $MYSQLD_PORT MYSQLD_PORT
--replace_regex /.*(port:[^;]*).*/\1/
SHOW STATUS LIKE "Audit_null_generic_event_response";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise

Audit_null_generic_event_response port:MYSQLD_PORT
UNINSTALL PLUGIN null_audit;
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure the test works with --repeat=2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked, it works.

@percona-ysorokin
Copy link
Contributor

Also, please, add Jira ticket references

@dutow dutow changed the title WIP FB8-54, FB8-70, FB8-101: Expose more information to audit plugin WIP FB8-54, FB8-55, FB8-70, FB8-101: Expose more information to audit plugin Jan 23, 2019
@dutow
Copy link
Contributor Author

dutow commented Jan 23, 2019

Updated: alsoadded FB8-55.

Copy link
Contributor

@percona-ysorokin percona-ysorokin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add full Jira tickets URLs to the commit message

https://jira.percona.com/browse/FB8-54
https://jira.percona.com/browse/FB8-55
https://jira.percona.com/browse/FB8-70
https://jira.percona.com/browse/FB8-101

@@ -0,0 +1,24 @@
--source include/have_ssl.inc

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add --source include/count_sessions.inc as you are establishing/closing a new connection.

DROP TABLE foo;

UNINSTALL PLUGIN null_audit;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--source include/wait_until_count_sessions.inc

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still no --source include/wait_until_count_sessions.inc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

{ \
std::string tmp(event->name.str, event->name.length); \
boost::replace_all(tmp, "\n", "\\n"); \
event_str << #name ":" << std::string(event->name.str, event->name.length) \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be

event_str << #name ":" << tmp

?

sql/sql_class.cc Outdated
@@ -893,6 +895,15 @@ void THD::cleanup_connection(void) {
#endif
}

void THD::set_connection_certificate(std::string const &cert) {
DBUG_ASSERT(m_connection_certificate == "");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DBUG_ASSERT(m_connection_certificate.empty());

sql/sql_class.h Outdated
std::string m_connection_certificate;
#endif

std::string const &connection_certificate() const;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noexcept

Copy link
Contributor Author

@dutow dutow Jan 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, the std::string copy constructor could throw a bad_alloc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, no copy constructor here, the result is returned by const reference
std::string const &

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh, right, I completely missed the & aligned to the function name, fixed.

sql/sql_class.h Outdated
@@ -3323,6 +3323,13 @@ class THD : public MDL_context_owner,
Gtid_set owned_gtid_set;
#endif

#ifdef HAVE_OPENSSL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should connection_certificate() / set_connection_certificate() also be wrapped with #ifdef HAVE_OPENSSL?
Because otherwise, this does not seem to compile without HAVE_OPENSSL defined

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a trivial setter / getter, works without SSL.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, my main concern here was that when HAVE_OPENSSL is not defined, the class won't have m_connection_certificate member and therefore connection_certificate() / set_connection_certificate() will fail to compile as m_connection_certificate = cert; / return m_connection_certificate; will be an invalid code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -4032,6 +4039,7 @@ class THD : public MDL_context_owner,
m_persist_variables_init = is_init;
}
bool is_persist_variables_init() { return m_persist_variables_init; }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was clang-format, but I'll recheck what happens if I remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it was indeed clang-format.

@@ -130,6 +131,11 @@ static char *g_record_buffer;

#undef AUDIT_NULL_VAR

static const constexpr size_t event_response_buffer_len = 1000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is 1000 enough now when we have certificates also included in GENERAL STATUS event?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now yes, as all other fields are short.

Copy link
Contributor

@percona-ysorokin percona-ysorokin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dutow dutow changed the title WIP FB8-54, FB8-55, FB8-70, FB8-101: Expose more information to audit plugin FB8-54, FB8-55, FB8-70, FB8-101: Expose more information to audit plugin Jan 29, 2019
Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hermanlee has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hermanlee has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@hermanlee hermanlee changed the title FB8-54, FB8-55, FB8-70, FB8-101: Expose more information to audit plugin FB8-54, FB8-55, FB8-70, FB8-101, FB8-205: Expose more information to audit plugin Jan 30, 2019
@hermanlee hermanlee changed the title FB8-54, FB8-55, FB8-70, FB8-101, FB8-205: Expose more information to audit plugin FB8-54, FB8-55, FB8-70, FB8-101: Expose more information to audit plugin Jan 30, 2019
@@ -175,6 +183,10 @@ static MYSQL_THDVAR_INT(event_order_check_exact, PLUGIN_VAR_RQCMDARG,
"Plugin checks exact event order.", NULL, NULL, 1, 0, 1,
0);

static MYSQL_THDVAR_INT(extended_log, PLUGIN_VAR_RQCMDARG,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be debug only since it's mainly used for testing? Are there security issues with non-privileged users getting access to see the last logged query.

@@ -863,6 +863,8 @@ void THD::cleanup_connection(void) {
sp_cache_clear(&sp_proc_cache);
sp_cache_clear(&sp_func_cache);

m_connection_certificate = "";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be wrapped in #ifdef HAVE_OPENSSL?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably the opposite: any existing HAVE_OPENSSL uses should be removed from patches. E.g. Now CMakeLists.txt contains
ADD_DEFINITIONS(-DHAVE_OPENSSL) # TODO: remove #ifdef from C++ code

I guess it is assumed that WolfSSL is sufficiently similar to OpenSSL, and any code specific for it can be guarded with HAVE_WOLFSSL.

@@ -1058,6 +1071,8 @@ void THD::release_resources() {

if (current_thd == this) restore_globals();

m_connection_certificate = "";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, does this need to be wrapped in #ifdef OPENSSL?

boost::replace_all(tmp, "\n", "\\n"); \
event_str << #name ":" << tmp << ";"; \
}
std::stringstream event_str;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also seeing an internal error compiling this:

../../../plugin/audit_null/audit_null.cc: In function ‘void log_event(const mysql_event_general*)’:
../../../plugin/audit_null/audit_null.cc:438:21: error: aggregate ‘std::stringstream event_str’ has incomplete type and cannot be defined
std::stringstream event_str;

@facebook-github-bot
Copy link

@dutow has updated the pull request. Re-import the pull request

Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hermanlee has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link

@dutow has updated the pull request. Re-import the pull request

@@ -130,6 +132,11 @@ static char *g_record_buffer;

#undef AUDIT_NULL_VAR

static const constexpr size_t event_response_buffer_len = 1000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should event_response_buffer_len and generic_event_response definitions be also wrapped in #ifndef DBUG_OFF?

@@ -144,6 +151,9 @@ static SHOW_VAR simple_status[] = {

#undef AUDIT_NULL_VAR

{"Audit_null_generic_event_response", (char *)generic_event_response,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also be wrapped in #ifndef DBUG_OFF?

/*
* Exposes a generic audit log event in a status variable
*/
static void log_event(const mysql_event_general *event) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this function also be wrapped in #ifndef DBUG_OFF?

Jira issue: https://jira.percona.com/browse/FB8-54
Jira issue: https://jira.percona.com/browse/FB8-55
Jira issue: https://jira.percona.com/browse/FB8-70
Jira issue: https://jira.percona.com/browse/FB8-101

Reference Patch: 1def6b7
Reference Patch: ba03c70
Reference Patch: ce95a09
Reference Patch: be8c587
Reference Patch: 22b2508
Reference Patch: 588be34

Summary:
This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Test Plan:
This commit also introduces changes to the audit_null plugin, which makes
the fields, and further similar changes testable.
The audit_null plugin now has the "extended_log" variable, which can be
turned on. When it's ON, the plugin logs the last generic event log
into the Audit_null_generic_event_response system variable.
This can be easily verified in MTR tests, which is done in the new
audit_null.event_params and audit_null.event_params_cert testcases.
@facebook-github-bot
Copy link

@dutow has updated the pull request. Re-import the pull request

2 similar comments
@facebook-github-bot
Copy link

@dutow has updated the pull request. Re-import the pull request

@facebook-github-bot
Copy link

@dutow has updated the pull request. Re-import the pull request

Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hermanlee has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@hermanlee hermanlee closed this Feb 11, 2019
facebook-github-bot pushed a commit that referenced this pull request Feb 11, 2019
…gin (#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: 1def6b7
Reference Patch: ce95a09
Reference Patch: 588be34
Reference Patch: ba03c70
Reference Patch: be8c587
Reference Patch: 22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: #934

Reviewed By: lth

Differential Revision: D13874133

Pulled By: lth

fbshipit-source-id: 889398c
hermanlee pushed a commit to hermanlee/mysql-5.6 that referenced this pull request Oct 3, 2023
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
hermanlee pushed a commit to hermanlee/mysql-5.6 that referenced this pull request Oct 18, 2023
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/percona-server that referenced this pull request Apr 15, 2024
…gin (percona#934) (percona#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook/mysql-5.6@1def6b7
Reference Patch: facebook/mysql-5.6@ce95a09
Reference Patch: facebook/mysql-5.6@588be34
Reference Patch: facebook/mysql-5.6@ba03c70
Reference Patch: facebook/mysql-5.6@be8c587
Reference Patch: facebook/mysql-5.6@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook/mysql-5.6#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/percona-server that referenced this pull request Apr 16, 2024
…gin (percona#934) (percona#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook/mysql-5.6@1def6b7
Reference Patch: facebook/mysql-5.6@ce95a09
Reference Patch: facebook/mysql-5.6@588be34
Reference Patch: facebook/mysql-5.6@ba03c70
Reference Patch: facebook/mysql-5.6@be8c587
Reference Patch: facebook/mysql-5.6@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook/mysql-5.6#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/percona-server that referenced this pull request Apr 17, 2024
…gin (percona#934) (percona#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook/mysql-5.6@1def6b7
Reference Patch: facebook/mysql-5.6@ce95a09
Reference Patch: facebook/mysql-5.6@588be34
Reference Patch: facebook/mysql-5.6@ba03c70
Reference Patch: facebook/mysql-5.6@be8c587
Reference Patch: facebook/mysql-5.6@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook/mysql-5.6#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Apr 23, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Apr 25, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 7, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 8, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 9, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 10, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 13, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 15, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 16, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 17, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 21, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 21, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 30, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jun 12, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jun 13, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jun 14, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jun 20, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jun 21, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jun 25, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jul 2, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jul 19, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jul 19, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jul 31, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Aug 2, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Aug 6, 2024
…gin (facebook#934) (facebook#934)

Summary:
JIRA: https://jira.percona.com/browse/FB8-54
JIRA: https://jira.percona.com/browse/FB8-55
JIRA: https://jira.percona.com/browse/FB8-70
JIRA: https://jira.percona.com/browse/FB8-101

This commit adds the following fields to the generic event in audit log:
* query_id
* database
* affected_rows
* connection_certificate

Reference Patch: facebook@1def6b7
Reference Patch: facebook@ce95a09
Reference Patch: facebook@588be34
Reference Patch: facebook@ba03c70
Reference Patch: facebook@be8c587
Reference Patch: facebook@22b2508

We need some extra info for the shadowing and security logging. This is a
simple first step of info that MariaDB actually also exposes.
Now we would have the `query_id` and the database name for general events.
Making as few changes as possible to accomplish it, so I'm just taking the
information from the TDH and exposing it through `mysql_event_general`
struct and as a argument to disconnect.

Forward the connection certificate to the audit plugin. The connection certificate can then be parsed by the audit plugin and handled appropriately. It made more sense for the certificate to live in the connection events, since they generally don't change between every general event, so the move was done.

This is done by caching a BUF_MEM struct on the THD object. Since it's not possible to change certificates on the same connection, this caching should be correct. The BUF_MEM is released on THD::release_resources.

If upstream bumps the MYSQL_AUDIT_INTERFACE_VERSION, we should bump ours to be greater or equal to it.

Expose the port current mysqld is running on for the audit plugin. If no port, 0 is used.
Pull Request resolved: facebook#934

Reviewed By: lloyd

Differential Revision: D13874133

Pulled By: lth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants